edu.umn.cs.nlp.parser
Class PRuleDatabase<Rule extends Scorable>
java.lang.Object
edu.umn.cs.nlp.parser.PRuleDatabase<Rule>
public class PRuleDatabase<Rule extends Scorable>
- extends Object
Wrapper class for a Berkeley DB database consisting of probabilistic grammar rules.
- Version:
- $LastChangedDate: 2007-11-26 10:42:44 -0600 (Mon, 26 Nov 2007) $
- Author:
- Lane Schwartz
PRuleDatabase
public PRuleDatabase(String databaseFile,
String environmentDirectory,
String encoding,
boolean allowDuplicates,
TupleBinding binding)
PRuleDatabase
public PRuleDatabase(String databaseFile,
String environmentDirectory,
String encoding,
boolean allowDuplicates,
TupleBinding binding,
int kbestListSize)
isOpen
public boolean isOpen()
close
public void close()
put
public void put(String key,
Rule value)
get
public Rule get(String key)
getAll
public List<Rule> getAll(String key)
getNBest
public NBestList<Rule> getNBest(String key)
getAll
public Collection<Pair<Rule,String>> getAll()
toString
public String toString()
- Returns a string representation of the grammar,
with one line per rule.
WARNING: This method involves creating a Collection that contains every rule in the database.
If the rule database is large,
calling this method will use very large amounts of memory.
- Overrides:
toString
in class Object
incompleteMatchExists
public boolean incompleteMatchExists(String key)
main
public static void main(String[] args)