summaryrefslogtreecommitdiffstats
path: root/opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/OpenNlpLinguistics.java
diff options
context:
space:
mode:
Diffstat (limited to 'opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/OpenNlpLinguistics.java')
-rw-r--r--opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/OpenNlpLinguistics.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/OpenNlpLinguistics.java b/opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/OpenNlpLinguistics.java
new file mode 100644
index 00000000000..1d96d8a0cdf
--- /dev/null
+++ b/opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/OpenNlpLinguistics.java
@@ -0,0 +1,36 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.language.opennlp;
+
+import com.yahoo.component.annotation.Inject;
+import com.yahoo.language.Linguistics;
+import com.yahoo.language.detect.Detector;
+import com.yahoo.language.process.Tokenizer;
+import com.yahoo.language.simple.SimpleLinguistics;
+
+/**
+ * Returns a linguistics implementation based on OpenNlp.
+ *
+ * @author bratseth
+ * @author jonmv
+ */
+public class OpenNlpLinguistics extends SimpleLinguistics {
+
+ private final Detector detector;
+
+ @Inject
+ public OpenNlpLinguistics() {
+ this.detector = new OpenNlpDetector();
+ }
+
+ @Override
+ public Tokenizer getTokenizer() {
+ return new OpenNlpTokenizer(getNormalizer(), getTransformer());
+ }
+
+ @Override
+ public Detector getDetector() { return detector; }
+
+ @Override
+ public boolean equals(Linguistics other) { return (other instanceof OpenNlpLinguistics); }
+
+}