This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-520
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-520 by this push:
new 333145ec WIP.
333145ec is described below
commit 333145ec85769e37fd6b2e40d355493dccc8472b
Author: Sergey Kamov <[email protected]>
AuthorDate: Fri Dec 16 16:27:18 2022 +0400
WIP.
---
.../org/apache/nlpcraft/nlp/enrichers/NCDictionaryTokenEnricher.scala | 2 +-
.../apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCDictionaryTokenEnricher.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCDictionaryTokenEnricher.scala
index 697fcbe1..c0155e45 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCDictionaryTokenEnricher.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCDictionaryTokenEnricher.scala
@@ -42,7 +42,7 @@ class NCDictionaryTokenEnricher(dictRes: String) extends
NCTokenEnricher:
init()
private def init(): Unit = dict = NCUtils.readResource(dictRes).toSet
- private def getLemma(t: NCToken): String = t.get("lemma").getOrElse(throw
new NCException("Lemma not found in token."))
+ private def getLemma(t: NCToken): String = t.get("lemma").getOrElse(throw
new NCException("'lemma' property not found in token."))
/** @inheritdoc */
override def enrich(req: NCRequest, cfg: NCModelConfig, toks:
List[NCToken]): Unit =
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala
index 25dba557..fc63db37 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala
@@ -101,8 +101,8 @@ private object NCEnStopWordsTokenEnricher extends
LazyLogging:
)
private def read(path: String): Set[String] =
NCUtils.readTextGzipResource(path, "UTF-8", logger).toSet
- private def getPos(t: NCToken): String = t.get("pos").getOrElse(throw new
NCException(s"POS not found in token: ${t.keysSet}"))
- private def getLemma(t: NCToken): String = t.get("lemma").getOrElse(throw
new NCException(s"Lemma not found in token: ${t.keysSet}"))
+ private def getPos(t: NCToken): String = t.get("pos").getOrElse(throw new
NCException(s"'pos' property not found in token: ${t.keysSet}"))
+ private def getLemma(t: NCToken): String = t.get("lemma").getOrElse(throw
new NCException(s"'lemma' property not found in token: ${t.keysSet}"))
private def isQuote(t: NCToken): Boolean = Q_POS.contains(getPos(t))
private def toLemmaKey(toks: Seq[NCToken]): String =
toks.map(getLemma).mkString(" ")
private def toOriginalKey(toks: Seq[NCToken]): String =
toks.map(_.getText).mkString(" ")