edu.stanford.nlp.process
Class Morphology

java.lang.Object
  extended by edu.stanford.nlp.process.Morphology
All Implemented Interfaces:
Function

public class Morphology
extends Object
implements Function

Morphology computes the base form of English words, by removing just inflections (not derivational morphology). That is, it only does noun plurals, pronoun case, and verb endings, and not things like comparative adjectives or derived nominals. It is based on a finite-state transducer implemented by John Carroll et al., written in flex and publicly available. See: http://www.informatics.susx.ac.uk/research/nlp/carroll/morph.html . There are several ways of invoking Morphology. One is by calling the static methods WordTag stemStatic(String word, String tag) or WordTag stemStatic(WordTag wordTag). If we have created a Morphology object already we can use the methods WordTag stem(String word, string tag) or WordTag stem(WordTag wordTag).

Another way of using Morphology is to run it on an input file by running java Morphology filename. In this case, POS tags must be separated from words by an underscore ("_").

Author:
Kristina Toutanova (kristina@cs.stanford.edu), Christopher Manning

Constructor Summary
Morphology()
           
Morphology(Reader in)
          Process morphologically words from a Reader.
Morphology(String filename)
           
 
Method Summary
 Object apply(Object in)
          Converts a T1 to a different T2.
 WordLemmaTag lemmatize(WordTag wT)
          Lemmatize returning a WordLemmaTag .
static WordLemmaTag lemmatizeStatic(WordTag wT)
           
static void main(String[] args)
          Run the morphological analyzer.
 Word next()
           
 WordTag stem(String word, String tag)
           
static WordTag stem(String word, String tag, edu.stanford.nlp.process.Morpha lexer, boolean lowercase)
          Lemmatize the word, being sensitive to the tag, using the passed in lexer.
 Word stem(Word w)
           
 WordTag stem(WordTag wT)
           
static WordTag stemStatic(String word, String tag)
          Return a new WordTag which has the lemma as the value of word().
static WordTag stemStatic(String word, String tag, boolean lowercase)
           
static WordTag stemStatic(WordTag wT)
          Return a new WordTag which has the lemma as the value of word().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Morphology

public Morphology()

Morphology

public Morphology(Reader in)
Process morphologically words from a Reader.


Morphology

public Morphology(String filename)
Method Detail

next

public Word next()
          throws IOException
Throws:
IOException

stem

public Word stem(Word w)

stem

public WordTag stem(WordTag wT)

stem

public WordTag stem(String word,
                    String tag)

stem

public static WordTag stem(String word,
                           String tag,
                           edu.stanford.nlp.process.Morpha lexer,
                           boolean lowercase)
Lemmatize the word, being sensitive to the tag, using the passed in lexer.

Parameters:
lowercase - If this is true, words other than proper nouns will be changed to all lowercase.

stemStatic

public static WordTag stemStatic(String word,
                                 String tag)
Return a new WordTag which has the lemma as the value of word(). The default is to lowercase non-proper-nouns, unless options have been set.


stemStatic

public static WordTag stemStatic(String word,
                                 String tag,
                                 boolean lowercase)

stemStatic

public static WordTag stemStatic(WordTag wT)
Return a new WordTag which has the lemma as the value of word(). The default is to lowercase non-proper-nouns, unless options have been set.


apply

public Object apply(Object in)
Description copied from interface: Function
Converts a T1 to a different T2. For example, a Parser will convert a Sentence to a Tree. A Tagger will convert a Sentence to a TaggedSentence.

Specified by:
apply in interface Function
Parameters:
in - The function's argument
Returns:
The function's evaluated value

lemmatize

public WordLemmaTag lemmatize(WordTag wT)
Lemmatize returning a WordLemmaTag .


lemmatizeStatic

public static WordLemmaTag lemmatizeStatic(WordTag wT)

main

public static void main(String[] args)
                 throws IOException
Run the morphological analyzer. Options are:


Stanford NLP Group