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/05/18 22:06:39 UTC
[incubator-nlpcraft] 02/02: WIP.
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
commit 5053fac2c13ebaca9a08762c739cd9638a70021d
Author: unknown <ar...@datalingvo.com>
AuthorDate: Tue May 18 15:06:29 2021 -0700
WIP.
---
.../main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala | 4 ++--
.../apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala | 4 ++--
.../nlpcraft/server/nlp/enrichers/stopword/NCStopWordGenerator.scala | 2 +-
3 files changed, 5 insertions(+), 5 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 40add5a..cbccae5 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
@@ -40,8 +40,8 @@ class NCNlpSentenceNote(private val values: Map[String, JSerializable]) extends
lazy val noteType: String = values("noteType").asInstanceOf[String]
lazy val tokenFrom: Int = values("tokMinIndex").asInstanceOf[Int] // First index.
lazy val tokenTo: Int = values("tokMaxIndex").asInstanceOf[Int] // Last index.
- lazy val tokenIndexes: Seq[Int] = values("tokWordIndexes").asInstanceOf[java.util.List[Int]].asScala // Includes 1st and last indices too.
- lazy val wordIndexes: Seq[Int] = values("wordIndexes").asInstanceOf[java.util.List[Int]].asScala // Includes 1st and last indices too.
+ lazy val tokenIndexes: Seq[Int] = values("tokWordIndexes").asInstanceOf[java.util.List[Int]].asScala.toSeq // Includes 1st and last indices too.
+ lazy val wordIndexes: Seq[Int] = values("wordIndexes").asInstanceOf[java.util.List[Int]].asScala.toSeq // Includes 1st and last indices too.
lazy val sparsity: Int = values("sparsity").asInstanceOf[Int]
lazy val isDirect: Boolean = values("direct").asInstanceOf[Boolean]
lazy val isUser: Boolean = {
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala
index c47711b..b729d48 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala
@@ -213,7 +213,7 @@ object NCDateEnricher extends NCServerEnricher {
}
}
- buf
+ buf.toSeq
}
def isDash(toks: Seq[Token]): Boolean = {
@@ -358,7 +358,7 @@ object NCDateEnricher extends NCServerEnricher {
process(nnToks)
}
- res.sortBy(h => ns.indexOfSlice(h.tokens))
+ res.sortBy(h => ns.indexOfSlice(h.tokens)).toSeq
}
/**
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/stopword/NCStopWordGenerator.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/stopword/NCStopWordGenerator.scala
index c9fed22..96bef39 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/stopword/NCStopWordGenerator.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/stopword/NCStopWordGenerator.scala
@@ -187,7 +187,7 @@ object NCStopWordGenerator extends App {
"couple of"
)
- private def mkGzip(path: String, lines: Traversable[Any]): Unit = {
+ private def mkGzip(path: String, lines: Iterable[Any]): Unit = {
val p = NCUtils.mkPath(s"nlpcraft/src/main/resources/stopwords/$path")
NCUtils.mkTextFile(p, lines)