public class WordMap extends NGramMap
Constructor and Description |
---|
WordMap()
Default constructor of an empty word map.
|
WordMap(Map<String,Integer> map)
Create a word to frequency map.
|
WordMap(Map<String,Integer> map,
int textSize)
Create a word to frequency map.
|
WordMap(NGramMap map)
Convert a valid NGramMap into a word map.
|
WordMap(WordMap map)
Copy a word to frequency map.
|
Modifier and Type | Method and Description |
---|---|
boolean |
decreaseFreq(String word)
Removes a word from the map or decrease the frequency if the absolute
frequency is greater than one.
|
static TokenDecoder |
getDecoder() |
static TokenEncoder |
getEncoder() |
int |
getFrequency(String word)
Get the absolute frequency of a word in the map.
|
double |
getProbability(String word)
Get the relative frequency of a word in the map.
|
Map<String,Integer> |
getStringMap()
Get a copy of the map that backs this object.
|
List<String> |
getWordList()
Get an ordered list of the words contained in the map.
|
boolean |
increaseFreq(String word)
Adds a word to the map or increases the frequency if it is already present.
|
int |
removeWord(String word)
Removes a word from the map.
|
String |
toString() |
calcOrigTextSize, decreaseFreq, equals, filterByThreshold, filterByTotal, getFrequency, getFrequencyList, getMap, getN, getNGramList, getOrigTextSize, getProbability, getProbabilityList, hashCode, increaseFreq, iterator, removeNGram, setOrigTextSize
public WordMap()
public WordMap(Map<String,Integer> map)
map
- the mappings to usepublic WordMap(Map<String,Integer> map, int textSize)
map
- the mappings to usetextSize
- the number of elements in the original textpublic WordMap(WordMap map)
map
- the word map to copypublic WordMap(NGramMap map)
map
- the n-gram map to convertpublic List<String> getWordList()
public int getFrequency(String word)
word
- the word to get the frequency ofpublic double getProbability(String word)
word
- the word to get the frequency ofpublic boolean increaseFreq(String word)
word
- element to increase the frequency of in the mappublic boolean decreaseFreq(String word)
word
- element to decrease the frequency of in the mappublic int removeWord(String word)
word
- element to remove from the mappublic Map<String,Integer> getStringMap()
public static TokenEncoder getEncoder()
public static TokenDecoder getDecoder()
Copyright © 2021 Actian Corporation. All rights reserved.