You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2021/03/10 00:37:56 UTC

[incubator-nlpcraft] 13/17: WIP.

This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a commit to branch NLPCRAFT-261
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit cfec2efc84c7aafee8496b00563de832ed4e4626
Author: Sergey Kamov <sk...@gmail.com>
AuthorDate: Tue Mar 9 15:28:32 2021 +0300

    WIP.
---
 .../apache/nlpcraft/probe/mgrs/sentence/NCComboHelper.java    | 11 +++--------
 .../nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala      |  2 +-
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCComboHelper.java b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCComboHelper.java
index feced48..6417b4d 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCComboHelper.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCComboHelper.java
@@ -189,13 +189,8 @@ class NCComboHelper extends RecursiveTask<List<Long>> {
         int[] wordCounts = words.stream().sorted(Comparator.comparingInt(Set::size)).mapToInt(Set::size).toArray();
 
         // Prepare Fork/Join task to iterate over the power set of all combinations.
-        return pool.invoke(
-            new NCComboHelper(
-                words.stream().mapToInt(Set::size).max().orElseThrow() - 1,
-                (long)Math.pow(2, dict.size()),
-                wordBits,
-                wordCounts
-            )
-        ).stream().map(bits -> bitsToWords(bits, dict)).collect(toList());
+        return
+            pool.invoke(new NCComboHelper(0, (long)Math.pow(2, dict.size()), wordBits, wordCounts)).
+                stream().map(bits -> bitsToWords(bits, dict)).collect(toList());
     }
 }
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 202828e..a761936 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
@@ -672,7 +672,7 @@ object NCSentenceManager extends NCService {
         addDeleted(sen, sen, swallowed)
         swallowed.foreach(sen.removeNote)
 
-        val toksByIdx: Seq[Set[NCNlpSentenceNote]] =
+        val toksByIdx =
             delCombs.flatMap(note ⇒ note.wordIndexes.map(_ → note)).
                 groupBy { case (idx, _) ⇒ idx }.
                 map { case (_, seq) ⇒ seq.map { case (_, note) ⇒ note }.toSet }.