uk.ac.man.entitytagger.generate
Class DictionaryEntry
java.lang.Object
uk.ac.man.entitytagger.generate.DictionaryEntry
public class DictionaryEntry
- extends java.lang.Object
A class representing a dictionary entry of some object, consisting of a number of regular expression synonyms and an id.
This could for instance be a species with id 9606 and synonyms "human" and "man"
- Author:
- Martin
Field Summary |
private java.lang.String |
comment
|
private java.lang.String |
id
|
private java.util.regex.Pattern |
pattern
|
private java.lang.String |
regexp
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
id
private java.lang.String id
pattern
private java.util.regex.Pattern pattern
regexp
private java.lang.String regexp
comment
private java.lang.String comment
DictionaryEntry
public DictionaryEntry(java.lang.String id)
DictionaryEntry
public DictionaryEntry(java.lang.String id,
java.lang.String comment)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getId
public java.lang.String getId()
reset
private void reset()
getPattern
public java.util.regex.Pattern getPattern()
- Returns:
- a compiled regular expression which matches all added synonyms for this entry
getRegexp
java.lang.String getRegexp()
- Returns:
- the regular expression which matches all added synonyms for this entry
addPattern
public void addPattern(java.lang.String regexp)
- Adds a regular expression pattern to this entry. Any added patterns are valid matches (full regular expression will be (expr1)|(expr2)|...|(exprn))
- Parameters:
regexp
-
setComment
public void setComment(java.lang.String comment)
- Parameters:
comment
- the comment to set
setId
public void setId(java.lang.String id)
getComment
public java.lang.String getComment()
- Returns:
- the comment
convertRegexpToVariants
public java.util.Set<java.lang.String> convertRegexpToVariants()
saveVariantsToDB
public void saveVariantsToDB(java.sql.PreparedStatement pstmt,
java.util.Set<java.lang.String> stopList)