edu.stanford.nlp.ie.pcfg
Class XLabel

java.lang.Object
  |
  +--edu.stanford.nlp.ie.pcfg.XLabel

public class XLabel
extends Object

An XLabel is a tree node label that holds certain information specific to the information extraction task (and my information extraction system in general). An XLabel has the following format: type+head[{tags}], e.g., VP+sold[{purchaser,acqloc}].


Field Summary
static String delim
          the delimiter used to separate a label type from its head word
 String head
          label head.
 List tags
          a list of tags contained by the phrase represented by this label
 String type
          label type.
 
Constructor Summary
XLabel(String s)
          construct a new XLabel from an existing string in XLabel format.
 
Method Summary
 void AddTag(String tag)
          adds a tag if it hasn't already been added.
 void Copy(XLabel fromLabel, boolean includeHead, boolean includeTags)
          Copies head and tag information from fromLabel to this label.
 boolean equals(Object o)
          Checks whether two labels are equal
 int hashCode()
          Gets a hash code for the label.
static void main(String[] args)
           
 boolean Similar(XLabel label2, boolean includeHead, boolean includeTags)
          Checks whether two labels are the same.
 String toString()
          Gets a string representation of the label.
 String toString(boolean includeHead, boolean includeTags)
          Gets a string representation of the label.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

delim

public static final String delim
the delimiter used to separate a label type from its head word

See Also:
Constant Field Values

type

public String type
label type. e.g. NP, VP, etc.


head

public String head
label head. the lexical head of the phrase represented by this label.


tags

public List tags
a list of tags contained by the phrase represented by this label

Constructor Detail

XLabel

public XLabel(String s)
construct a new XLabel from an existing string in XLabel format. e.g., you could call new XLabel("VP") or new XLabel("VP+sell[{purchaser}]

Method Detail

toString

public String toString(boolean includeHead,
                       boolean includeTags)
Gets a string representation of the label.


toString

public String toString()
Gets a string representation of the label. Calls toString(true, true)

Overrides:
toString in class Object

hashCode

public int hashCode()
Gets a hash code for the label. Calculated as toString().hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Checks whether two labels are equal

Overrides:
equals in class Object

Similar

public boolean Similar(XLabel label2,
                       boolean includeHead,
                       boolean includeTags)
Checks whether two labels are the same.

Parameters:
includeHead - if true, uses head information in its comparison. if false, ignores head information
includeTags - if true, uses tag information in its comparison. if false, ignores head information

AddTag

public void AddTag(String tag)
adds a tag if it hasn't already been added.


Copy

public void Copy(XLabel fromLabel,
                 boolean includeHead,
                 boolean includeTags)
Copies head and tag information from fromLabel to this label.

Parameters:
includeHead - if head information should be copied
includeTags - if tag information should be copied

main

public static void main(String[] args)


Stanford NLP Group