This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch scala-2.13
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/scala-2.13 by this push:
new b764bb2 WIP.
b764bb2 is described below
commit b764bb27c041c8968db44492506f15a8314a1f0e
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Tue May 18 17:00:30 2021 -0700
WIP.
---
.../scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala | 5 +++--
.../org/apache/nlpcraft/common/nlp/numeric/NCNumericManager.scala | 2 +-
.../main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala | 7 +++----
.../apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala | 8 ++++----
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala
index 07f60cb..5b337a3 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala
@@ -19,8 +19,8 @@ package org.apache.nlpcraft.common.nlp
import org.apache.nlpcraft.common.nlp.pos._
-import scala.collection.JavaConverters._
import scala.collection.mutable
+import scala.jdk.CollectionConverters.CollectionHasAsScala
import scala.language.implicitConversions
/**
@@ -41,7 +41,8 @@ case class NCNlpSentenceToken(
def origText: String = getNlpValue[String]("origText")
def words: Int = origText.split(" ").length
def wordLength: Int = getNlpValue[Int]("wordLength").intValue()
- def wordIndexes: Seq[Int] =
getNlpValue[java.util.List[Int]]("wordIndexes").asScala
+ def wordIndexes: Seq[Int] =
getNlpValue[java.util.List[Int]]("wordIndexes").asScala.toSeq
+
def pos: String = getNlpValue[String]("pos")
def posDesc: String = getNlpValue[String]( "posDesc")
def lemma: String = getNlpValue[String]("lemma")
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/numeric/NCNumericManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/numeric/NCNumericManager.scala
index 80f8b8b..8a60a6b 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/numeric/NCNumericManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/numeric/NCNumericManager.scala
@@ -373,7 +373,7 @@ object NCNumericManager extends NCService {
val str = afterNum.map(getter).mkString(" ")
syns.get(str) match {
- case Some(unit) => Some((unit, afterNum))
+ case Some(unit) => Some((unit,
afterNum.toSeq))
case None => None
}
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala
index 4113688..1f6fbf8 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala
@@ -19,7 +19,6 @@ package org.apache.nlpcraft.model.impl
import java.text.SimpleDateFormat
import java.util
-
import com.typesafe.scalalogging.LazyLogging
import org.apache.nlpcraft.common._
import org.apache.nlpcraft.common.ascii._
@@ -28,8 +27,8 @@ import org.apache.nlpcraft.model.NCToken
import org.apache.nlpcraft.model.impl.NCTokenPimp._
import org.apache.nlpcraft.common.ansi.NCAnsi._
-import scala.collection.JavaConverters._
-import scala.collection._
+import scala.collection.mutable.ArrayBuffer
+import scala.jdk.CollectionConverters._
/**
* Utility service that provides supporting functionality for ASCII rendering.
@@ -377,7 +376,7 @@ object NCTokenLogger extends LazyLogging {
def prepareTable(toks: Seq[NCToken]): NCAsciiTable = {
val allFree = toks.forall(_.isFreeWord)
- val headers = mutable.ArrayBuffer.empty[String] ++
+ val headers = ArrayBuffer.empty[String] ++
Seq(
"idx",
"origtext",
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
index c71ee62..52a3af2 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
@@ -30,7 +30,7 @@ import java.time.temporal.IsoFields
import java.time.{LocalDate, LocalTime}
import java.util
import java.util.{Calendar, Collections, Collection => JColl, List => JList,
Map => JMap}
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters.{CollectionHasAsScala, IterableHasAsJava}
trait NCIdlCompilerBase {
type S = NCIdlStack
@@ -740,7 +740,7 @@ trait NCIdlCompilerBase {
if (lst.isEmpty)
throw newRuntimeError(s"Unexpected empty list in IDL
function: $fun()")
else {
- val seq: Seq[Double] = lst.asScala.map(p =>
JDouble.valueOf(p.toString).doubleValue())
+ val seq: Seq[Double] = lst.asScala.map(p =>
JDouble.valueOf(p.toString).doubleValue()).toSeq
Z(seq.sum / seq.length, n)
}
@@ -762,7 +762,7 @@ trait NCIdlCompilerBase {
if (lst.isEmpty)
throw newRuntimeError(s"Unexpected empty list in IDL
function: $fun()")
else {
- val seq: Seq[Double] = lst.asScala.map(p =>
JDouble.valueOf(p.toString).doubleValue())
+ val seq: Seq[Double] = lst.asScala.map(p =>
JDouble.valueOf(p.toString).doubleValue()).toSeq
val mean = seq.sum / seq.length
val stdDev = Math.sqrt(seq.map( _ - mean).map(t => t *
t).sum / seq.length)
@@ -869,7 +869,7 @@ trait NCIdlCompilerBase {
stack.push(() => {
val Z(v, n) = x()
- val jl = toList(v).asScala.distinct.asJava
+ val jl = toList(v).asScala.toSeq.distinct.asJava
Z(jl, n)
})