Class Windows


  • public class Windows
    extends Object
    • 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 from
        windowSize - 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 from
        tokenizerFactory - tokenizer factory to use
        windowSize - 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 from
        windowSize - 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 from
        tokenizerFactory - tokenizer factory to use
        windowSize - 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 from
        tokenizerFactory - 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 use
        wordPos - the position of the word to center
        sentence - the sentence to createComplex a window for
        Returns:
        a window based on the given sentence
      • windows

        public static List<Window> windows​(List<String> words,
                                           int windowSize)
        Constructs a list of window of size windowSize
        Parameters:
        words - the words to construct windows from
        Returns:
        the list of windows for the tokenized string