edu.berkeley.nlp.lm.io
Class ArpaLmReader<W>
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
ArpaLmReader
public ArpaLmReader(String file,
WordIndexer<W> wordIndexer,
int maxNgramOrder)
- Parameters:
reader
-
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)