This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-456
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-456 by this push:
new 8f1a6b6 Code cleanup.
8f1a6b6 is described below
commit 8f1a6b62893fa52501d3c2f4582dbd0215bce53d
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Sep 28 13:31:50 2021 +0300
Code cleanup.
---
.../probe/mgrs/sentence/NCSentenceManager.scala | 20 +++++++++++++-------
1 file changed, 13 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 a90f413..2643630 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
@@ -616,19 +616,25 @@ object NCSentenceManager extends NCService {
}
if (overlappedNotes.nonEmpty) {
- val notesSeqs: Seq[Set[NCNlpSentenceNote]] =
+ val overlappedVars: Seq[Set[NCNlpSentenceNote]] =
overlappedNotes.flatMap(note => note.wordIndexes.map(_ ->
note)).
groupBy { case (idx, _) => idx }.
map { case (_, seq) => seq.map { case (_, note) => note
}.toSet }.
toSeq.
sortBy(-_.size)
- def findCombinations(): Seq[Seq[NCNlpSentenceNote]] =
-
NCSentenceHelper.findCombinations(notesSeqs.map(_.asJava).asJava,
pool).asScala.map(_.asScala.toSeq)
-
- val delCombs: Seq[Seq[NCNlpSentenceNote]] = combCache.
- getOrElseUpdate(sen.srvReqId, mutable.HashMap.empty[CacheKey,
CacheValue]).
- getOrElseUpdate(notesSeqs, findCombinations())
+ val delCombs: Seq[Seq[NCNlpSentenceNote]] =
+ combCache.
+ getOrElseUpdate(
+ sen.srvReqId,
+ mutable.HashMap.empty[CacheKey, CacheValue]
+ ).
+ getOrElseUpdate(
+ overlappedVars,
+ NCSentenceHelper.findCombinations(
+ overlappedVars.map(_.asJava).asJava,
pool).asScala.map(_.asScala.toSeq
+ )
+ )
val seqSens =
delCombs.