-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-15064][ML] Locale support in StopWordsRemover #12968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,7 @@ class StopWordsRemover(override val uid: String) | |
| /** | ||
| * Locale for doing a case sensitive comparison | ||
| * Default: English locale ("en") | ||
| * @see [[http://www.localeplanet.com/java/]] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please link to the official Java doc: https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html or the |
||
| * @group param | ||
| */ | ||
| val locale: Param[String] = new Param[String](this, "locale", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, shouldn't all this perhaps be linked to the stopwords set? if you loaded the French stopwords you'd want the French locale always?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but, How can we know that users loaded the French stopwords? User can load stopwords by
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For supported languages, we can know the appropriate locale and maintain an internal mapping. So "french" is known to map to |
||
|
|
@@ -126,7 +127,7 @@ class StopWordsRemover(override val uid: String) | |
| object StopWordsRemover extends DefaultParamsReadable[StopWordsRemover] { | ||
|
|
||
| private[feature] | ||
| def loadLocale(value : String) = new Locale(value) | ||
| def loadLocale(value : String): java.util.Locale = new Locale(value) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just |
||
| val supportedLanguages = Set("danish", "dutch", "english", "finnish", "french", "german", | ||
| "hungarian", "italian", "norwegian", "portuguese", "russian", "spanish", "swedish", "turkish") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we list what're the available options, or provide some reference here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's done