Class Windows
- java.lang.Object
-
- org.deeplearning4j.text.movingwindow.Windows
-
public class Windows extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static WindowwindowForWordInPosition(int windowSize, int wordPos, List<String> sentence)Creates a sliding window from textstatic List<Window>windows(InputStream words, int windowSize)Constructs a list of window of size windowSize.static List<Window>windows(InputStream words, TokenizerFactory tokenizerFactory, int windowSize)Constructs a list of window of size windowSize.static List<Window>windows(String words)Constructs a list of window of size windowSize.static List<Window>windows(String words, int windowSize)Constructs a list of window of size windowSize.static List<Window>windows(String words, @NonNull TokenizerFactory tokenizerFactory, int windowSize, WordVectors vectors)Constructs a list of window of size windowSize.static List<Window>windows(String words, TokenizerFactory tokenizerFactory)Constructs a list of window of size windowSize.static List<Window>windows(List<String> words, int windowSize)Constructs a list of window of size windowSize
-
-
-
Method Detail
-
windows
public static List<Window> windows(InputStream words, int windowSize)
Constructs a list of window of size windowSize. Note that padding for each window is created as well.- Parameters:
words- the words to tokenize and construct windows fromwindowSize- the window size to generate- Returns:
- the list of windows for the tokenized string
-
windows
public static List<Window> windows(InputStream words, TokenizerFactory tokenizerFactory, int windowSize)
Constructs a list of window of size windowSize. Note that padding for each window is created as well.- Parameters:
words- the words to tokenize and construct windows fromtokenizerFactory- tokenizer factory to usewindowSize- the window size to generate- Returns:
- the list of windows for the tokenized string
-
windows
public static List<Window> windows(String words, int windowSize)
Constructs a list of window of size windowSize. Note that padding for each window is created as well.- Parameters:
words- the words to tokenize and construct windows fromwindowSize- the window size to generate- Returns:
- the list of windows for the tokenized string
-
windows
public static List<Window> windows(String words, @NonNull @NonNull TokenizerFactory tokenizerFactory, int windowSize, WordVectors vectors)
Constructs a list of window of size windowSize. Note that padding for each window is created as well.- Parameters:
words- the words to tokenize and construct windows fromtokenizerFactory- tokenizer factory to usewindowSize- the window size to generate- Returns:
- the list of windows for the tokenized string
-
windows
public static List<Window> windows(String words)
Constructs a list of window of size windowSize. Note that padding for each window is created as well.- Parameters:
words- the words to tokenize and construct windows from- Returns:
- the list of windows for the tokenized string
-
windows
public static List<Window> windows(String words, TokenizerFactory tokenizerFactory)
Constructs a list of window of size windowSize. Note that padding for each window is created as well.- Parameters:
words- the words to tokenize and construct windows fromtokenizerFactory- tokenizer factory to use- Returns:
- the list of windows for the tokenized string
-
windowForWordInPosition
public static Window windowForWordInPosition(int windowSize, int wordPos, List<String> sentence)
Creates a sliding window from text- Parameters:
windowSize- the window size to usewordPos- the position of the word to centersentence- the sentence to createComplex a window for- Returns:
- a window based on the given sentence
-
-