Fix for NLPCRAFT-445
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 @@
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 @@
* 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 @@
#
# 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.
#