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:
Doug Gregor
2015-10-06 07:03:09 +00:00
parent 9f7a1e7d08
commit bf55d2712e
2 changed files with 35 additions and 0 deletions

View File

@@ -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;
}