edu.berkeley.nlp.lm.io
Class ArpaLmReader<W>

java.lang.Object
  extended by edu.berkeley.nlp.lm.io.ArpaLmReader<W>
All Implemented Interfaces:
LmReader<ProbBackoffPair,ArpaLmReaderCallback<ProbBackoffPair>>

public class ArpaLmReader<W>
extends Object
implements LmReader<ProbBackoffPair,ArpaLmReaderCallback<ProbBackoffPair>>

A parser for ARPA LM files.

Author:
Alex Bouchard-Cote, Adam Pauls

Field Summary
static String END_SYMBOL
           
static String START_SYMBOL
           
static String UNK_SYMBOL
           
 
Constructor Summary
ArpaLmReader(String file, WordIndexer<W> wordIndexer, int maxNgramOrder)
           
 
Method Summary
 void parse(ArpaLmReaderCallback<ProbBackoffPair> callback)
          Parse the ARPA file and populate the relevant fields of the enclosing ICSILanguageModel
protected  List<Long> parseHeader()
           
protected  void parseNGrams(ArpaLmReaderCallback<ProbBackoffPair> callback)
           
protected  String readLine()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START_SYMBOL

public static final String START_SYMBOL
See Also:
Constant Field Values

END_SYMBOL

public static final String END_SYMBOL
See Also:
Constant Field Values

UNK_SYMBOL

public static final String UNK_SYMBOL
See Also:
Constant Field Values
Constructor Detail

ArpaLmReader

public ArpaLmReader(String file,
                    WordIndexer<W> wordIndexer,
                    int maxNgramOrder)
Parameters:
reader -
Method Detail

readLine

protected String readLine()
                   throws IOException
Returns:
Throws:
IOException

parse

public void parse(ArpaLmReaderCallback<ProbBackoffPair> callback)
Parse the ARPA file and populate the relevant fields of the enclosing ICSILanguageModel

Specified by:
parse in interface LmReader<ProbBackoffPair,ArpaLmReaderCallback<ProbBackoffPair>>

parseHeader

protected List<Long> parseHeader()
Parameters:
callback -
Throws:
IOException
ARPAParserException

parseNGrams

protected void parseNGrams(ArpaLmReaderCallback<ProbBackoffPair> callback)