[Omit needless words] After "by", recognize gerunds more liberally.

This commit is contained in:
Doug Gregor
2016-02-12 16:13:38 -08:00
parent 46b7d549e5
commit bc18e4521b
3 changed files with 9 additions and 1 deletions

View File

@@ -508,7 +508,7 @@ static StringRef omitNeedlessWordsFromPrefix(StringRef name,
if (firstWord == "By") {
StringRef nextWord = camel_case::getFirstWord(
newName.substr(firstWord.size()));
if (getPartOfSpeech(nextWord) == PartOfSpeech::Gerund) {
if (nextWord.endswith("ing")) {
return toLowercaseWord(newName.substr(firstWord.size()), scratch);
}
}
@@ -913,6 +913,11 @@ static bool priorWordExtendsPreposition(StringRef preceding,
camel_case::sameWordIgnoreFirstCase(preposition, "matching"))
return true;
// according to
if (camel_case::sameWordIgnoreFirstCase(preceding, "according") &&
camel_case::sameWordIgnoreFirstCase(preposition, "to"))
return true;
return false;
}