This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-30
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-30 by this push:
new 16b6351 WIP.
16b6351 is described below
commit 16b635173a6a3fe4875d4acdf52420b3a2ddf9c9
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Apr 20 15:49:00 2020 +0300
WIP.
---
.../mgrs/nlp/enrichers/NCEnricherBaseSpec.scala | 10 +-
.../mgrs/nlp/enrichers/NCEnrichersTestBeans.scala | 151 +++++------
.../nlp/enrichers/sort/NCEnricherSortSpec.scala | 301 +++++++++++----------
3 files changed, 235 insertions(+), 227 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 9f755c9..f919f49 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
@@ -71,11 +71,11 @@ class NCEnricherBaseSpec {
assertTrue(res.getResult.isPresent, s"Missed result data")
- val sens = NCTestSentence.deserialize(res.getResult.get())
+ val sens = NCTestSentence.deserialize(res.getResult.get()).toSeq
val expSen = NCTestSentence(expToks)
assertTrue(
- sens.exists(_ == expSen),
+ sens.contains(expSen),
s"Required sentence not found [request=$txt, \nexpected=\n$expSen,
\nfound=\n${sens.mkString("\n")}\n]"
)
}
@@ -95,7 +95,7 @@ class NCEnricherBaseSpec {
assertTrue(res.getResult.isPresent, s"Missed result data")
val expSens = expToks.map(NCTestSentence(_))
- val sens = NCTestSentence.deserialize(res.getResult.get())
+ val sens = NCTestSentence.deserialize(res.getResult.get()).toSeq
require(
expSens.size == sens.size,
@@ -104,7 +104,7 @@ class NCEnricherBaseSpec {
for (expSen ← expSens)
require(
- sens.exists(_ == expSen),
+ sens.contains(expSen),
s"Required sentence not found [request=$txt,
\nexpected=\n$expSen, \nfound=\n${sens.mkString("\n")}\n]"
)
}
@@ -132,7 +132,7 @@ class NCEnricherBaseSpec {
err.printStackTrace(System.out)
}
- Assertions.fail(s"Failed ${errs.size} tests. See errors list
above.")
+ Assertions.fail(s"Failed ${errs.size} from ${tests.size} tests.
See errors list above.")
}
else
println(s"All tests passed: ${tests.size}")
diff --git
a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
index 7746d72..548c559 100644
---
a/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
+++
b/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
@@ -19,6 +19,7 @@ package org.apache.nlpcraft.probe.mgrs.nlp.enrichers
import java.io.{ByteArrayInputStream, ByteArrayOutputStream,
ObjectInputStream, ObjectOutputStream}
import java.nio.charset.StandardCharsets.UTF_8
+import java.util
import java.util.{Base64, Optional}
import org.apache.nlpcraft.model.NCToken
@@ -120,37 +121,35 @@ case class NCTestMetroToken(text: String, metro: String)
extends NCTestToken {
// Probe enrichers.
case class NCTestSortToken(
text: String,
- subjNotes: Option[Seq[String]] = None,
- subjIndexes: Option[Seq[Int]] = None,
- byNotes: Option[Seq[String]] = None,
- byIndexes: Option[Seq[Int]] = None,
+ subjNotes: Seq[String] = Seq.empty,
+ subjIndexes: Seq[Int] = Seq.empty,
+ byNotes: Seq[String] = Seq.empty,
+ byIndexes: Seq[Int] = Seq.empty,
asc: Option[Boolean] = None
) extends NCTestToken {
require(text != null)
require(subjNotes != null)
- require(subjNotes.nonEmpty || byNotes.nonEmpty)
- require(subjIndexes.nonEmpty || byIndexes.nonEmpty)
+ require(subjIndexes != null)
require(byNotes != null)
- require(byNotes.isEmpty || byNotes.get.nonEmpty)
require(byIndexes != null)
- require(byIndexes.isEmpty || byIndexes.get.nonEmpty)
require(asc != null)
+ require(subjNotes.nonEmpty || byNotes.nonEmpty)
+ require(subjIndexes.nonEmpty || byIndexes.nonEmpty)
+ require(subjNotes.isEmpty && subjIndexes.isEmpty || subjNotes.nonEmpty &&
subjIndexes.nonEmpty)
+ require(byNotes.isEmpty && byIndexes.isEmpty || byNotes.nonEmpty &&
byIndexes.nonEmpty)
+
override def id: String = "nlpcraft:sort"
override def toString: String = {
- var s = ""
+ var s = s"$text(sort)<"
- if (subjNotes.isDefined)
- s = s"$s" +
- s", subjNotes=[${subjNotes.get.mkString(",")}]" +
- s", subjIndexes=[${subjIndexes.get.mkString(",")}]"
+ if (subjNotes.nonEmpty)
+ s = s"${s}subjNotes=[${subjNotes.mkString(",")}],
subjIndexes=[${subjIndexes.mkString(",")}]"
- if (byNotes.isDefined) {
- val sBy = s"$s" +
- s", byNotes=[${byNotes.get.mkString(",")}]" +
- s", byIndexes=[${byIndexes.get.mkString(",")}]"
+ if (byNotes.nonEmpty) {
+ val sBy = s"byNotes=[${byNotes.mkString(",")}],
byIndexes=[${byIndexes.mkString(",")}]"
- s = if (s.nonEmpty) s"$s, $sBy" else sBy
+ s = if (subjNotes.nonEmpty) s"$s, $sBy" else s"$s$sBy"
}
if (asc.isDefined)
@@ -162,56 +161,22 @@ case class NCTestSortToken(
}
}
+object NCTestSortTokenType extends Enumeration {
+ type NCTestSortTokenType = Value
+ val SUBJ_ONLY, BY_ONLY = Value
+}
+
+import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.NCTestSortTokenType._
+
object NCTestSortToken {
- private def cStr(seq: Seq[String]): Option[Seq[String]] = if (seq.isEmpty)
None else Some(seq)
- private def cInt(seq: Seq[Int]): Option[Seq[Int]] = if (seq.isEmpty) None
else Some(seq)
-
-// def apply(
-// text: String,
-// subjNotes: Seq[String] = Seq.empty,
-// subjIndexes: Seq[Int] = Seq.empty,
-// byNotes: Seq[String] = Seq.empty,
-// byIndexes: Seq[Int] = Seq.empty,
-// asc: Boolean
-// ): NCTestSortToken =
-// new NCTestSortToken(text, cStr(subjNotes), cInt(subjIndexes),
cStr(byNotes), cInt(byIndexes), Some(asc))
-//
-// def apply(
-// text: String,
-// subjNotes: Seq[String] = Seq.empty,
-// subjIndexes: Seq[Int] = Seq.empty,
-// byNotes: Seq[String] = Seq.empty,
-// byIndexes: Seq[Int] = Seq.empty,
-// asc: Option[Boolean] = None
-// ): NCTestSortToken =
-// new NCTestSortToken(text, cStr(subjNotes), cInt(subjIndexes),
cStr(byNotes), cInt(byIndexes), asc)
-
-// def apply(
-// text: String,
-// subjNotes: Option[Seq[String]] = None,
-// subjIndexes: Option[Seq[Int]] = None,
-// byNotes: Option[Seq[String]] = None,
-// byIndexes: Option[Seq[Int]] = None,
-// asc: Boolean
-// ): NCTestSortToken = new NCTestSortToken(text, subjNotes, subjIndexes,
byNotes, byIndexes, Some(asc))
-
-// def apply(
-// text: String,
-// subjNote: String,
-// subjIndex: Int,
-// byNotes: Option[Seq[String]] = None,
-// byIndexes: Option[Seq[Int]] = None,
-// asc: Boolean
-// ): NCTestSortToken = new NCTestSortToken(text, Some(Seq(subjNote)),
Some(Seq(subjIndex)), byNotes, byIndexes, Some(asc))
-
-// def apply(
-// text: String,
-// subjNote: String,
-// subjIndex: Int,
-// byNotes: Option[Seq[String]] = None,
-// byIndexes: Option[Seq[Int]] = None,
-// asc: Option[Boolean] = None
-// ): NCTestSortToken = new NCTestSortToken(text, Some(Seq(subjNote)),
Some(Seq(subjIndex)), byNotes, byIndexes, asc)
+ def apply(
+ text: String,
+ subjNotes: Seq[String],
+ subjIndexes: Seq[Int],
+ byNotes: Seq[String],
+ byIndexes: Seq[Int],
+ asc: Boolean
+ ): NCTestSortToken = new NCTestSortToken(text, subjNotes, subjIndexes,
byNotes, byIndexes, Some(asc))
def apply(
text: String,
@@ -219,8 +184,34 @@ object NCTestSortToken {
subjIndex: Int,
byNote: String,
byIndex: Int
+ ): NCTestSortToken = new NCTestSortToken(text, Seq(subjNote),
Seq(subjIndex), Seq(byNote), Seq(byIndex), None)
+
+ def apply(
+ text: String,
+ typ: NCTestSortTokenType,
+ note: String,
+ index: Int
): NCTestSortToken =
- new NCTestSortToken(text, Some(Seq(subjNote)), Some(Seq(subjIndex)),
Some(Seq(byNote)), Some(Seq(byIndex)), None)
+ typ match {
+ case SUBJ_ONLY ⇒ new NCTestSortToken(text, subjNotes = Seq(note),
subjIndexes = Seq(index), asc = None)
+ case BY_ONLY ⇒ new NCTestSortToken(text, byNotes = Seq(note),
byIndexes = Seq(index), asc = None)
+
+ case _ ⇒ throw new AssertionError(s"Unexpected type: $typ")
+ }
+
+ def apply(
+ text: String,
+ typ: NCTestSortTokenType,
+ note: String,
+ index: Int,
+ asc: Boolean
+ ): NCTestSortToken =
+ typ match {
+ case SUBJ_ONLY ⇒ new NCTestSortToken(text, subjNotes = Seq(note),
subjIndexes = Seq(index), asc = Some(asc))
+ case BY_ONLY ⇒ new NCTestSortToken(text, byNotes = Seq(note),
byIndexes = Seq(index), asc = Some(asc))
+
+ case _ ⇒ throw new AssertionError(s"Unexpected type: $typ")
+ }
def apply(
text: String,
@@ -229,8 +220,7 @@ object NCTestSortToken {
byNote: String,
byIndex: Int,
asc: Boolean
- ): NCTestSortToken =
- new NCTestSortToken(text, Some(Seq(subjNote)), Some(Seq(subjIndex)),
Some(Seq(byNote)), Some(Seq(byIndex)), Some(asc))
+ ): NCTestSortToken = new NCTestSortToken(text, Seq(subjNote),
Seq(subjIndex), Seq(byNote), Seq(byIndex), Some(asc))
}
case class NCTestRelationToken(text: String, `type`: String, indexes:
Seq[Int], note: String) extends NCTestToken {
@@ -312,11 +302,12 @@ object NCTestToken {
latitude = t.meta("nlpcraft:coordinate:latitude"),
longitude = t.meta("nlpcraft:coordinate:longitude")
)
- case "nlpcraft:num" ⇒ NCTestNumericToken(
- txt,
- from = t.meta("nlpcraft:num:from"),
- to = t.meta("nlpcraft:num:to")
- )
+ case "nlpcraft:num" ⇒
+ NCTestNumericToken(
+ txt,
+ from = t.meta("nlpcraft:num:from"),
+ to = t.meta("nlpcraft:num:to")
+ )
case "nlpcraft:date" ⇒ NCTestDateToken(txt)
case "nlpcraft:city" ⇒ NCTestCityToken(txt, city =
t.meta("nlpcraft:city:city"))
case "nlpcraft:region" ⇒ NCTestRegionToken(txt, region =
t.meta("nlpcraft:region:region"))
@@ -331,13 +322,13 @@ object NCTestToken {
val byIndexes: Optional[java.util.List[Int]] =
t.metaOpt("nlpcraft:sort:byindexes")
val asc: Optional[Boolean] = t.metaOpt("nlpcraft:sort:asc")
- def toOpt[T](lOpt: Optional[java.util.List[T]]):
Option[Seq[T]] =
- lOpt.asScala match {
- case Some(l) ⇒ Some(l.asScala)
- case None ⇒ None
+ def get[T](opt: Optional[util.List[T]]) =
+ opt.asScala match {
+ case Some(list) ⇒ list.asScala
+ case None ⇒ Seq.empty
}
- NCTestSortToken(txt, toOpt(subjNotes), toOpt(subjIndexes),
toOpt(byNotes), toOpt(byIndexes), asc.asScala)
+ NCTestSortToken(txt, get(subjNotes), get(subjIndexes),
get(byNotes), get(byIndexes), asc.asScala)
case "nlpcraft:relation" ⇒
val indexes: java.util.List[Int] =
t.meta("nlpcraft:relation:indexes")
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 b06f22b..0ed4758 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
@@ -18,152 +18,169 @@
package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.sort
import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.{NCEnricherBaseSpec,
NCTestNlpToken ⇒ nlp, NCTestSortToken ⇒ srt, NCTestUserToken ⇒ usr}
+import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.NCTestSortTokenType._
import org.junit.jupiter.api.Test
/**
* Sort enricher test.
*/
class NCEnricherSortSpec extends NCEnricherBaseSpec {
-// /**
-// *
-// * @throws Exception
-// */
-// @Test
-// def test(): Unit =
-// runBatch(
-// _ ⇒ checkExists(
-// "sort A",
-// srt(text = "sort", subjNote = "A", subjIndex = 1),
-// usr("A", "A")
-// ),
-// _ ⇒ checkExists(
-// "sort A by A",
-// srt(text = "sort", subjNote = "A", subjIndex = 1, byNote =
"A", byIndex = 3),
-// usr(text = "A", id = "A"),
-// nlp(text = "by", isStop = true),
-// 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(
-// "sort A B by A B",
-// srt(text = "sort", subjNotes = Seq("A", "B"), subjIndexes =
Seq(1, 2), byNotes = Seq("A", "B"), byIndexes = Seq(4, 5)),
-// usr(text = "A", id = "A"),
-// usr(text = "B", id = "B"),
-// nlp(text = "by", isStop = true),
-// usr(text = "A", id = "A"),
-// usr(text = "B", id = "B")
-// ),
-// _ ⇒ checkExists(
-// "sort A B by A B",
-// srt(text = "sort", subjNote = "AB", subjIndex = 1, byNote =
"AB", byIndex = 3),
-// usr(text = "A B", id = "AB"),
-// nlp(text = "by", isStop = true),
-// usr(text = "A B", id = "AB")
-// ),
-// _ ⇒ 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 in bottom up order",
-// srt(text = "segment", subjNote = "A", subjIndex = 1, asc =
true),
-// usr(text = "A", id = "A"),
-// nlp(text = "in bottom up order", isStop = true)
-// ),
-// // `by` is redundant word here
-// _ ⇒ checkExists(
-// "segment A by in bottom up order",
-// srt(text = "segment", subjNote = "A", subjIndex = 1),
-// usr(text = "A", id = "A"),
-// nlp(text = "by"),
-// nlp(text = "in"),
-// nlp(text = "bottom"),
-// nlp(text = "up"),
-// nlp(text = "order")
-// ),
-// _ ⇒ checkExists(
-// "the segment the A the 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 in bottom up the order the", isStop = true)
-// ),
-// _ ⇒ checkExists(
-// "the segment the A the by 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 bottom up the order the", isStop = true)
-// ),
-// _ ⇒ checkExists(
-// "A classify",
-// usr(text = "A", id = "A"),
-// srt(text = "classify", subjNote = "A", subjIndex = 0)
-// ),
-// _ ⇒ checkAll(
-// "A B classify",
-// Seq(
-// usr(text = "A B", id = "AB"),
-// srt(text = "classify", subjNote = "AB", subjIndex = 0)
-// ),
-// Seq(
-// usr(text = "A", id = "A"),
-// usr(text = "B", id = "B"),
-// srt(text = "classify", subjNotes = Some(Seq("A", "B")),
subjIndexes = Some(Seq(0, 1)))
-// )
-// ),
-// _ ⇒ 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)
-// )
-// ),
-// _ ⇒ checkAll(
-// "sort by A",
-// Seq(
-// srt(text = "sort by", subjNotes = None, subjIndexes =
None, byNotes = Some(Seq("A")), byIndexes = Some(Seq(1)), asc = None),
-// usr(text = "A", id = "A")
-// )
-// )
-// )
+ /**
+ *
+ * @throws Exception
+ */
+ @Test
+ def test(): Unit =
+ runBatch(
+ _ ⇒ checkExists(
+ "sort A",
+ srt(text = "sort", typ = SUBJ_ONLY, note = "A", index = 1),
+ usr("A", "A")
+ ),
+ _ ⇒ checkExists(
+ "sort A by A",
+ srt(text = "sort", subjNote = "A", subjIndex = 1, byNote =
"A", byIndex = 3),
+ usr(text = "A", id = "A"),
+ nlp(text = "by", isStop = true),
+ 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(
+ "sort A B by A B",
+ srt(text = "sort", subjNotes = Seq("A", "B"), subjIndexes =
Seq(1, 2), byNotes = Seq("A", "B"), byIndexes = Seq(4, 5)),
+ usr(text = "A", id = "A"),
+ usr(text = "B", id = "B"),
+ nlp(text = "by", isStop = true),
+ usr(text = "A", id = "A"),
+ usr(text = "B", id = "B")
+ ),
+ _ ⇒ checkExists(
+ "sort A B by A B",
+ srt(text = "sort", subjNote = "AB", subjIndex = 1, byNote =
"AB", byIndex = 3),
+ usr(text = "A B", id = "AB"),
+ nlp(text = "by", isStop = true),
+ usr(text = "A B", id = "AB")
+ ),
+ _ ⇒ checkExists(
+ "A classify",
+ usr(text = "A", id = "A"),
+ srt(text = "classify", typ = SUBJ_ONLY, note = "A", index = 0)
+ ),
+ _ ⇒ checkExists(
+ "the A the classify",
+ nlp(text = "the", isStop = true),
+ usr(text = "A", id = "A"),
+ nlp(text = "the", isStop = true),
+ srt(text = "classify", typ = SUBJ_ONLY, note = "A", index = 1)
+ ),
+ _ ⇒ checkExists(
+ "segment A by top down",
+ srt(text = "segment", typ = SUBJ_ONLY, note = "A", index = 1,
asc = false),
+ usr(text = "A", id = "A"),
+ nlp(text = "by top down", isStop = true)
+ ),
+ _ ⇒ checkExists(
+ "segment A in bottom up order",
+ srt(text = "segment", typ = SUBJ_ONLY, note = "A", index = 1,
asc = true),
+ usr(text = "A", id = "A"),
+ nlp(text = "in bottom up order", isStop = true)
+ ),
+ // `by` is redundant word here
+ _ ⇒ checkExists(
+ "segment A by in bottom up order",
+ srt(text = "segment", typ = SUBJ_ONLY, note = "A", index = 1),
+ usr(text = "A", id = "A"),
+ nlp(text = "by"),
+ nlp(text = "in"),
+ nlp(text = "bottom"),
+ nlp(text = "up"),
+ nlp(text = "order")
+ ),
+ _ ⇒ checkExists(
+ "the segment the A the in bottom up the order the",
+ nlp(text = "the", isStop = true),
+ srt(text = "segment", typ = SUBJ_ONLY, note = "A", index = 3,
asc = true),
+ nlp(text = "the", isStop = true),
+ usr(text = "A", id = "A"),
+ nlp(text = "the in bottom up the order the", isStop = true)
+ ),
+ _ ⇒ checkExists(
+ "the segment the A the by bottom up the order the",
+ nlp(text = "the", isStop = true),
+ srt(text = "segment", typ = SUBJ_ONLY, note = "A", index = 3,
asc = true),
+ nlp(text = "the", isStop = true),
+ usr(text = "A", id = "A"),
+ nlp(text = "the by bottom up the order the", isStop = true)
+ ),
+ _ ⇒ checkExists(
+ "A classify",
+ usr(text = "A", id = "A"),
+ srt(text = "classify", typ = SUBJ_ONLY, note = "A", index = 0)
+ ),
+ _ ⇒ checkAll(
+ "A B classify",
+ Seq(
+ usr(text = "A B", id = "AB"),
+ srt(text = "classify", typ = SUBJ_ONLY, note = "AB", index
= 0)
+ ),
+ Seq(
+ usr(text = "A", id = "A"),
+ usr(text = "B", id = "B"),
+ srt(text = "classify", subjNotes = Seq("A", "B"),
subjIndexes = Seq(0, 1))
+ )
+ ),
+ _ ⇒ checkAll(
+ "D classify",
+ Seq(
+ usr(text = "D", id = "D1"),
+ srt(text = "classify", typ = SUBJ_ONLY, note = "D1", index
= 0)
+ ),
+ Seq(
+ usr(text = "D", id = "D2"),
+ srt(text = "classify", typ = SUBJ_ONLY, note = "D2", index
= 0)
+ )
+ ),
+ _ ⇒ checkAll(
+ "sort by A",
+ Seq(
+ srt(text = "sort by", typ = BY_ONLY, note = "A", index =
1),
+ usr(text = "A", id = "A")
+ )
+ ),
+ _ ⇒ checkExists(
+ "organize by A, B top down",
+ srt(text = "organize by", byNotes = Seq("A", "B"), byIndexes =
Seq(1, 3), asc = Some(false)),
+ usr(text = "A", id = "A"),
+ nlp(text = ",", isStop = true),
+ usr(text = "B", id = "B"),
+ nlp(text = "top down", isStop = true)
+ ),
+ _ ⇒ checkExists(
+ "organize by A, B from bottom up order",
+ srt(text = "organize by", byNotes = Seq("A", "B"), byIndexes =
Seq(1, 3), asc = Some(true)),
+ usr(text = "A", id = "A"),
+ nlp(text = ",", isStop = true),
+ usr(text = "B", id = "B"),
+ nlp(text = "from bottom up order", isStop = true)
+ )
+ )
}