Package edu.berkeley.nlp.lm
Class WordIndexer.StaticMethods
- java.lang.Object
-
- edu.berkeley.nlp.lm.WordIndexer.StaticMethods
-
- Enclosing interface:
- WordIndexer<W>
public static class WordIndexer.StaticMethods extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description StaticMethods()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <W> int[]toArray(WordIndexer<W> wordIndexer, java.util.List<W> list)Converts an object representation to an int array.static <W> int[]toArrayFromStrings(WordIndexer<W> wordIndexer, java.util.List<java.lang.String> list)Converts an string representation to an int array, adding to the indexer.static <W> java.util.List<W>toList(WordIndexer<W> wordIndexer, int[] intNgram)static <W> java.util.List<W>toList(WordIndexer<W> wordIndexer, int[] intNgram, int startPos, int endPos)Converts an int representation of an n-gram to a list.
-
-
-
Method Detail
-
toArray
public static <W> int[] toArray(WordIndexer<W> wordIndexer, java.util.List<W> list)
Converts an object representation to an int array. Does not add to the indexer.- Type Parameters:
W-- Parameters:
wordIndexer-list-- Returns:
-
toArrayFromStrings
public static <W> int[] toArrayFromStrings(WordIndexer<W> wordIndexer, java.util.List<java.lang.String> list)
Converts an string representation to an int array, adding to the indexer.- Type Parameters:
W-- Parameters:
wordIndexer-list-- Returns:
-
toList
public static <W> java.util.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
public static <W> java.util.List<W> toList(WordIndexer<W> wordIndexer, int[] intNgram)
-
-