This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-70_NEW
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-70_NEW by this push:
new 4bc4e81 WIP.
4bc4e81 is described below
commit 4bc4e81d9b8795898d93bb2f9ce54b05245af9b0
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Jul 6 17:15:39 2021 +0300
WIP.
---
.../org/apache/nlpcraft/common/nlp/NCNlpSentence.scala | 4 ++--
.../org/apache/nlpcraft/server/mdo/NCProbeModelMdo.scala | 6 +++---
.../server/nlp/enrichers/NCServerEnrichmentManager.scala | 6 +++---
.../ctxword/NCContextWordCategoriesEnricher.scala | 14 +++++++-------
.../org/apache/nlpcraft/server/probe/NCProbeManager.scala | 4 ++--
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentence.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentence.scala
index 38c6e46..7b5d058 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentence.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentence.scala
@@ -18,7 +18,7 @@
package org.apache.nlpcraft.common.nlp
import org.apache.nlpcraft.common._
-import org.apache.nlpcraft.server.mdo.NCCtxWordConfigMdo
+import org.apache.nlpcraft.server.mdo.NCCtxWordCategoriesConfigMdo
import java.io.{Serializable => JSerializable}
import java.util.{Collections, List => JList}
@@ -52,7 +52,7 @@ class NCNlpSentence(
val srvReqId: String,
val text: String,
val enabledBuiltInToks: Set[String],
- val ctxWordConfig: Option[NCCtxWordConfigMdo] = None,
+ val ctxWordConfig: Option[NCCtxWordCategoriesConfigMdo] = None,
var ctxWordCategories: Map[/** Token index*/Int, Map[/** Elements
ID*/String, /** Confidence*/Double]] = Map.empty,
override val tokens: mutable.ArrayBuffer[NCNlpSentenceToken] = new
mutable.ArrayBuffer[NCNlpSentenceToken](32),
var firstProbePhase: Boolean = true,
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/mdo/NCProbeModelMdo.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/mdo/NCProbeModelMdo.scala
index 93825f8..d330ec7 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/mdo/NCProbeModelMdo.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/mdo/NCProbeModelMdo.scala
@@ -21,12 +21,12 @@ import org.apache.nlpcraft.server.mdo.impl._
@NCMdoEntity(sql = false)
-case class NCCtxWordConfigMdo(
+case class NCCtxWordCategoriesConfigMdo(
@NCMdoField probeId: String,
@NCMdoField modelId: String,
@NCMdoField values: Map[String /*Element ID*/, Map[/*Value*/String,
/*Synonym*/Set[String]]],
@NCMdoField corpus: Set[String],
- @NCMdoField supportedElements: Map[String /*Element ID*/, /*Confidence*/
Double]
+ @NCMdoField elements: Map[String /*Element ID*/, /*Confidence*/ Double]
)
/**
* Probe model MDO.
@@ -37,7 +37,7 @@ case class NCProbeModelMdo(
@NCMdoField name: String,
@NCMdoField version: String,
@NCMdoField enabledBuiltInTokens: Set[String],
- @NCMdoField ctxWordConfig: Option[NCCtxWordConfigMdo]
+ @NCMdoField ctxWordConfig: Option[NCCtxWordCategoriesConfigMdo]
) extends NCAnnotatedMdo[NCProbeModelMdo] {
override def hashCode(): Int = s"$id$name".hashCode()
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/NCServerEnrichmentManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/NCServerEnrichmentManager.scala
index 2eb600e..4094eab 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/NCServerEnrichmentManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/NCServerEnrichmentManager.scala
@@ -26,7 +26,7 @@ import org.apache.nlpcraft.common.pool.NCThreadPoolManager
import org.apache.nlpcraft.common.{NCService, _}
import org.apache.nlpcraft.server.ignite.NCIgniteHelpers._
import org.apache.nlpcraft.server.ignite.NCIgniteInstance
-import org.apache.nlpcraft.server.mdo.NCCtxWordConfigMdo
+import org.apache.nlpcraft.server.mdo.NCCtxWordCategoriesConfigMdo
import org.apache.nlpcraft.server.nlp.core.{NCNlpNerEnricher,
NCNlpServerManager}
import org.apache.nlpcraft.server.nlp.enrichers.basenlp.NCBaseNlpEnricher
import
org.apache.nlpcraft.server.nlp.enrichers.coordinate.NCCoordinatesEnricher
@@ -100,7 +100,7 @@ object NCServerEnrichmentManager extends NCService with
NCIgniteInstance {
srvReqId: String,
normTxt: String,
enabledBuiltInToks: Set[String],
- mlConf: Option[NCCtxWordConfigMdo],
+ mlConf: Option[NCCtxWordCategoriesConfigMdo],
parent: Span = null
): NCNlpSentence =
startScopedSpan("process", parent, "srvReqId" -> srvReqId, "txt" ->
normTxt) { span =>
@@ -149,7 +149,7 @@ object NCServerEnrichmentManager extends NCService with
NCIgniteInstance {
srvReqId: String,
txt: String,
enabledBuiltInToks: Set[String],
- mlConf: Option[NCCtxWordConfigMdo],
+ mlConf: Option[NCCtxWordCategoriesConfigMdo],
parent: Span = null
): NCNlpSentence = {
startScopedSpan("enrichPipeline", parent, "srvReqId" -> srvReqId,
"txt" -> txt) { span =>
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/ctxword/NCContextWordCategoriesEnricher.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/ctxword/NCContextWordCategoriesEnricher.scala
index 25faa45..503e504 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/ctxword/NCContextWordCategoriesEnricher.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/ctxword/NCContextWordCategoriesEnricher.scala
@@ -23,7 +23,7 @@ import
org.apache.nlpcraft.common.nlp.core.NCNlpCoreManager.stem
import org.apache.nlpcraft.common.nlp.pos.NCPennTreebank._
import org.apache.nlpcraft.common.nlp.{NCNlpSentence, NCNlpSentenceToken}
import org.apache.nlpcraft.common.{NCE, NCService}
-import org.apache.nlpcraft.server.mdo.NCCtxWordConfigMdo
+import org.apache.nlpcraft.server.mdo.NCCtxWordCategoriesConfigMdo
import org.apache.nlpcraft.server.nlp.core.{NCNlpParser, NCNlpServerManager,
NCNlpWord}
import org.apache.nlpcraft.server.nlp.enrichers.NCServerEnricher
import org.apache.nlpcraft.server.sugsyn.{NCSuggestSynonymManager,
NCSuggestionRequest, NCWordSuggestion}
@@ -258,7 +258,7 @@ object NCContextWordCategoriesEnricher extends
NCServerEnricher {
* @param key
* @return
*/
- private def getCorpusData(cfg: NCCtxWordConfigMdo, key: ModelProbeKey,
parent: Span = null):
+ private def getCorpusData(cfg: NCCtxWordCategoriesConfigMdo, key:
ModelProbeKey, parent: Span = null):
Map[
/** Element ID */
@@ -283,7 +283,7 @@ object NCContextWordCategoriesEnricher extends
NCServerEnricher {
* @param key
* @return
*/
- private def getValuesData(cfg: NCCtxWordConfigMdo, key: ModelProbeKey):
ValuesHolder =
+ private def getValuesData(cfg: NCCtxWordCategoriesConfigMdo, key:
ModelProbeKey): ValuesHolder =
valuesStems.synchronized {
valuesStems.get(key)
} match {
@@ -338,7 +338,7 @@ object NCContextWordCategoriesEnricher extends
NCServerEnricher {
* @return
*/
@throws[NCE]
- private def askSamples(cfg: NCCtxWordConfigMdo, parent: Span = null): Map[
+ private def askSamples(cfg: NCCtxWordCategoriesConfigMdo, parent: Span =
null): Map[
/** Element ID */
String, ElementData] = {
@@ -531,7 +531,7 @@ object NCContextWordCategoriesEnricher extends
NCServerEnricher {
logger.info(
s"Model loaded [" +
s"key=$key, elements: " +
- s"${cfg.supportedElements.mkString(" ,")},
" +
+ s"${cfg.elements.mkString(" ,")}, " +
s"values data=$vd]"
)
@@ -550,7 +550,7 @@ object NCContextWordCategoriesEnricher extends
NCServerEnricher {
nounTok <- nouns;
(elemId, elemData) <- mdlCorpusData;
confOpt = elemData.get(nounTok.normText,
nounTok.stem, nounTok.lemma)
- if confOpt.isDefined && confOpt.get >=
cfg.supportedElements(elemId)
+ if confOpt.isDefined && confOpt.get >=
cfg.elements(elemId)
)
add(nounTok, elemId, Confidence(confOpt.get))
@@ -597,7 +597,7 @@ object NCContextWordCategoriesEnricher extends
NCServerEnricher {
(sugg, req) <- resps.toSeq.sortBy(_._2.index);
suggConf = normalizeConfidence(sugg.score);
(elemId, elemData) <- mdlCorpusData;
- elemConf = cfg.supportedElements(elemId);
+ elemConf = cfg.elements(elemId);
corpConfOpt =
elemData.get(normCase(sugg.word), stem(sugg.word), getLemma(req, sugg))
if corpConfOpt.isDefined;
corpConf = corpConfOpt.get;
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/probe/NCProbeManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/probe/NCProbeManager.scala
index 265e398..72d28eb 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/probe/NCProbeManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/probe/NCProbeManager.scala
@@ -646,7 +646,7 @@ object NCProbeManager extends NCService {
ctxWordConfig =
if (!values.isEmpty) {
Some(
- NCCtxWordConfigMdo(
+ NCCtxWordCategoriesConfigMdo(
probeId = probeId,
modelId = mdlId,
values =
values.asScala.map {
@@ -657,7 +657,7 @@ object NCProbeManager extends NCService {
}.toMap
}.toMap,
corpus =
corpus.asScala.toSet,
- supportedElements =
supported.asScala.toMap
+ elements =
supported.asScala.toMap
)
)
}