mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Omit needless words] "de-" is a verb prefix.
... and handle verb prefixes properly.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user