uk.ac.man.entitytagger.generate
Class GenerateMatchers
java.lang.Object
uk.ac.man.entitytagger.generate.GenerateMatchers
public class GenerateMatchers
- extends java.lang.Object
Main class for loading a species name dictionary and custom synonyms, and then calling other classes to generate regular expressions for species entries and convert them into automatons for efficient text matching.
- Author:
- Martin
Method Summary |
private static void |
convertToVariants(java.util.HashMap<java.lang.String,DictionaryEntry> dict,
java.io.File file,
java.sql.PreparedStatement pstmt,
int numThreads,
java.util.logging.Logger logger,
int report)
|
private static java.util.HashMap<java.lang.String,DictionaryEntry> |
escapeIDs(java.util.HashMap<java.lang.String,DictionaryEntry> dict)
|
static java.lang.String |
escapeRegexp(java.lang.String s)
|
private static java.util.ArrayList<DictionaryEntry> |
hashToList(java.util.HashMap<java.lang.String,DictionaryEntry> hashMap)
|
static java.sql.PreparedStatement |
initVariantTable(java.sql.Connection conn,
java.lang.String tableName,
boolean clear)
Will create a database table and prepare it for insertion of dictionary entries |
java.util.ArrayList<Pair<java.lang.String>> |
loadExtraSynonyms(java.io.File file)
|
private static java.util.HashMap<java.lang.String,DictionaryEntry> |
loadRegexp(java.io.File file,
boolean includeLineNumbers,
java.util.logging.Logger logger)
|
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GenerateMatchers
public GenerateMatchers()
loadExtraSynonyms
public java.util.ArrayList<Pair<java.lang.String>> loadExtraSynonyms(java.io.File file)
hashToList
private static java.util.ArrayList<DictionaryEntry> hashToList(java.util.HashMap<java.lang.String,DictionaryEntry> hashMap)
initVariantTable
public static java.sql.PreparedStatement initVariantTable(java.sql.Connection conn,
java.lang.String tableName,
boolean clear)
- Will create a database table and prepare it for insertion of dictionary entries
- Parameters:
conn
- the established sql connectiontableName
- name of the database tableclear
- whether to create and clear the table first
- Returns:
- a PreParedStatement expecting three arguments: entity id, entity name, tag.
main
public static void main(java.lang.String[] args)
- Parameters:
args
-
convertToVariants
private static void convertToVariants(java.util.HashMap<java.lang.String,DictionaryEntry> dict,
java.io.File file,
java.sql.PreparedStatement pstmt,
int numThreads,
java.util.logging.Logger logger,
int report)
escapeIDs
private static java.util.HashMap<java.lang.String,DictionaryEntry> escapeIDs(java.util.HashMap<java.lang.String,DictionaryEntry> dict)
loadRegexp
private static java.util.HashMap<java.lang.String,DictionaryEntry> loadRegexp(java.io.File file,
boolean includeLineNumbers,
java.util.logging.Logger logger)
escapeRegexp
public static java.lang.String escapeRegexp(java.lang.String s)