public class GazetteerNode extends Object
A node in a gazetteer list allowing an arbitary amount of features to be added as metadata to an entry, e.g.:
With the separator set to '\t', if a gazetteer entry looked like this:
Vodaphone type=mobile phone company
Then the GazetteerNode would consist of an entry "Vodaphone", with a featureMap containing the key "type", mapped to "mobile phone company".
Constructor and Description |
---|
GazetteerNode(String node)
Parses and create a gazetteer node from a string using no separator, i.e.
|
GazetteerNode(String entry,
Map<String,Object> featureMap)
Constructor.
|
GazetteerNode(String node,
String separator)
Parses and create a gazetteer node from a string
|
GazetteerNode(String node,
String separator,
boolean isOrdered)
Parses and create a gazetteer node from a string
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Checks this node vs another one for equality.
|
String |
featureMapToString(Map<String,Object> featureMap)
Converts a featureMap to separated name value pairs.
|
String |
getEntry() |
Map<String,Object> |
getFeatureMap() |
String |
getSeparator() |
int |
hashCode() |
void |
setEntry(String entry) |
void |
setFeatureMap(Map<String,Object> featureMap) |
void |
setSeparator(String separator) |
String |
toString()
Gets the string representation of this node
|
public GazetteerNode(String entry, Map<String,Object> featureMap)
entry
- the gazetteer entryfeatureMap
- a map of name-value pairspublic GazetteerNode(String node)
node
- the gazetteer node to be parsedpublic GazetteerNode(String node, String separator)
node
- the gazetteer node to be parsedseparator
- the separator used in the gazetteer node string to delimit
each name-value pair of features. If the separator is null, then the whole
node will be used as the gazetteer entrypublic GazetteerNode(String node, String separator, boolean isOrdered)
node
- the gazetteer node to be parsedseparator
- the separator used in the gazetteer node string to delimit
each name-value pair of features. If the separator is null, then the whole
node will be used as the gazetteer entryisOrdered
- true if the feature maps used should be orderedpublic String featureMapToString(Map<String,Object> featureMap)
featureMap
- map to be convertedpublic Map<String,Object> getFeatureMap()
public void setFeatureMap(Map<String,Object> featureMap)
featureMap
- the featureMap to setpublic String getSeparator()
public void setSeparator(String separator)
separator
- the separator to set