Java – find nouns and verbs in the Stanford parser

I need to find out whether a word is a verb or a noun, or both

For example, the word "search" can be either a noun or a verb, but the Stanford parser will provide it with an NN tag

Is there any way for the Stanford parser to give that "search" is both a noun and a verb?

The code I use now

public static String Lemmatize(String word) {
    WordTag w = new WordTag(word);
    w.setTag(POSTagWord(word));
    Morphology m = new Morphology();
    WordLemmaTag wT = m.lemmatize(w);

    return wT.lemma();
}

Or should I use any other software to do this? Please advise me to thank you in advance

Solution

Stanford parser guesses the part of speech marks of words according to context statistics You should really pass in a complete sentence to determine whether "search" is a noun or a verb in this sentence

You don't need a full parser to get part of speech tags Stanford POS tagger is enough; It also includes the morphology class, but it also considers context

If you want all part of speech tags that an English word can use without giving context, WordNet may be a better choice It has several Java interfaces, including jwnl and jwi

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>