This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-443
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-443 by this push:
new e8b2bfa WIP.
e8b2bfa is described below
commit e8b2bfae73f6ee43e6c645efe68d56aab18d7136
Author: Sergey Kamov <[email protected]>
AuthorDate: Sat Sep 25 21:09:38 2021 +0300
WIP.
---
.../src/main/scala/org/apache/nlpcraft/model/NCElement.java | 2 +-
.../main/scala/org/apache/nlpcraft/model/NCModelView.java | 4 ++--
.../apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala | 2 +-
.../probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala | 5 +++++
.../nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala | 13 +++----------
.../server/nlp/enrichers/NCServerEnrichmentManager.scala | 1 +
.../apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala | 2 +-
7 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCElement.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCElement.java
index b5b6cbd..02f06ea 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCElement.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCElement.java
@@ -383,7 +383,7 @@ public interface NCElement extends NCMetadata, Serializable
{
return Optional.empty();
}
- // TODO:
+ // TODO: add javadoc
default Optional<Boolean> isGreedy() {
return Optional.empty();
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
index 19046d8..2d06412 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
@@ -278,7 +278,7 @@ public interface NCModelView extends NCMetadata {
*/
boolean DFLT_IS_NO_USER_TOKENS_ALLOWED = true;
- // TODO:
+ // TODO: add javadoc
boolean DFLT_IS_STOPWORDS_ALLOWED = true;
/**
@@ -1240,7 +1240,7 @@ public interface NCModelView extends NCMetadata {
}
/**
- * TODO:
+ * // TODO: add javadoc
* @return
*/
default boolean isStopWordsAllowed() {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
index 5b40b69..332dd26 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
@@ -1665,7 +1665,7 @@ object NCDeployManager extends NCService {
(if (expectedJson) MAPPER_JSON else
MAPPER_YAML).readValue(body, classOf[NCElementJson])
catch {
case e: Exception =>
- // TODO:
+ // TODO: fix text
throw new NCE(s"Error parsing element[" +
s"modelId=${mdl.getId}, " +
s"definitionClass=${claxx.getName}, " +
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
index 68cecc2..69c85d3 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
@@ -306,6 +306,11 @@ object NCModelEnricher extends NCProbeEnricher {
flatMap(w => ns.filter(t =>
t.wordIndexes.intersect(w.wordIndexes).nonEmpty))
).sortBy(_.startCharIndex)
+ /**
+ *
+ * @param m
+ * @param id
+ */
private def get(m: Map[String , Seq[Synonym]], id: String): Seq[Synonym] =
m.getOrElse(id, Seq.empty)
/**
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
index 2889394..12c6810 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
@@ -534,7 +534,7 @@ object NCSentenceManager extends NCService {
fixIndexesReferencesList("nlpcraft:sort", "subjindexes",
"subjnotes", ns, histSeq) &&
fixIndexesReferencesList("nlpcraft:sort", "byindexes", "bynotes",
ns, histSeq)
- // On last phase - just for performance reasons.
+ // On last phase - just for performance reasons.
if (res && lastPhase) {
// Validation (all indexes calculated well)
require(
@@ -691,15 +691,8 @@ object NCSentenceManager extends NCService {
map { case (_, seq) => seq.map { case (_, note) =>
note }.toSet }.
toSeq.sortBy(-_.size)
- def findCombinations(): Seq[Seq[NCNlpSentenceNote]] = {
- val x = System.currentTimeMillis()
- println("!findCombinations start = "+toksByIdx.map(_.size)
+ ", all=" + toksByIdx.map(_.size).sum)
- val res =
NCSentenceHelper.findCombinations(toksByIdx.map(_.asJava).asJava,
pool).asScala.map(_.asScala.toSeq)
-
- println("findCombinations=" + (System.currentTimeMillis()
-x))
-
- res
- }
+ def findCombinations(): Seq[Seq[NCNlpSentenceNote]] =
+
NCSentenceHelper.findCombinations(toksByIdx.map(_.asJava).asJava,
pool).asScala.map(_.asScala.toSeq)
val seqSens =
combCache.
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 5d43b7b..df745a0 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
@@ -225,6 +225,7 @@ object NCServerEnrichmentManager extends NCService with
NCIgniteInstance {
.filter(_.contains(hdr.noteName))
.map(note => {
val s = note(hdr.noteName).toString
+
if (isStopWord) s"${r(s)}" else s
})
.toSeq
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala
index 3cc26f1..b51207c 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala
@@ -66,7 +66,7 @@ class NCStopWordsInsideSparseModel extends
NCStopWordsInsideModel {
class NCStopWordsInsideSparseSpec extends NCStopWordsInsideSpec {
@Test
def test2(): Unit = {
- // TODO:
+ // TODO: extend it.
}
}