edu.umn.cs.nlp.parser
Class PRuleDatabase<Rule extends Scorable>

java.lang.Object
  extended by 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

Constructor Summary
PRuleDatabase(String databaseFile, String environmentDirectory, String encoding, boolean allowDuplicates, TupleBinding binding)
           
PRuleDatabase(String databaseFile, String environmentDirectory, String encoding, boolean allowDuplicates, TupleBinding binding, int kbestListSize)
           
 
Method Summary
 void close()
           
 Rule get(String key)
           
 Collection<Pair<Rule,String>> getAll()
           
 List<Rule> getAll(String key)
           
 NBestList<Rule> getNBest(String key)
           
 boolean incompleteMatchExists(String key)
           
 boolean isOpen()
           
static void main(String[] args)
           
 void put(String key, Rule value)
           
 String toString()
          Returns a string representation of the grammar, with one line per rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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)
Method Detail

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)