mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Omit needless words: add some more verbs found in Cocoa.
Add adjust, alter, animate, capture, center, collapse, define, dim, echo, enable, export, import, localize, maintain, notify, preload, require, retain, resize, reuse, suppress, translate, traverse, <re>verb and auto<verb>. Swift SVN r32457
This commit is contained in:
@@ -74,6 +74,18 @@ PartOfSpeech swift::getPartOfSpeech(StringRef word) {
|
||||
return PartOfSpeech::Gerund;
|
||||
}
|
||||
|
||||
// "auto" tends to be used as a verb prefix.
|
||||
if (word.startswith("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 (getPartOfSpeech(word.substr(2)) == PartOfSpeech::Verb)
|
||||
return PartOfSpeech::Verb;
|
||||
}
|
||||
|
||||
return PartOfSpeech::Unknown;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user