ca.uottawa.balie
Class NamedEntityType

java.lang.Object
  extended by ca.uottawa.balie.NamedEntityType
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class NamedEntityType
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Type of a NE

Author:
nadeaud
See Also:
Serialized Form

Constructor Summary
NamedEntityType(int pi_TagSetSize, NamedEntityExplanation pi_Info)
          Construct a new, empty, entity type
NamedEntityType(NamedEntityTypeEnumI pi_Type, int pi_TagSetSize, NamedEntityExplanation pi_Info)
          Construct a new entity type and set its type to a primitive
 
Method Summary
 void AddType(NamedEntityTypeEnumI pi_Type, NamedEntityExplanation pi_Info)
          Add a primitive type to this entity type (e.g. add LOCATION) An entity can have multiple types
 NamedEntityType clone(NamedEntityExplanation pi_Info)
           
 boolean equals(java.lang.Object pi_Obj)
           
 java.util.ArrayList<java.lang.String> GetAllLabels(NamedEntityTypeEnumI[] pi_Types)
           
 java.lang.String GetInfo()
          Get explanations about this named entity
 java.lang.String GetLabel(NamedEntityTypeEnumI[] pi_Types)
          Get a label for the current entity.
 int hashCode()
           
 boolean HasNoTag()
          Check if this entity has no primitive types
 boolean Intersect(NamedEntityType pi_NE)
          Check types that are common to this entity and the parameter entity
static NamedEntityType Intersection(NamedEntityType pi_NE1, NamedEntityType pi_NE2, NamedEntityExplanation pi_Info)
          Returns a entity that is the intersection of the two parameters
 boolean IsA(NamedEntityTypeEnumI pi_Type)
          Check if this entity has the given primitive type
 boolean IsEnd()
          Check if this entity ends an expression (equivalent to IsA(NETypes.END))
 boolean IsStart()
          Check if this entity dtarts an expression (equivalent to IsA(NETypes.START))
 void KeepOnly(NamedEntityType pi_NE, NamedEntityExplanation pi_Info)
          Keeps only the primitive types whose correspond to a type in the parameter entity Equivalent to bitwise AND
 void MergeWith(NamedEntityType pi_NE, NamedEntityExplanation pi_Info)
          Merge primitive type of current and parameter entity Equivalent to bitwise OR
 void RemoveType(NamedEntityTypeEnumI pi_Type, NamedEntityExplanation pi_Info)
          Remove a primitive type from this entity Succeed even if this entity do not have this type
 int TypeCount()
          Get the number of primitive types declared in this entity
 void WipeInfo()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedEntityType

public NamedEntityType(int pi_TagSetSize,
                       NamedEntityExplanation pi_Info)
Construct a new, empty, entity type

Parameters:
pi_TagSetSize - size of NE tag set

NamedEntityType

public NamedEntityType(NamedEntityTypeEnumI pi_Type,
                       int pi_TagSetSize,
                       NamedEntityExplanation pi_Info)
Construct a new entity type and set its type to a primitive

Parameters:
pi_Type - primitive type
Method Detail

clone

public NamedEntityType clone(NamedEntityExplanation pi_Info)

AddType

public void AddType(NamedEntityTypeEnumI pi_Type,
                    NamedEntityExplanation pi_Info)
Add a primitive type to this entity type (e.g. add LOCATION) An entity can have multiple types

Parameters:
pi_Type - primitive type

RemoveType

public void RemoveType(NamedEntityTypeEnumI pi_Type,
                       NamedEntityExplanation pi_Info)
Remove a primitive type from this entity Succeed even if this entity do not have this type

Parameters:
pi_Type - primitive type

Intersect

public boolean Intersect(NamedEntityType pi_NE)
Check types that are common to this entity and the parameter entity

Parameters:
pi_NE - an entity
Returns:
true if there is a non empty intersection

Intersection

public static NamedEntityType Intersection(NamedEntityType pi_NE1,
                                           NamedEntityType pi_NE2,
                                           NamedEntityExplanation pi_Info)
Returns a entity that is the intersection of the two parameters

Parameters:
pi_NE1 - an entity
pi_NE2 - another entity
Returns:
new entity that is the intersection of NE1 and NE2

KeepOnly

public void KeepOnly(NamedEntityType pi_NE,
                     NamedEntityExplanation pi_Info)
Keeps only the primitive types whose correspond to a type in the parameter entity Equivalent to bitwise AND

Parameters:
pi_NE - an entity

MergeWith

public void MergeWith(NamedEntityType pi_NE,
                      NamedEntityExplanation pi_Info)
Merge primitive type of current and parameter entity Equivalent to bitwise OR

Parameters:
pi_NE - an entity to merge with

GetLabel

public java.lang.String GetLabel(NamedEntityTypeEnumI[] pi_Types)
Get a label for the current entity. In case the entity has multiple primitive type, the first one (given NETypes order) is returned

Returns:
a String label

GetAllLabels

public java.util.ArrayList<java.lang.String> GetAllLabels(NamedEntityTypeEnumI[] pi_Types)

GetInfo

public java.lang.String GetInfo()
Get explanations about this named entity

Returns:
explanation string, HTML formatted

WipeInfo

public void WipeInfo()

IsA

public boolean IsA(NamedEntityTypeEnumI pi_Type)
Check if this entity has the given primitive type

Parameters:
pi_Type - primitive type
Returns:
true if the current entity has the primitive type

IsStart

public boolean IsStart()
Check if this entity dtarts an expression (equivalent to IsA(NETypes.START))

Returns:
true if IsA(Start)

IsEnd

public boolean IsEnd()
Check if this entity ends an expression (equivalent to IsA(NETypes.END))

Returns:
true if IsA(END)

HasNoTag

public boolean HasNoTag()
Check if this entity has no primitive types

Returns:
true if no tag

TypeCount

public int TypeCount()
Get the number of primitive types declared in this entity

Returns:
number fo primitive types

equals

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

hashCode

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