org.apache.lucene.analysis.util

Class WordlistLoader

    • Method Detail

      • getWordSet

        public static CharArraySet getWordSet(Reader reader,
                                              CharArraySet result)
                                       throws IOException
        Deprecated. 
        Reads lines from a Reader and adds every line as an entry to a CharArraySet (omitting leading and trailing whitespace). Every line of the Reader should contain only one word. The words need to be in lowercase if you make use of an Analyzer which uses LowerCaseFilter (like StandardAnalyzer).
        Parameters:
        reader - Reader containing the wordlist
        result - the CharArraySet to fill with the readers words
        Returns:
        the given CharArraySet with the reader's words
        Throws:
        IOException
      • getWordSet

        public static CharArraySet getWordSet(Reader reader)
                                       throws IOException
        Deprecated. 
        Reads lines from a Reader and adds every line as an entry to a CharArraySet (omitting leading and trailing whitespace). Every line of the Reader should contain only one word. The words need to be in lowercase if you make use of an Analyzer which uses LowerCaseFilter (like StandardAnalyzer).
        Parameters:
        reader - Reader containing the wordlist
        Returns:
        A CharArraySet with the reader's words
        Throws:
        IOException
      • getWordSet

        public static CharArraySet getWordSet(Reader reader,
                                              String comment)
                                       throws IOException
        Deprecated. 
        Reads lines from a Reader and adds every non-comment line as an entry to a CharArraySet (omitting leading and trailing whitespace). Every line of the Reader should contain only one word. The words need to be in lowercase if you make use of an Analyzer which uses LowerCaseFilter (like StandardAnalyzer).
        Parameters:
        reader - Reader containing the wordlist
        comment - The string representing a comment.
        Returns:
        A CharArraySet with the reader's words
        Throws:
        IOException
      • getWordSet

        public static CharArraySet getWordSet(Reader reader,
                                              String comment,
                                              CharArraySet result)
                                       throws IOException
        Deprecated. 
        Reads lines from a Reader and adds every non-comment line as an entry to a CharArraySet (omitting leading and trailing whitespace). Every line of the Reader should contain only one word. The words need to be in lowercase if you make use of an Analyzer which uses LowerCaseFilter (like StandardAnalyzer).
        Parameters:
        reader - Reader containing the wordlist
        comment - The string representing a comment.
        result - the CharArraySet to fill with the readers words
        Returns:
        the given CharArraySet with the reader's words
        Throws:
        IOException
      • getSnowballWordSet

        public static CharArraySet getSnowballWordSet(Reader reader,
                                                      CharArraySet result)
                                               throws IOException
        Deprecated. 
        Reads stopwords from a stopword list in Snowball format.

        The snowball format is the following:

        • Lines may contain multiple words separated by whitespace.
        • The comment character is the vertical line (|).
        • Lines may contain trailing comments.
        Parameters:
        reader - Reader containing a Snowball stopword list
        result - the CharArraySet to fill with the readers words
        Returns:
        the given CharArraySet with the reader's words
        Throws:
        IOException
      • getSnowballWordSet

        public static CharArraySet getSnowballWordSet(Reader reader)
                                               throws IOException
        Deprecated. 
        Reads stopwords from a stopword list in Snowball format.

        The snowball format is the following:

        • Lines may contain multiple words separated by whitespace.
        • The comment character is the vertical line (|).
        • Lines may contain trailing comments.
        Parameters:
        reader - Reader containing a Snowball stopword list
        Returns:
        A CharArraySet with the reader's words
        Throws:
        IOException
      • getLines

        public static List<StringgetLines(InputStream stream,
                                            Charset charset)
                                     throws IOException
        Deprecated. 
        Accesses a resource by name and returns the (non comment) lines containing data using the given character encoding.

        A comment line is any line that starts with the character "#"

        Returns:
        a list of non-blank non-comment lines with whitespace trimmed
        Throws:
        IOException - If there is a low-level I/O error.