mocobeta commented on code in PR #906:
URL: https://github.com/apache/lucene/pull/906#discussion_r876984088
##########
lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianAnalyzer.java:
##########
@@ -88,30 +88,43 @@ private static class DefaultSetHolder {
}
private final CharArraySet stemExclusionSet;
+ private final boolean useStemming;
/** Builds an analyzer with the default stop words: {@link
#DEFAULT_STOPWORD_FILE}. */
public PersianAnalyzer() {
this(DefaultSetHolder.DEFAULT_STOP_SET);
}
/**
- * Builds an analyzer with the given stop words
+ * Builds an analyzer with the default stop words: {@link
#DEFAULT_STOPWORD_FILE}
+ *
+ * @param useStemming whether or not to enable stemming
+ */
+ public PersianAnalyzer(boolean useStemming) {
+ this(DefaultSetHolder.DEFAULT_STOP_SET, useStemming,
CharArraySet.EMPTY_SET);
+ }
+
+ /**
+ * Builds an analyzer with the given stop words and no stemming
*
* @param stopwords a stopword set
*/
public PersianAnalyzer(CharArraySet stopwords) {
- this(stopwords, CharArraySet.EMPTY_SET);
+ this(stopwords, false, CharArraySet.EMPTY_SET);
}
/**
- * Builds an analyzer with the given stop word. If a none-empty stem
exclusion set is provided
- * this analyzer will add a {@link SetKeywordMarkerFilter} before {@link
PersianStemFilter}.
+ * Builds an analyzer with the given stop word. If a non-empty stem
exclusion set is provided this
+ * analyzer will add a {@link SetKeywordMarkerFilter} before {@link
PersianStemFilter}.
*
* @param stopwords a stopword set
+ * @param useStemming whether or not to enable stemming
* @param stemExclusionSet a set of terms not to be stemmed
*/
- public PersianAnalyzer(CharArraySet stopwords, CharArraySet
stemExclusionSet) {
+ public PersianAnalyzer(
+ CharArraySet stopwords, boolean useStemming, CharArraySet
stemExclusionSet) {
Review Comment:
How about this three-args constructor private and keep the two-args
constructor `public PersianAnalyzer(CharArraySet stopwords, CharArraySet
stemExclusionSet)` so that we make the API changes minimum on the next major
release?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]