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 7a5ccd2 WIP.
7a5ccd2 is described below
commit 7a5ccd247ed24cf8538e934a211c426bfe2a3871
Author: Sergey Kamov <[email protected]>
AuthorDate: Fri Sep 24 11:02:24 2021 +0300
WIP.
---
.../org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala
index c8ef9ce..255e086 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala
@@ -30,10 +30,10 @@ import
scala.jdk.CollectionConverters.{CollectionHasAsScala, SeqHasAsJava}
/**
* Sentence token note is a typed map of KV pairs.
*/
-class NCNlpSentenceNote(private val values: mutable.HashMap[String,
JSerializable]) extends JSerializable with NCAsciiLike {
+class NCNlpSentenceNote(private val values: Map[String, JSerializable])
extends JSerializable with NCAsciiLike {
import NCNlpSentenceNote._
- private lazy val dataWithoutIndexes = this.filter(p =>
!SKIP_CLONE.contains(p._1)).toMap
+ private lazy val dataWithoutIndexes = this.filter(p =>
!SKIP_CLONE.contains(p._1))
private lazy val skipNlp = dataWithoutIndexes.filter { case (key, _) =>
key != "noteType" }
@@ -80,7 +80,7 @@ class NCNlpSentenceNote(private val values:
mutable.HashMap[String, JSerializabl
dataWithoutIndexes ++ params.toMap
)
- override def clone(): NCNlpSentenceNote = new
NCNlpSentenceNote(values.clone())
+ override def clone(): NCNlpSentenceNote = new NCNlpSentenceNote(values)
/**
*
@@ -124,7 +124,7 @@ class NCNlpSentenceNote(private val values:
mutable.HashMap[String, JSerializabl
* @param kvs
*/
def clone(kvs : (String, JSerializable)*): NCNlpSentenceNote =
- new NCNlpSentenceNote(mutable.HashMap.empty[String, JSerializable] ++
values ++ kvs)
+ new NCNlpSentenceNote(values ++ kvs)
/**
*
@@ -181,7 +181,7 @@ object NCNlpSentenceNote {
/**
* To immutable map.
*/
- implicit def values(note: NCNlpSentenceNote): mutable.HashMap[String,
JSerializable] = note.values
+ implicit def values(note: NCNlpSentenceNote): Map[String, JSerializable] =
note.values
/**
* Creates new note with given parameters.
@@ -203,7 +203,6 @@ object NCNlpSentenceNote {
val (sparsity, tokMinIndex, tokMaxIndex, tokWordIndexes, len) =
calc(wordIndexesOpt.getOrElse(indexes))
new NCNlpSentenceNote(
- mutable.HashMap.empty[String, JSerializable] ++
params.filter(_._2 != null).map(p => p._1 ->
p._2.asInstanceOf[JSerializable]) ++
Map[String, JSerializable](
"noteType" -> typ,