edu.cmu.minorthird.text.model
Class UnigramModel

java.lang.Object
  extended by edu.cmu.minorthird.text.model.UnigramModel

public class UnigramModel
extends java.lang.Object

Unigram Language Model

Author:
William Cohen

Constructor Summary
UnigramModel()
           
 
Method Summary
 int getFrequency(java.lang.String s)
           
 double getTotalWordCount()
           
 void incrementFrequency(java.lang.String s)
           
 void load(java.io.File file)
          Load a file where each line contains a pair.
static void main(java.lang.String[] args)
           
 void save(java.io.File file)
          Save a unigram model
 double score(Span span)
          Return log Prob(span|model).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnigramModel

public UnigramModel()
Method Detail

load

public void load(java.io.File file)
          throws java.io.IOException,
                 java.io.FileNotFoundException
Load a file where each line contains a pair.

Throws:
java.io.IOException
java.io.FileNotFoundException

save

public void save(java.io.File file)
          throws java.io.IOException
Save a unigram model

Throws:
java.io.IOException

score

public double score(Span span)
Return log Prob(span|model). Assuming indendence, this is sum log Prob(tok_i|model).


getTotalWordCount

public double getTotalWordCount()

getFrequency

public int getFrequency(java.lang.String s)

incrementFrequency

public void incrementFrequency(java.lang.String s)

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException