|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
nct.service.synonyms.DIPSynonyms
public class DIPSynonyms
Implements a SynonymMapper based on a DIP XIN file. This class is an XML ContentHandler which needs to be added to an XMLReader so that the events will be generated.
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
idMap
Maps a synonym to a dip file id. |
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> |
synMap
Maps the dip file id to a synonym. |
Constructor Summary | |
---|---|
DIPSynonyms()
Initializes the content handler. |
Method Summary | |
---|---|
protected void |
addId(java.lang.String id,
java.lang.String type,
java.lang.String synonym)
Adds an id to the synonym database for a specific type. |
protected void |
addValue(java.lang.String id,
java.lang.String type,
java.lang.String value)
Adds a value to the synonym database for a specific type. |
void |
characters(char[] ch,
int start,
int length)
Standard SAX event handler. |
void |
endDocument()
Standard SAX event handler. |
void |
endElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName)
Standard SAX event handler. |
java.lang.String |
getIdFromSynonym(java.lang.String synonym)
Returns the unique id for the specified synonym. |
java.util.List<java.lang.String> |
getPotentialSynonyms(java.lang.String regex)
Returns a list of matches to the input string which is treated as a regular expression pattern. |
java.lang.String |
getSynonym(java.lang.String synonym,
java.lang.String type)
A shortcut method for calling:
String s = syns.getSynonymFromId(syns.getIdFromSynonym(synonym), type);
|
java.lang.String |
getSynonymFromId(java.lang.String id,
java.lang.String type)
Returns a synonym of a particular type for the specified id. |
void |
startDocument()
Standard SAX event handler. |
void |
startElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName,
org.xml.sax.Attributes atts)
Standard SAX event handler. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> synMap
protected java.util.Map<java.lang.String,java.lang.String> idMap
Constructor Detail |
---|
public DIPSynonyms()
Method Detail |
---|
public java.lang.String getIdFromSynonym(java.lang.String synonym)
getIdFromSynonym
in interface SynonymMapper
synonym
- The synonym to check the database for.
public java.lang.String getSynonymFromId(java.lang.String id, java.lang.String type)
getSynonymFromId
in interface SynonymMapper
id
- The id to check the database for.type
- The type of synonym desired for the specified id.
public java.lang.String getSynonym(java.lang.String synonym, java.lang.String type)
String s = syns.getSynonymFromId(syns.getIdFromSynonym(synonym), type);
getSynonym
in interface SynonymMapper
synonym
- The synonym to check the database for.type
- The type of synonym desired for the specified input synonym.
public java.util.List<java.lang.String> getPotentialSynonyms(java.lang.String regex)
getPotentialSynonyms
in interface SynonymMapper
regex
- The regular expression that will be evaluated against each key in
the database.
protected void addId(java.lang.String id, java.lang.String type, java.lang.String synonym)
id
- The id to use for the synonym.type
- The type of the synonym.synonym
- The synonym to be stored.protected void addValue(java.lang.String id, java.lang.String type, java.lang.String value)
id
- The id to use for the value.type
- The type of the value.value
- The value to be stored.public void startDocument()
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
public void endDocument()
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
public void startElement(java.lang.String uri, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes atts)
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
public void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName)
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
public void characters(char[] ch, int start, int length)
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |