edu.stanford.nlp.parser.lexparser
Class IntTaggedWord

java.lang.Object
  extended by edu.stanford.nlp.parser.lexparser.IntTaggedWord
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<IntTaggedWord>

public class IntTaggedWord
extends java.lang.Object
implements java.io.Serializable, java.lang.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

Field Summary
static java.lang.String ANY
           
static int ANY_TAG_INT
           
static int ANY_WORD_INT
           
static java.lang.String STOP
           
static int STOP_TAG_INT
           
static int STOP_WORD_INT
           
 short tag
           
 int word
           
 
Constructor Summary
IntTaggedWord(int word, int tag)
           
IntTaggedWord(java.lang.String s, char splitChar, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
          Creates an IntTaggedWord given by the String representation of the form <word>|<tag*gt;
IntTaggedWord(java.lang.String wordString, java.lang.String tagString, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
          Creates an IntTaggedWord given by the tagString and wordString
 
Method Summary
 int compareTo(IntTaggedWord that)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 int tag()
           
 java.lang.String tagString(Index<java.lang.String> tagIndex)
           
 java.lang.String toLexicalEntry(Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
           
 java.lang.String toString()
           
 java.lang.String toString(Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
           
 java.lang.String toString(java.lang.String arg, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
           
 TaggedWord toTaggedWord(Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
           
 int word()
           
 java.lang.String wordString(Index<java.lang.String> wordIndex)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

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 java.lang.String ANY
See Also:
Constant Field Values

STOP

public static final java.lang.String STOP
See Also:
Constant Field Values

word

public final int word

tag

public final short tag
Constructor Detail

IntTaggedWord

public IntTaggedWord(int word,
                     int tag)

IntTaggedWord

public IntTaggedWord(java.lang.String s,
                     char splitChar,
                     Index<java.lang.String> wordIndex,
                     Index<java.lang.String> tagIndex)
Creates an IntTaggedWord given by the String representation of the form <word>|<tag*gt;


IntTaggedWord

public IntTaggedWord(java.lang.String wordString,
                     java.lang.String tagString,
                     Index<java.lang.String> wordIndex,
                     Index<java.lang.String> tagIndex)
Creates an IntTaggedWord given by the tagString and wordString

Method Detail

tag

public int tag()

word

public int word()

wordString

public java.lang.String wordString(Index<java.lang.String> wordIndex)

tagString

public java.lang.String tagString(Index<java.lang.String> tagIndex)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(IntTaggedWord that)
Specified by:
compareTo in interface java.lang.Comparable<IntTaggedWord>

toLexicalEntry

public java.lang.String toLexicalEntry(Index<java.lang.String> wordIndex,
                                       Index<java.lang.String> tagIndex)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(Index<java.lang.String> wordIndex,
                                 Index<java.lang.String> tagIndex)

toString

public java.lang.String toString(java.lang.String arg,
                                 Index<java.lang.String> wordIndex,
                                 Index<java.lang.String> tagIndex)

toTaggedWord

public TaggedWord toTaggedWord(Index<java.lang.String> wordIndex,
                               Index<java.lang.String> tagIndex)


Stanford NLP Group