|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umn.cs.nlp.NGramDB
public class NGramDB
NGram log probabilities distribution, stored as a Berkeley DB JE database.
Field Summary | |
---|---|
static String |
ngramsDatabaseName
|
Constructor Summary | |
---|---|
NGramDB(Scanner scanner,
String dbDirectoryName,
String dbEncoding)
Construct an object from ARPA backoff N-gram model file |
|
NGramDB(String dbDirectoryName,
String dbEncoding)
Construct an NGramLogProbabilities object by opening an existing Berkeley DB JE database which already contains the ngram data. |
Method Summary | |
---|---|
void |
close()
Close the underlying database. |
double |
get(String key)
Get the language model probability for a given String. |
int |
getNGramCount(int order)
|
static void |
main(String[] args)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ngramsDatabaseName
Constructor Detail |
---|
public NGramDB(Scanner scanner, String dbDirectoryName, String dbEncoding)
scanner
- configured to read an ARPA backoff N-gram model filedbDirectoryName
- location where the database will be createddbEncoding
- text encoding to be used by the databasepublic NGramDB(String dbDirectoryName, String dbEncoding) throws FileNotFoundException
dbDirectoryName
- location of the databasedbEncoding
- text encoding used by the database
FileNotFoundException
Method Detail |
---|
public void close()
This method must be called in order to cleanly close the underlying database. If this method is not called, there is significant risk of corrupting the underlying database.
public double get(String key)
LanguageModel
get
in interface LanguageModel
key
- string to look up
public int getNGramCount(int order)
public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |