edu.stanford.nlp.parser.lexparser
Class IntTaggedWord
java.lang.Object
edu.stanford.nlp.parser.lexparser.IntTaggedWord
- All Implemented Interfaces:
- Serializable, Comparable<IntTaggedWord>
public class IntTaggedWord
- extends Object
- implements Serializable, Comparable<IntTaggedWord>
Represents a WordTag (in the sense that equality is defined
on both components), where each half is represented by an
int indexed by a Index. In this representation, -1 is
used to represent the wildcard ANY value, and -2 is used
to represent a STOP value (i.e., no more dependents).
TODO: does that cause any problems regarding unseen words also being -1?
TODO: any way to not have links to the Index in each object?
- Author:
- Dan Klein, Christopher Manning
- See Also:
- Serialized Form
ANY_WORD_INT
public static final int ANY_WORD_INT
- See Also:
- Constant Field Values
ANY_TAG_INT
public static final int ANY_TAG_INT
- See Also:
- Constant Field Values
STOP_WORD_INT
public static final int STOP_WORD_INT
- See Also:
- Constant Field Values
STOP_TAG_INT
public static final int STOP_TAG_INT
- See Also:
- Constant Field Values
ANY
public static final String ANY
- See Also:
- Constant Field Values
STOP
public static final String STOP
- See Also:
- Constant Field Values
word
public final int word
tag
public final short tag
IntTaggedWord
public IntTaggedWord(int word,
int tag)
IntTaggedWord
public IntTaggedWord(String s,
char splitChar,
Index<String> wordIndex,
Index<String> tagIndex)
- Creates an IntTaggedWord given by the String representation
of the form <word>|<tag*gt;
IntTaggedWord
public IntTaggedWord(String wordString,
String tagString,
Index<String> wordIndex,
Index<String> tagIndex)
- Creates an IntTaggedWord given by the tagString and wordString
tag
public int tag()
word
public int word()
wordString
public String wordString(Index<String> wordIndex)
tagString
public String tagString(Index<String> tagIndex)
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
compareTo
public int compareTo(IntTaggedWord that)
- Specified by:
compareTo
in interface Comparable<IntTaggedWord>
toLexicalEntry
public String toLexicalEntry(Index<String> wordIndex,
Index<String> tagIndex)
toString
public String toString()
- Overrides:
toString
in class Object
toString
public String toString(Index<String> wordIndex,
Index<String> tagIndex)
toString
public String toString(String arg,
Index<String> wordIndex,
Index<String> tagIndex)
toTaggedWord
public TaggedWord toTaggedWord(Index<String> wordIndex,
Index<String> tagIndex)
Stanford NLP Group