curran / curran/google-diff-match-patch

Uppercase letter boundary in semantic cleanup

Open
#72 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
Python
Stars
17
Forks
2
PR merge metrics
No merged PRs in 30d

Description

```
Adding an "uppercase letter boundary" to semantic cleanup score will make code
diffs look nicer.

For example,
cleanupSemanticScore
would be changed to
cleanupSemanticScore

This might be useful in regular texts too (e.g. with people's names -
M[cM]illan => [Mc]Millan)

The change seems to be easy and straightforward:

private int diff_cleanupSemanticScore(String one, String two) {
...
boolean uppercase1 = Character.isUpperCase(char1);
boolean uppercase2 = Character.isUpperCase(char2);
...
else if (!uppercase1 && uppercase2) {
// One point for upper case.
return 1;
}
return 0;
}
```

Original issue reported on code.google.com by `2sa...@gmail.com` on 13 Jun 2012 at 5:00

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.