This is an automated email from the ASF dual-hosted git repository. sergeykamov pushed a commit to branch NLPCRAFT-16 in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit c039ec5603fa057386fb509e49731b146d6e6ed4 Author: Sergey Kamov <[email protected]> AuthorDate: Mon Mar 16 23:46:34 2020 +0300 WIP. --- .../mgrs/nlp/enrichers/NCEnricherBaseSpec.scala | 2 +- .../nlp/enrichers/limit/NCEnricherLimitSpec.scala | 6 +- .../nlp/enrichers/sort/NCEnricherSortSpec.scala | 80 ++++++++++++++++++++-- 3 files changed, 78 insertions(+), 10 deletions(-) diff --git a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnricherBaseSpec.scala b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnricherBaseSpec.scala index 0103ae3..f2b1c0e 100644 --- a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnricherBaseSpec.scala +++ b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnricherBaseSpec.scala @@ -69,7 +69,7 @@ class NCEnricherBaseSpec { * @param txt * @param expToks */ - private[enrichers] def checkAll(txt: String, expToks: Seq[Seq[NCTestToken]]): Unit = { + private[enrichers] def checkAll(txt: String, expToks: Seq[NCTestToken]*): Unit = { val res = client.ask(txt) assertTrue(res.isOk, s"Result is not successful, result: $res") diff --git a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/limit/NCEnricherLimitSpec.scala b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/limit/NCEnricherLimitSpec.scala index 16e1fbb..7795bbc 100644 --- a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/limit/NCEnricherLimitSpec.scala +++ b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/limit/NCEnricherLimitSpec.scala @@ -17,7 +17,7 @@ package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.limit -import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.{NCEnricherBaseSpec, NCTestLimitToken ⇒ limit, NCTestUserToken ⇒ user} +import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.{NCEnricherBaseSpec, NCTestLimitToken ⇒ lim, NCTestUserToken ⇒ usr} import org.junit.jupiter.api.Test /** @@ -32,8 +32,8 @@ class NCEnricherLimitSpec extends NCEnricherBaseSpec { def test(): Unit = { checkExists( "top 5 A", - limit(text = "top 5", limit = 5, indexes = Seq(1), note = "A", asc = Some(true)), - user(text = "A", id = "A") + lim(text = "top 5", limit = 5, indexes = Seq(1), note = "A", asc = Some(true)), + usr(text = "A", id = "A") ) } } diff --git a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCEnricherSortSpec.scala b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCEnricherSortSpec.scala index 386e3bf..97b5cae 100644 --- a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCEnricherSortSpec.scala +++ b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCEnricherSortSpec.scala @@ -17,7 +17,7 @@ package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.sort -import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.{NCEnricherBaseSpec, NCTestNlpToken ⇒ nlp, NCTestSortToken ⇒ sort, NCTestUserToken ⇒ user} +import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.{NCEnricherBaseSpec, NCTestNlpToken ⇒ nlp, NCTestSortToken ⇒ srt, NCTestUserToken ⇒ usr} import org.junit.jupiter.api.Test /** @@ -33,15 +33,83 @@ class NCEnricherSortSpec extends NCEnricherBaseSpec { runBatch( _ ⇒ checkExists( "sort A", - sort(text = "sort", subjNote = "A", subjIndex = 1), - user("A", "A") + srt(text = "sort", subjNote = "A", subjIndex = 1), + usr("A", "A") ), _ ⇒ checkExists( "sort A by A", - sort(text = "sort", subjNote = "A", subjIndex = 1, byNote = "A", byIndex = 3), - user(text = "A", id = "A"), + srt(text = "sort", subjNote = "A", subjIndex = 1, byNote = "A", byIndex = 3), + usr(text = "A", id = "A"), nlp(text = "by", isStop = true), - user(text = "A", id = "A") + usr(text = "A", id = "A") + ), + _ ⇒ checkExists( + "sort A, C by A, C", + srt(text = "sort", subjNotes = Seq("A", "C"), subjIndexes = Seq(1, 3), byNotes = Seq("A", "C"), byIndexes = Seq(5, 7)), + usr(text = "A", id = "A"), + nlp(text = ",", isStop = true), + usr(text = "C", id = "C"), + nlp(text = "by", isStop = true), + usr(text = "A", id = "A"), + nlp(text = ",", isStop = true), + usr(text = "C", id = "C") + ), + _ ⇒ checkExists( + "sort A C by A C", + srt(text = "sort", subjNotes = Seq("A", "C"), subjIndexes = Seq(1, 2), byNotes = Seq("A", "C"), byIndexes = Seq(4, 5)), + usr(text = "A", id = "A"), + usr(text = "C", id = "C"), + nlp(text = "by", isStop = true), + usr(text = "A", id = "A"), + usr(text = "C", id = "C") + ), + _ ⇒ checkExists( + "A classify", + usr(text = "A", id = "A"), + srt(text = "classify", subjNote = "A", subjIndex = 0) + ), + _ ⇒ checkExists( + "the A the classify", + nlp(text = "the", isStop = true), + usr(text = "A", id = "A"), + nlp(text = "the", isStop = true), + srt(text = "classify", subjNote = "A", subjIndex = 1) + ), + _ ⇒ checkExists( + "segment A by top down", + srt(text = "segment", subjNote = "A", subjIndex = 1, asc = false), + usr(text = "A", id = "A"), + nlp(text = "by top down", isStop = true) + ), + _ ⇒ checkExists( + "segment A by in bottom up order", + srt(text = "segment", subjNote = "A", subjIndex = 1, asc = true), + usr(text = "A", id = "A"), + nlp(text = "by in bottom up order", isStop = true) + ), + _ ⇒ checkExists( + "the segment the A the by in bottom up the order the", + nlp(text = "the", isStop = true), + srt(text = "segment", subjNote = "A", subjIndex = 3, asc = true), + nlp(text = "the", isStop = true), + usr(text = "A", id = "A"), + nlp(text = "the by in bottom up the order the", isStop = true) + ), + _ ⇒ checkExists( + "A classify", + usr(text = "A", id = "A"), + srt(text = "classify", subjNote = "A", subjIndex = 0) + ), + _ ⇒ checkAll( + "D classify", + Seq( + usr(text = "D", id = "D1"), + srt(text = "classify", subjNote = "D1", subjIndex = 0) + ), + Seq( + usr(text = "D", id = "D2"), + srt(text = "classify", subjNote = "D2", subjIndex = 0) + ) ) ) }
