You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2021/09/16 07:13:06 UTC
[incubator-nlpcraft] branch master updated: Fix for NLPCRAFT-445
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/master by this push:
new eecccbf Fix for NLPCRAFT-445
eecccbf is described below
commit eecccbfa354fa54963332c1e6a0d2d67f2005071
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Thu Sep 16 00:12:58 2021 -0700
Fix for NLPCRAFT-445
---
.../nlp/core/stanford/NCStanfordTokenizer.scala | 21 +++++++++++++++++++++
nlpcraft/src/main/resources/nlpcraft.conf | 2 +-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/nlpcraft-stanford/src/main/scala/org/apache/nlpcraft/common/nlp/core/stanford/NCStanfordTokenizer.scala b/nlpcraft-stanford/src/main/scala/org/apache/nlpcraft/common/nlp/core/stanford/NCStanfordTokenizer.scala
index 256d044..c8da891 100644
--- a/nlpcraft-stanford/src/main/scala/org/apache/nlpcraft/common/nlp/core/stanford/NCStanfordTokenizer.scala
+++ b/nlpcraft-stanford/src/main/scala/org/apache/nlpcraft/common/nlp/core/stanford/NCStanfordTokenizer.scala
@@ -19,6 +19,8 @@ package org.apache.nlpcraft.common.nlp.core.stanford
import java.io.StringReader
import edu.stanford.nlp.process.PTBTokenizer
+import io.opencensus.trace.Span
+import org.apache.nlpcraft.common.NCService
import org.apache.nlpcraft.common.nlp.core.{NCNlpCoreToken, NCNlpTokenizer}
import scala.jdk.CollectionConverters.ListHasAsScala
@@ -27,6 +29,25 @@ import scala.jdk.CollectionConverters.ListHasAsScala
* Stanford tokenizer implementation.
*/
object NCStanfordTokenizer extends NCNlpTokenizer {
+ /**
+ *
+ * @param parent Optional parent span.
+ * @return
+ */
+ override def start(parent: Span = null): NCService = startScopedSpan("start", parent) { _ =>
+ ackStarting()
+ ackStarted()
+ }
+
+ /**
+ *
+ * @param parent Optional parent span.
+ */
+ override def stop(parent: Span = null): Unit = startScopedSpan("stop", parent) { _ =>
+ ackStopping()
+ ackStopped()
+ }
+
override def tokenize(sen: String): Seq[NCNlpCoreToken] = {
PTBTokenizer.newPTBTokenizer(new StringReader(sen)).
tokenize().
diff --git a/nlpcraft/src/main/resources/nlpcraft.conf b/nlpcraft/src/main/resources/nlpcraft.conf
index f301836..9b4b401 100644
--- a/nlpcraft/src/main/resources/nlpcraft.conf
+++ b/nlpcraft/src/main/resources/nlpcraft.conf
@@ -217,7 +217,7 @@ nlpcraft {
#
# NOTE: Stanford CoreNLP requires special installation due to its licensing.
# See https://nlpcraft.apache.org/integrations.html#stanford for more details.
- nlpEngine = "opennlp"
+ nlpEngine = "stanford"
# External configuration resources.
#