Class StopwordAnalyzerBase

    • Field Detail

      • stopwords

        protected final CharArraySet stopwords
        An immutable stopword set
    • Constructor Detail

      • StopwordAnalyzerBase

        protected StopwordAnalyzerBase​(CharArraySet stopwords)
        Creates a new instance initialized with the given stopword set
        Parameters:
        stopwords - the analyzer's stopword set
      • StopwordAnalyzerBase

        protected StopwordAnalyzerBase()
        Creates a new Analyzer with an empty stopword set
    • Method Detail

      • getStopwordSet

        public CharArraySet getStopwordSet()
        Returns the analyzer's stopword set or an empty set if the analyzer has no stopwords
        Returns:
        the analyzer's stopword set or an empty set if the analyzer has no stopwords
      • loadStopwordSet

        @Deprecated(forRemoval=true,
                    since="9.1")
        protected static CharArraySet loadStopwordSet​(boolean ignoreCase,
                                                      java.lang.Class<? extends Analyzer> aClass,
                                                      java.lang.String resource,
                                                      java.lang.String comment)
                                               throws java.io.IOException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Class.getResourceAsStream(String) is caller sensitive and cannot load resources across Java Modules. Please call the getResourceAsStream() and WordlistLoader.getWordSet(Reader, String, CharArraySet) or other methods directly.
        Creates a CharArraySet from a file resource associated with a class. (See Class.getResourceAsStream(String)).
        Parameters:
        ignoreCase - true if the set should ignore the case of the stopwords, otherwise false
        aClass - a class that is associated with the given stopwordResource
        resource - name of the resource file associated with the given class
        comment - comment string to ignore in the stopword file
        Returns:
        a CharArraySet containing the distinct stopwords from the given file
        Throws:
        java.io.IOException - if loading the stopwords throws an IOException
      • loadStopwordSet

        protected static CharArraySet loadStopwordSet​(java.nio.file.Path stopwords)
                                               throws java.io.IOException
        Creates a CharArraySet from a path.
        Parameters:
        stopwords - the stopwords file to load
        Returns:
        a CharArraySet containing the distinct stopwords from the given file
        Throws:
        java.io.IOException - if loading the stopwords throws an IOException
      • loadStopwordSet

        protected static CharArraySet loadStopwordSet​(java.io.Reader stopwords)
                                               throws java.io.IOException
        Creates a CharArraySet from a file.
        Parameters:
        stopwords - the stopwords reader to load
        Returns:
        a CharArraySet containing the distinct stopwords from the given reader
        Throws:
        java.io.IOException - if loading the stopwords throws an IOException