edu.stanford.nlp.process
Class Morphology
java.lang.Object
edu.stanford.nlp.process.Morphology
- All Implemented Interfaces:
- Function, java.io.Serializable
public class Morphology
- extends java.lang.Object
- implements Function
Morphology computes the base form of English words, by removing just
inflections (not derivational morphology). It is based on a finite-state
transducer implemented by John Carroll et al., written in flex and publicly
available.
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
Morpha (main) with arguments.
On creation Morphology reads a file that contains a list of verbs that have
doubling of
consonants and expects to find the file in
/u/nlp/data/morph/verbstem.list
, unless another file is
passed into the constructor.
- See Also:
- Serialized Form
Constructor Summary |
Morphology()
|
Morphology(java.io.Reader in)
|
Morphology(java.io.Reader in,
java.lang.String verbFile)
Process morphologically from a Reader, having loaded
verbs with stem doubling from the file verbFile . |
Morphology(java.lang.String filename)
|
Morphology(java.lang.String filename,
java.lang.String verbFile)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Morphology
public Morphology()
Morphology
public Morphology(java.io.Reader in)
Morphology
public Morphology(java.lang.String filename)
Morphology
public Morphology(java.io.Reader in,
java.lang.String verbFile)
- Process morphologically from a Reader, having loaded
verbs with stem doubling from the file
verbFile
.
Morphology
public Morphology(java.lang.String filename,
java.lang.String verbFile)
mapTag
public static java.lang.String mapTag(java.lang.String posTag)
stem
public Word stem(Word w)
stem
public WordTag stem(WordTag wT)
stem
public WordTag stem(java.lang.String word,
java.lang.String oldTag)
stemStatic
public static WordTag stemStatic(WordTag wT)
stemStatic
public static WordTag stemStatic(java.lang.String word,
java.lang.String oldTag)
apply
public java.lang.Object apply(java.lang.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
main
public static void main(java.lang.String[] args)