protected void ParseBaseVerbName(MethodDeclarationNode node)
{
//this assumes that the node has already had its name split and preamble stripped
PhraseNode parsedName = node.ParsedName;
//TODO: from Emily, what if it starts with an adverb??
//if 1 word, assume verb
if (parsedName.Size() == 1)
{
if (PosData.IsIgnorableVerb(parsedName[0].Text))
{
parsedName[0].Tag = PartOfSpeechTag.VerbIgnorable;
}
else
{
parsedName[0].Tag = PartOfSpeechTag.Verb;
}
return;
}
int currentWord = 0;
currentWord = CheckForIgnorableVerb(parsedName, currentWord);
//check for a verb modifier
if (currentWord < parsedName.Size())
{
if (PosData.IsAdverb(parsedName[currentWord].Text)
&& parsedName[currentWord].Text.EndsWith("ly")
&& !PosData.IsDeterminer(parsedName[currentWord].Text)
&& !PosData.IsPronoun(parsedName[currentWord].Text)
&& !PosData.IsPreposition(parsedName[currentWord].Text))
{
if (currentWord + 1 < parsedName.Size() && PosData.IsPotentialVerb(parsedName[currentWord + 1].Text))
{
parsedName[currentWord].Tag = PartOfSpeechTag.VerbModifier;
}
}
}
if (PosData.IsIgnorableVerb(parsedName[currentWord].Text))
{
parsedName[currentWord].Tag = PartOfSpeechTag.VerbIgnorable;
}
else
{
parsedName[currentWord].Tag = PartOfSpeechTag.Verb;
}
currentWord++;
//check for verb particle
if (currentWord < parsedName.Size())
{
if (PosData.IsVerbParticle(parsedName[currentWord - 1].Text, parsedName[currentWord].Text))
{
parsedName[currentWord].Tag = PartOfSpeechTag.VerbParticle;
}
}
//rest of words should be objects or prepositions
if (currentWord < parsedName.Size())
{
int prep = FindFirstPreposition(parsedName, currentWord);
if (prep == -1)
{
PosTagger.TagNounPhrase(parsedName, currentWord, parsedName.Size() - 1);
}
else
{
//found a preposition, could be VX?PY?(f?)
bool noX = false;
bool noY = false;
if (currentWord == prep)
{
noX = true;
}
else
{
PosTagger.TagNounPhrase(parsedName, currentWord, prep - 1);
}
currentWord = prep + 1;
if (currentWord >= parsedName.Size())
{
noY = true;
}
else
{
PosTagger.TagNounPhrase(parsedName, currentWord, parsedName.Size() - 1);
}
}
}
}