public class PatternsForEachTokenDB extends PatternsForEachToken
Modifier and Type | Field and Description |
---|---|
static int |
LARGE_BATCH |
static int |
MEDIUM_BATCH |
static int |
SINGLE_BATCH |
static int |
SMALL_BATCH |
Constructor and Description |
---|
PatternsForEachTokenDB(Properties props) |
PatternsForEachTokenDB(Properties props,
Map<String,Map<Integer,Set<Integer>>> pats) |
Modifier and Type | Method and Description |
---|---|
void |
addPatterns(Map<String,Map<Integer,Set<Integer>>> pats) |
void |
addPatterns(String id,
Map<Integer,Set<Integer>> p) |
void |
close() |
boolean |
containsSentId(String sentId) |
void |
createIndexIfUsingDBAndNotExists() |
void |
createUpsertFunction() |
void |
createUpsertFunctionPatternIndex() |
boolean |
DBTableExists() |
Map<String,Map<Integer,Set<Integer>>> |
getPatternsForAllTokens(Collection<String> sampledSentIds) |
Map<Integer,Set<Integer>> |
getPatternsForAllTokens(String sentId) |
ConcurrentHashIndex<SurfacePattern> |
readPatternIndex(String dir)
Only for Lucene and DB
|
void |
savePatternIndex(ConcurrentHashIndex<SurfacePattern> index,
String file) |
int |
size() |
getPatternsInstance, getStoreWay, updatePatterns
public static final int SINGLE_BATCH
public static final int SMALL_BATCH
public static final int MEDIUM_BATCH
public static final int LARGE_BATCH
public PatternsForEachTokenDB(Properties props, Map<String,Map<Integer,Set<Integer>>> pats)
public PatternsForEachTokenDB(Properties props)
public void addPatterns(Map<String,Map<Integer,Set<Integer>>> pats)
addPatterns
in class PatternsForEachToken
public void addPatterns(String id, Map<Integer,Set<Integer>> p)
addPatterns
in class PatternsForEachToken
public void createUpsertFunction()
public void createUpsertFunctionPatternIndex() throws SQLException
SQLException
public Map<Integer,Set<Integer>> getPatternsForAllTokens(String sentId)
getPatternsForAllTokens
in class PatternsForEachToken
public boolean containsSentId(String sentId)
public void createIndexIfUsingDBAndNotExists()
createIndexIfUsingDBAndNotExists
in class PatternsForEachToken
public boolean DBTableExists()
public ConcurrentHashIndex<SurfacePattern> readPatternIndex(String dir)
PatternsForEachToken
readPatternIndex
in class PatternsForEachToken
public void savePatternIndex(ConcurrentHashIndex<SurfacePattern> index, String file)
savePatternIndex
in class PatternsForEachToken
public Map<String,Map<Integer,Set<Integer>>> getPatternsForAllTokens(Collection<String> sampledSentIds)
getPatternsForAllTokens
in class PatternsForEachToken
public void close()
close
in class PatternsForEachToken
public int size()