ipipan.spejd.entities
Class Entity

java.lang.Object
  extended by ipipan.spejd.entities.Entity
Direct Known Subclasses:
Group, NoSpace, Segment, SentenceBorder

public abstract class Entity
extends java.lang.Object

An abstract syntactic entity - with subclasses like segment, word, group or sentence beginning / end.


Field Summary
static Entity[] ARRAY
           
static char GROUP
           
static char NOSPACE
           
static char NULL
           
static char SEGMENT
           
static char TOKEN
           
static char WORD
           
 
Constructor Summary
Entity()
           
 
Method Summary
 void add(boolean delOld, java.lang.String[] data)
          Add interpretations, optionally deleting old ones.
static java.lang.String concatAttr(int id, Entity[] s)
          Concatenate orth or base of a sequence of entities, adding space or not with respect to ns special entities.
static java.lang.String concatAttr(int id, Entity[] s, int start, int end)
          Concatenate orth or base of a sequence of entities, adding space or not with respect to ns special entities.
 void delete(java.util.regex.Pattern pattern, boolean neg)
          Delete all interpretations matching / not matching specified pattern.
 java.lang.String getAttr(int id)
          Get orthographic or base form of an entity.
static java.util.Set<java.lang.String> getCommonValues(Entity[] match, int[] attrIds)
          Get common values of specified attributes of specified entities.
 java.lang.String getGroupType()
          Get group type.
 java.lang.String getId()
           
 Interpretation[] getInterpretationArray()
          Get the set of interpretations.
 java.util.Set<Interpretation> getInterpretations()
          Get the set of interpretations.
 Entity getReplacement()
           
 Segment getSemHead()
          Get semantic head of an entity.
 Segment getSynHead()
          Get syntactic head of an entity.
abstract  void printXML(java.io.PrintStream out)
          Prints the XML (XCES) representation of entity on the given PrintStream.
 void setReplacement(Entity e)
          Sets replacement entity.
 void setRule(AbstractRule rule)
          Sets rule reference for diagnostic purposes.
 java.lang.String toTxt()
          Returns the representation of entity in the internal text format.
static boolean unify(Entity[] match, int[] attrIds)
          Unify specified entities with respect to specified attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final char NULL
See Also:
Constant Field Values

TOKEN

public static final char TOKEN
See Also:
Constant Field Values

SEGMENT

public static final char SEGMENT
See Also:
Constant Field Values

NOSPACE

public static final char NOSPACE
See Also:
Constant Field Values

WORD

public static final char WORD
See Also:
Constant Field Values

GROUP

public static final char GROUP
See Also:
Constant Field Values

ARRAY

public static final Entity[] ARRAY
Constructor Detail

Entity

public Entity()
Method Detail

concatAttr

public static java.lang.String concatAttr(int id,
                                          Entity[] s,
                                          int start,
                                          int end)
Concatenate orth or base of a sequence of entities, adding space or not with respect to ns special entities.

Parameters:
id - attribute to concatenate (Attribute.ORTH or Attribute.BASE)
s - an array of Entities
start - start of the sequence to concatenate
end - end of the sequence to concatenate

concatAttr

public static java.lang.String concatAttr(int id,
                                          Entity[] s)
Concatenate orth or base of a sequence of entities, adding space or not with respect to ns special entities.

Parameters:
id - attribute to concatenate (Attribute.ORTH or Attribute.BASE)
s - an array of Entities

getCommonValues

public static java.util.Set<java.lang.String> getCommonValues(Entity[] match,
                                                              int[] attrIds)
Get common values of specified attributes of specified entities.


unify

public static boolean unify(Entity[] match,
                            int[] attrIds)
Unify specified entities with respect to specified attributes.


getId

public java.lang.String getId()

getAttr

public java.lang.String getAttr(int id)
Get orthographic or base form of an entity.

Parameters:
id - Attribute.ORTH or Attribute.BASE
Returns:
orthographic or base form for segments and words, empty string for groups and special entities (ns, sb, se).

getSemHead

public Segment getSemHead()
Get semantic head of an entity.

Returns:
semantic head of a group, null otherwise

getSynHead

public Segment getSynHead()
Get syntactic head of an entity.

Returns:
semantic head of a group, null otherwise

getGroupType

public java.lang.String getGroupType()
Get group type.

Returns:
type of a group, null otherwise

getInterpretations

public java.util.Set<Interpretation> getInterpretations()
Get the set of interpretations.

Returns:
a set of interpretations for segments and words, null for groups and special entities (ns, sb, se).

getInterpretationArray

public Interpretation[] getInterpretationArray()
Get the set of interpretations.

Returns:
a set of interpretations for segments and words, null for groups and special entities (ns, sb, se).

delete

public void delete(java.util.regex.Pattern pattern,
                   boolean neg)
Delete all interpretations matching / not matching specified pattern.


add

public void add(boolean delOld,
                java.lang.String[] data)
Add interpretations, optionally deleting old ones.


setReplacement

public void setReplacement(Entity e)
Sets replacement entity. Should be used for the first entity in a identified syntactic structure. During the next sentence update the entity will be replaced by the new structure.


setRule

public void setRule(AbstractRule rule)
Sets rule reference for diagnostic purposes. Should be used only if the entity has been created (or modified) by a rule (ie. not read from the input file).


getReplacement

public Entity getReplacement()

toTxt

public java.lang.String toTxt()
Returns the representation of entity in the internal text format.


printXML

public abstract void printXML(java.io.PrintStream out)
Prints the XML (XCES) representation of entity on the given PrintStream.