Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21501#discussion_r193493884
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/feature/StopWordsRemover.scala ---
    @@ -84,7 +86,36 @@ class StopWordsRemover @Since("1.5.0") (@Since("1.5.0") 
override val uid: String
       @Since("1.5.0")
       def getCaseSensitive: Boolean = $(caseSensitive)
     
    -  setDefault(stopWords -> 
StopWordsRemover.loadDefaultStopWords("english"), caseSensitive -> false)
    +  /**
    +   * [[https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html 
Locale]] of the input.
    +   * Ignored when [[caseSensitive]] is false.
    +   * Default: Locale.English
    +   * @see `StopWordsRemover.loadDefaultStopWords()`
    +   * @group param
    +   */
    +  @Since("2.4.0")
    +  val locale: Param[Locale] = new Param[Locale](this, "locale",
    +    "Locale of the input. Ignored when caseSensitive is false.")
    +
    +  /**
    +   * @group setParam
    +   * @throws IllegalArgumentException if `value` is not an available 
locale.
    +   */
    +  @Since("2.4.0")
    +  def setLocale(value: Locale): this.type = {
    +    if (Locale.getAvailableLocales contains value) {
    +      set(locale, value)
    +    } else {
    +      throw new IllegalArgumentException(s"Unsupported locale: $value")
    +    }
    +  }
    +
    +  /** @group getParam */
    +  @Since("2.4.0")
    +  def getLocale: Locale = $(locale)
    +
    +  setDefault(stopWords -> StopWordsRemover.loadDefaultStopWords("english"),
    +    caseSensitive -> false, locale -> Locale.ENGLISH)
    --- End diff --
    
    `Locale.getDefault`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to