Package edu.berkeley.nlp.lm.map
Class NgramMapWrapper<W,V>
- Type Parameters:
W
-V
-
Wraps an NgramMap as a Java Map, with ngrams of all orders mixed together.
This collection is read-only. It is also uses a lot inefficient boxing and
unboxing.
- Author:
- adampauls
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionNgramMapWrapper
(NgramMap<V> map, WordIndexer<W> wordIndexer) NgramMapWrapper
(NgramMap<V> map, WordIndexer<W> wordIndexer, int maxOrder) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Object key) entrySet()
getMapForOrder
(int ngramOrder) long
longSize()
Methods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
NgramMapWrapper
-
NgramMapWrapper
- Parameters:
map
-wordIndexer
-maxOrder
- this is 1-based (i.e. 1 means keep unigrams but not bigrams)
-
-
Method Details
-
get
-
containsKey
- Specified by:
containsKey
in interfaceMap<W,
V> - Overrides:
containsKey
in classAbstractMap<List<W>,
V>
-
entrySet
-
getMapForOrder
- Parameters:
ngramOrder
- 0-based (0 means unigrams)- Returns:
-
longSize
public long longSize()- Returns:
-
getWordIndexer
-
getNgramMap
-