Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

finding noun and verb in stanford parser

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

For example, the word is "search" it can be both noun and a verb but stanford parser gives NN tag to it..

is there any way that stanford parser will give that "search" is both noun and verb?

code that 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 it? please suggest me thanks in advance

like image 343
karthi Avatar asked Oct 04 '10 11:10

karthi


3 Answers

The Stanford Parser guesses the part-of-speech tag of a word based on context statistics. You should really pass in a complete sentence to determine whether, in that sentence, "search" is a noun or a verb.

You don't need a full parser just to get part-of-speech tags. The Stanford POS Tagger is enough; it also includes the Morphology class, but it too takes context into account.

If you want all part-of-speech tags that an English word can take on, without giving context, then WordNet is probably a better choice. It has several Java interfaces, including JWNL and JWI.

like image 121
Fred Foo Avatar answered Oct 14 '22 11:10

Fred Foo


WordNet is what you want. It provides an API to an English lexicon with possible parts-of-speech, synonyms, word senses, hypernym/hyponym relations and more.

See Yawni for a great pure-Java WordNet API.

like image 25
msbmsb Avatar answered Oct 14 '22 09:10

msbmsb


The Stanford parser parses words in the context of a sentence. To use your example of "search", in any given sentence, "search" will be a noun or a verb, but not both a noun and a verb in the same sentence.

What you're looking for is a dictionary look up. I've found several online dictionaries that would give you the information you're looking for. Here's an example from the Free Online Dictionary for the word "search".

It turns out that "search" can be a noun, verb, intransitive verb, and transitive verb.

I could not find an application programming interface (API) that would give you the same type of information as you find on the Free Online Dictionary web page. If your vocabulary list is limited, you could build your own API.

like image 1
Gilbert Le Blanc Avatar answered Oct 14 '22 09:10

Gilbert Le Blanc