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:59 UTC
[incubator-nlpcraft] 16/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 a86228a466185fcd358e67ef9507772f6073bc4c
Author: Sergey Kamov <sk...@gmail.com>
AuthorDate: Tue Mar 9 16:24:23 2021 +0300
WIP.
---
.../nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
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 a761936..9227859 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
@@ -28,7 +28,7 @@ import java.io.{Serializable ⇒ JSerializable}
import java.util
import java.util.{List ⇒ JList}
import scala.collection.JavaConverters.{asScalaBufferConverter, _}
-import scala.collection.{Map, Seq, Set, mutable}
+import scala.collection.{Map, Seq, mutable}
import scala.language.implicitConversions
/**
@@ -672,14 +672,14 @@ object NCSentenceManager extends NCService {
addDeleted(sen, sen, swallowed)
swallowed.foreach(sen.removeNote)
- val toksByIdx =
- delCombs.flatMap(note ⇒ note.wordIndexes.map(_ → note)).
- groupBy { case (idx, _) ⇒ idx }.
- map { case (_, seq) ⇒ seq.map { case (_, note) ⇒ note }.toSet }.
- toSeq.sortBy(-_.size)
-
var sens =
if (delCombs.nonEmpty) {
+ val toksByIdx =
+ delCombs.flatMap(note ⇒ note.wordIndexes.map(_ → note)).
+ groupBy { case (idx, _) ⇒ idx }.
+ map { case (_, seq) ⇒ seq.map { case (_, note) ⇒ note }.toSet }.
+ toSeq.sortBy(-_.size)
+
val sens =
NCComboHelper.findCombinations(toksByIdx.map(_.asJava).asJava, pool).asScala.map(_.asScala).
flatMap(delComb ⇒ {