Package edu.berkeley.nlp.lm
Class WordIndexer.StaticMethods
java.lang.Object
edu.berkeley.nlp.lm.WordIndexer.StaticMethods
- Enclosing interface:
WordIndexer<W>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <W> int[]toArray(WordIndexer<W> wordIndexer, List<W> list) Converts an object representation to an int array.static <W> int[]toArrayFromStrings(WordIndexer<W> wordIndexer, List<String> list) Converts an string representation to an int array, adding to the indexer.static <W> List<W> toList(WordIndexer<W> wordIndexer, int[] intNgram) static <W> List<W> toList(WordIndexer<W> wordIndexer, int[] intNgram, int startPos, int endPos) Converts an int representation of an n-gram to a list.
-
Constructor Details
-
StaticMethods
public StaticMethods()
-
-
Method Details
-
toArray
Converts an object representation to an int array. Does not add to the indexer.- Type Parameters:
W-- Parameters:
wordIndexer-list-- Returns:
-
toArrayFromStrings
Converts an string representation to an int array, adding to the indexer.- Type Parameters:
W-- Parameters:
wordIndexer-list-- Returns:
-
toList
public static <W> List<W> toList(WordIndexer<W> wordIndexer, int[] intNgram, int startPos, int endPos) Converts an int representation of an n-gram to a list. Converts only the range of the array specified by [startPos,endPos)- Type Parameters:
W-- Parameters:
wordIndexer-intNgram-startPos-endPos-- Returns:
-
toList
-