|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.tagger.maxent.StringTagger
Convenience class that takes a String input and outputs the tagged version of the String. The String is assumed to be untagged.
The constructor takes in a trained model, which is loaded immediately (takes a long time...). Then subsequent calls to tagString can be executed, passing in an untagged String; a tagged String is returned, unless there was a serious problem in the Tagging machinery, in which case null is returned.
Example:
StringTagger st = new StringTagger("/u/nlp/data/tagger.params/wsj0-21.holder");
String taggedString = st.tagString("Here's a tagged string.");
String taggedString2 = st.tagString("This is your life.");
The output is
Here's/JJ a/DT tagged/VBD string./NNP
and
This/DT is/VBZ your/PRP$ life./NN
respectively.
Constructor Summary | |
StringTagger(String fileModel)
Constructor that loads the dictionary, so it would behoove you not to create more than one of these, and just reuse the tagString. |
Method Summary | |
static void |
main(String[] argv)
Command-line driven tagger that takes input from stdin |
String |
tagString(String toTag)
Tags the input string according and returns the tagged version |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StringTagger(String fileModel)
fileModel
- filename of the trained model, for example "/u/nlp/data/tagger.params/wsj0-21.holder"Method Detail |
public String tagString(String toTag)
toTag
- the untagged input String
public static void main(String[] argv)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |