Open GoogleCodeExporter opened 8 years ago
A solution to this would be to create a copy of the word, and apply the plural,
when creating the lexicon variants. This is from the Actionscript version I'm
working on:
private function IndexWord(word:WordElement):void
{
...
// now index by variant
var variants:Dictionary = getVariants(word);
for (var variant:String in variants)
{
updateIndex(variants[variant], variant, indexByVariant);
}
}
private function getVariants(word:WordElement):Dictionary
{
var variants:Dictionary = new Dictionary();
variants[word.getBaseForm()] = word;
var category:ElementCategory = word.getCategory();
if (category is LexicalCategory)
{
var clone:WordElement;
switch (category)
{
case LexicalCategory.NOUN:
clone = word.clone() as WordElement;
clone.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
variants[getVariant(word, LexicalFeature.PLURAL, "s")] = clone;
break;
case LexicalCategory.ADJECTIVE:
variants[getVariant(word, LexicalFeature.COMPARATIVE, "er")] = word;
variants[getVariant(word, LexicalFeature.SUPERLATIVE, "est")] = word;
break;
case LexicalCategory.VERB:
variants[getVariant(word, LexicalFeature.PRESENT3S, "s")] = word;
variants[getVariant(word, LexicalFeature.PAST, "ed")] = word;
variants[getVariant(word, LexicalFeature.PAST_PARTICIPLE, "ed")] = word;
variants[getVariant(word, LexicalFeature.PRESENT_PARTICIPLE, "ing")] = word;
break;
default:
// only base needed for other forms
}
}
return variants;
}
Original comment by o...@steamshift.net
on 28 Feb 2012 at 6:25
Sorry, should've mentioned those were from the XMLLexicon class.
Original comment by o...@steamshift.net
on 28 Feb 2012 at 6:48
Original issue reported on code.google.com by
ehud.rei...@gmail.com
on 9 Jun 2011 at 10:59