[Omit needless words] "de-" is a verb prefix.

... and handle verb prefixes properly.
This commit is contained in:
Doug Gregor
2016-02-22 12:54:54 -08:00
parent 4187959e66
commit 4e16f625b1
2 changed files with 8 additions and 7 deletions

View File

@@ -82,13 +82,19 @@ PartOfSpeech swift::getPartOfSpeech(StringRef word) {
}
// "auto" tends to be used as a verb prefix.
if (word.startswith("auto") && word.size() > 4) {
if (startsWithIgnoreFirstCase(word, "auto") && word.size() > 4) {
if (getPartOfSpeech(word.substr(4)) == PartOfSpeech::Verb)
return PartOfSpeech::Verb;
}
// "re" can prefix a verb.
if (word.startswith("re") && word.size() > 2) {
if (startsWithIgnoreFirstCase(word, "re") && word.size() > 2) {
if (getPartOfSpeech(word.substr(2)) == PartOfSpeech::Verb)
return PartOfSpeech::Verb;
}
// "de" can prefix a verb.
if (startsWithIgnoreFirstCase(word, "de") && word.size() > 2) {
if (getPartOfSpeech(word.substr(2)) == PartOfSpeech::Verb)
return PartOfSpeech::Verb;
}