public class StringToNumberMapping
extends java.lang.Object
WordNumberAnnotator| Modifier and Type | Field and Description |
|---|---|
protected bak.pcj.map.ObjectKeyIntMap |
map
maps word --> count
|
protected int |
nextNumber
next free number for a word
|
| Constructor and Description |
|---|
StringToNumberMapping() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearMap()
clears all mappings
|
void |
load(java.lang.String fileName,
java.lang.String encoding,
boolean frequencyFormat)
clears and then populates the wordnumbers using the given file.
|
int |
stringToNumber(java.lang.String s)
maps the given String s to a wordnumber.
|
protected bak.pcj.map.ObjectKeyIntMap map
protected int nextNumber
public void clearMap()
public int stringToNumber(java.lang.String s)
s - word to generate wordnumber forpublic void load(java.lang.String fileName,
java.lang.String encoding,
boolean frequencyFormat)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException,
java.util.InputMismatchException
WncConsumerfileName - name of the file to loadencoding - character encoding of the filefrequencyFormat - use second column of multicolumn input?java.io.FileNotFoundException - thrown if the given file can not be foundjava.io.UnsupportedEncodingException - thrown if the given character encoding is not supportedjava.util.InputMismatchException - throw in case the multicolumn format is not used correctly2005-2013 Marco Büchler, Natural Language Processing Group, University of Leipzig, Germany. 2013-2016 Marco Büchler, Georg August University Göttingen, Göttingen, Germany