views:

71

answers:

3

Hi,

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

A: 

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.

Gilbert Le Blanc
there is an api for Wordnik that would basically provide that: http://www.wordnik.com/developers
ealdent
Thanks for finding the link.
Gilbert Le Blanc
+1  A: 

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.

larsmans
+1  A: 

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.

msbmsb