[
https://issues.apache.org/jira/browse/OPENNLP-1177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315987#comment-16315987
]
ASF GitHub Bot commented on OPENNLP-1177:
-----------------------------------------
kottmann commented on a change in pull request #301: OPENNLP-1177: Adds way to
get Snowball stemmer by language code.
URL: https://github.com/apache/opennlp/pull/301#discussion_r160104834
##########
File path:
opennlp-tools/src/main/java/opennlp/tools/stemmer/snowball/SnowballStemmer.java
##########
@@ -22,23 +22,42 @@
public class SnowballStemmer implements Stemmer {
public enum ALGORITHM {
- DANISH,
- DUTCH,
- ENGLISH,
- FINNISH,
- FRENCH,
- GERMAN,
- HUNGARIAN,
- IRISH,
- ITALIAN,
- NORWEGIAN,
- PORTER,
- PORTUGUESE,
- ROMANIAN,
- RUSSIAN,
- SPANISH,
- SWEDISH,
- TURKISH
+ DANISH("dan"),
+ DUTCH("nld"),
+ ENGLISH("eng"),
+ FINNISH("fin"),
+ FRENCH("fra"),
+ GERMAN("deu"),
+ HUNGARIAN("hun"),
+ IRISH("gle"),
+ ITALIAN("ita"),
+ NORWEGIAN("nor"),
+ PORTER("porter"),
+ PORTUGUESE("por"),
+ ROMANIAN("ron"),
+ RUSSIAN("rus"),
+ SPANISH("spa"),
+ SWEDISH("swe"),
+ TURKISH("tur");
+
+ private String languageCode;
+
+ private ALGORITHM(String languageCode) {
+ this.languageCode = languageCode;
+ }
+
+ public String getLanguageCode() {
+ return languageCode;
+ }
+
+ public static ALGORITHM getByLanguageCode(String languageCode) {
Review comment:
It has to say by ISO-639-3 language code. Otherwise people might try two
letter codes. Maybe it would be better to pass in here LanguageCode as well.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Add way to get SnowballStemmer implementation by language code
> --------------------------------------------------------------
>
> Key: OPENNLP-1177
> URL: https://issues.apache.org/jira/browse/OPENNLP-1177
> Project: OpenNLP
> Issue Type: Task
> Components: Stemmer
> Reporter: Jeff Zemerick
> Assignee: Jeff Zemerick
> Priority: Minor
>
> The only way to get a Snowball stemmer implementation is using the ALGORITHM
> enum. There is no easy way to get a Snowball stemmer implementation using a
> language code.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)