This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-13
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-13 by this push:
new bc8d61e Fixes for NLPCRAFT-22 and NLPCRAFT-26.
bc8d61e is described below
commit bc8d61e2a3c0461234b02937d2fa2829829643e9
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Wed Mar 25 12:00:36 2020 -0700
Fixes for NLPCRAFT-22 and NLPCRAFT-26.
---
docs/data-model.html | 9 +++++++--
.../mgrs/nlp/enrichers/post/NCPostEnrichProcessor.scala | 12 ++++++------
.../probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala | 6 +++---
3 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/docs/data-model.html b/docs/data-model.html
index bebff85..d2e3a56 100644
--- a/docs/data-model.html
+++ b/docs/data-model.html
@@ -2996,9 +2996,14 @@ intents:
</thead>
<tbody>
<tr>
- <td><code><b>nlpcraft:sort:indexes</b></code></td>
+ <td><code><b>nlpcraft:sort:subjindexes</b></code></td>
<td><code>java.util.List<Integer></code></td>
- <td>Index (always only one) of the reference token (i.e. the
token being sorted on).</td>
+ <td>One of more indexes of the target tokens (i.e. the token
that being sorted).</td>
+ </tr>
+ <tr>
+ <td><code><b>nlpcraft:sort:byindexes</b></code></td>
+ <td><code>java.util.List<Integer></code></td>
+ <td>Zero or more (i.e. optional) indexes of the reference
token (i.e. the token being sorted by).</td>
</tr>
<tr>
<td><code><b>nlpcraft:sort:asc</b></code></td>
diff --git
a/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/post/NCPostEnrichProcessor.scala
b/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/post/NCPostEnrichProcessor.scala
index 86ccded..cfeeb7e 100644
---
a/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/post/NCPostEnrichProcessor.scala
+++
b/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/post/NCPostEnrichProcessor.scala
@@ -124,10 +124,10 @@ object NCPostEnrichProcessor extends NCService with
LazyLogging {
(
p.wordIndexes,
p.noteType,
- p.get("subjNotes"),
- p.get("subjIndexes"),
- p.getOrElse("byNotes", null),
- p.getOrElse("byIndexes", null),
+ p.get("subjnotes"),
+ p.get("subjindexes"),
+ p.getOrElse("bynotes", null),
+ p.getOrElse("byindexes", null),
p.getOrElse("asc", null)
)
case "nlpcraft:limit" ⇒
@@ -218,8 +218,8 @@ object NCPostEnrichProcessor extends NCService with
LazyLogging {
val res =
Seq("nlpcraft:relation", "nlpcraft:limit").forall(t ⇒
fixIndexesReferences(t, ns, history)) &&
- fixIndexesReferencesList("nlpcraft:sort", "subjIndexes",
"subjNotes", ns, history) &&
- fixIndexesReferencesList("nlpcraft:sort", "byIndexes", "byNotes",
ns, history)
+ fixIndexesReferencesList("nlpcraft:sort", "subjindexes",
"subjnotes", ns, history) &&
+ fixIndexesReferencesList("nlpcraft:sort", "byindexes", "bynotes",
ns, history)
if (res)
// Validation (all indexes calculated well)
diff --git
a/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala
b/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala
index 5150c9e..a3be897 100644
---
a/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala
+++
b/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala
@@ -333,7 +333,7 @@ object NCSortEnricher extends NCProbeEnricher {
for (toks ← ns.tokenMixWithStopWords() if areSuitableTokens(buf,
toks))
tryToMatch(toks) match {
case Some(m) ⇒
- //for (subj ← m.subjSeq if !hasReferences(TOK_ID,
"subjNotes", subj.map(_.note), m.main)) {
+ //for (subj ← m.subjSeq if !hasReferences(TOK_ID,
"subjnotes", subj.map(_.note), m.main)) {
for (subj ← m.subjSeq) {
def addNotes(
params: ArrayBuffer[(String, Any)],
@@ -353,7 +353,7 @@ object NCSortEnricher extends NCProbeEnricher {
if (m.asc.isDefined)
params += "asc" → m.asc.get
- addNotes(params, subj, "subjNotes",
"subjIndexes")
+ addNotes(params, subj, "subjnotes",
"subjindexes")
}
def mkNote(params: ArrayBuffer[(String, Any)]):
Unit = {
@@ -367,7 +367,7 @@ object NCSortEnricher extends NCProbeEnricher {
if (m.bySeq.nonEmpty)
for (by ← m.bySeq)
- mkNote(addNotes(mkParams(), by, "byNotes",
"byIndexes"))
+ mkNote(addNotes(mkParams(), by, "bynotes",
"byindexes"))
else
mkNote(mkParams())
}