|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umn.cs.nlp.mt.LexicalTranslationProbabilityDistribution
public class LexicalTranslationProbabilityDistribution
Lexical translation probability distribution, stored as a Berkeley DB JE database.
This class works only with regular probabilities, not with log probabibilities.
Constructor Summary | |
---|---|
LexicalTranslationProbabilityDistribution(Scanner sourceToTargetFile,
Scanner targetToSourceFile,
String dbDirectoryName,
String dbEncoding)
Construct a LexicalTranslationProbabilityDistribution by reading word pair count data from source-to-target word pair count data and target-to-source word pair count data. |
|
LexicalTranslationProbabilityDistribution(String dbDirectoryName,
String dbEncoding)
Construct a LexicalTranslationProbabilityDistribution by opening an existing Berkeley DB JE database which already contains the lexical translation probability distribution data. |
Method Summary | |
---|---|
void |
close()
Close the underlying database. |
boolean |
delete()
Delete the database directory backing this object. |
static void |
main(String[] args)
Sample code for querying a lexprob database |
double |
sourceGivenTarget(String sourceWord,
String targetWord)
Look up the lexical translation probability of a source language word given a target language word. |
double |
targetGivenSource(String targetWord,
String sourceWord)
Look up the lexical translation probability of a target language word given a source language word. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LexicalTranslationProbabilityDistribution(String dbDirectoryName, String dbEncoding) throws FileNotFoundException
dbDirectoryName
- location of the databasedbEncoding
- text encoding used by the database
FileNotFoundException
public LexicalTranslationProbabilityDistribution(Scanner sourceToTargetFile, Scanner targetToSourceFile, String dbDirectoryName, String dbEncoding)
The constructor calculates the lexical translation probability distributions specified by the word pair count data, and stores the lexical translation probability distributions in a new Berkeley DB JE database stored in the specified directory.
sourceToTargetFile
- source-to-target word pair countstargetToSourceFile
- target-to-source word pair countsdbDirectoryName
- location where the database will be createddbEncoding
- text encoding to be used by the databaseMethod 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 sourceGivenTarget(String sourceWord, String targetWord)
sourceWord
- the source language wordtargetWord
- the target language word
public double targetGivenSource(String targetWord, String sourceWord)
targetWord
- the target language wordsourceWord
- the source language word
public boolean delete()
true
if the backing directory was deleted, false
otherwisepublic static void main(String[] args)
args
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |