You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by se...@apache.org on 2020/03/14 07:00:41 UTC
[incubator-nlpcraft] 09/13: WIP.
This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 1eebd1ff2553cbfb8624f1603f36d2ec73d24c55
Author: Sergey Kamov <se...@apache.org>
AuthorDate: Fri Mar 13 19:42:56 2020 +0300
WIP.
---
.../mgrs/nlp/enrichers/sort/NCSortEnricher.scala | 27 ++++++++++++++--------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/main/scala/org/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala b/src/main/scala/org/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala
index eaae459..5396ae3 100644
--- a/src/main/scala/org/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala
+++ b/src/main/scala/org/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala
@@ -35,11 +35,17 @@ import scala.collection.{Map, Seq, mutable}
* Sort enricher.
*/
object NCSortEnricher extends NCProbeEnricher {
+ // Single words.
private final val SORT =
Seq("sort", "rank", "classify", "order", "arrange", "organize", "segment", "shuffle").map(NCNlpCoreManager.stem)
+ // Single words.
+ // Cannot be same as in SORT.
private final val BY: Seq[String] = Seq("by", "on", "with").map(NCNlpCoreManager.stem)
+ // Multiple words.
+ // Cannot be same as in SORT and BY.
+ // Some words from chunks can be the same as SORT but cannot be same as BY.
private final val ORDER = {
val p = NCMacroParser()
@@ -57,6 +63,7 @@ object NCSortEnricher extends NCProbeEnricher {
private final val TOK_ID = "nlpcraft:sort"
+ // TODO: DROP it.
private final val SORT_TYPES = Seq(
"nlpcraft:continent",
"nlpcraft:subcontinent",
@@ -69,18 +76,20 @@ object NCSortEnricher extends NCProbeEnricher {
"nlpcraft:num"
)
+ // Elemens: SORT, BY, ORDER, x.
// Note that SORT, BY, ORDER - are sets of words (not single words)
+ // x - means one or multiple words. x must be at least one for each line, maximum two.
private final val SEQS =
Seq(
- s"x SORT BY x ORDER",
- s"x SORT BY x",
- s"SORT x BY x",
- s"x SORT",
- s"SORT x ORDER BY x",
- s"SORT x",
- s"ORDER SORT x BY x",
- s"ORDER SORT x",
- s"SORT x BY ORDER"
+ "x SORT BY x ORDER",
+ "x SORT BY x",
+ "SORT x BY x",
+ "x SORT",
+ "SORT x ORDER BY x",
+ "SORT x",
+ "ORDER SORT x BY x",
+ "ORDER SORT x",
+ "SORT x BY ORDER"
)
case class NoteData(note: String, indexes: Seq[Int])