|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.whatswrong.Token
public class Token
A Token represents a word in an utterance. It consists of an index and a set of properties with name and value.
| Constructor Summary | |
|---|---|
Token(int index)
Creates a new token with the given index. |
|
| Method Summary | |
|---|---|
void |
addProperty(int index,
String property)
Add the property with name "Property [index]" and the given value. |
void |
addProperty(String value)
Adds a property with the given value. |
Token |
addProperty(String name,
String value)
Add a property with the given name and value. |
Token |
addProperty(TokenProperty property,
String value)
Add a property with given value. |
int |
compareTo(Token o)
Compares the indices of both tokens. |
boolean |
equals(Object o)
Checks whether the two tokens have the same index. |
int |
getIndex()
Returns the index of the token. |
String |
getProperty(TokenProperty property)
Get the value of the given property. |
Collection<TokenProperty> |
getPropertyTypes()
Return all token properties (the property names). |
Collection<String> |
getPropertyValues()
Returns a collection of all property values. |
List<TokenProperty> |
getSortedProperties()
Sorts the properties by property level and name. |
int |
hashCode()
Returns the index of the token. |
void |
merge(Token token)
Inserts all properties and values of the other token into this token. |
boolean |
propertiesContain(Collection<String> substrings,
boolean wholeWord)
Check whether any of the property values of this token contains any of the strings in the given set of strings. |
boolean |
propertiesContain(String substring)
Check whether any of the property values contains the given string. |
void |
removeProperty(int index)
Remove the property value with given index. |
void |
removeProperty(String name)
Remove the property value with the given name. |
String |
toString()
Returns a string representation of this token containing token index and properties. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Token(int index)
index - the index of the token.| Method Detail |
|---|
public int getIndex()
public Collection<TokenProperty> getPropertyTypes()
getProperty(TokenProperty).
public String getProperty(TokenProperty property)
property - the property to get the value for.
public void removeProperty(int index)
index - the index of the property to remove.public void removeProperty(String name)
name - the name of the property to remove.
public Token addProperty(String name,
String value)
name - the name of the property.value - the value of the property.
public void addProperty(int index,
String property)
index - the index of the propertyproperty - the value of the property.
public Token addProperty(TokenProperty property,
String value)
property - the property to addvalue - the value of the property
public void addProperty(String value)
value - the value of the property.public List<TokenProperty> getSortedProperties()
public Collection<String> getPropertyValues()
public boolean propertiesContain(String substring)
substring - the string to check whether it is contained in any property value of this token.
substring is a substring of the
corresponding property value.
public boolean propertiesContain(Collection<String> substrings,
boolean wholeWord)
substrings - set of strings to checkwholeWord - should we check for complete words of is it enough for the given strings to be substrings of
the token value.
substrings
(wholeword=true) or b) if there is a property value that contains one of the strings in
substrings (wholeword=false).public boolean equals(Object o)
equals in class Objecto - the other token.
index==((Token)o).indexpublic int hashCode()
hashCode in class Objectpublic void merge(Token token)
token - the token to merge with.public int compareTo(Token o)
compareTo in interface Comparable<Token>o - the other token.
index - o.getIndex()public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||