This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-471
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-471 by this push:
new 87f1f47 CR
87f1f47 is described below
commit 87f1f47598e425a2c5f3f37dfb934f8001a4c263
Author: Aaron Radzinski <[email protected]>
AuthorDate: Tue Dec 28 12:28:47 2021 -0800
CR
---
nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.java | 9 ---------
.../org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala | 6 ++++++
.../apache/nlpcraft/internal/nlp/util/NCTestUtils.scala | 14 +++++---------
3 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.java
index e9f3ef8..57aa4e4 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.java
@@ -45,15 +45,6 @@ public interface NCEntity extends NCPropertyMap {
String getId();
/**
- * A shortcut method that gets internal globally unique system ID of the
entity.
- * <p>
- * This method is equivalent to:
- * <pre class="brush: java">
- * return meta("nlpcraft:nlp:unid");
- * </pre>
- *
- * TODO: default.
- *
* @return Internal globally unique system ID of the entity.
*/
default String getGuid() {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala
index 774846f..4c7292a 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala
@@ -557,6 +557,12 @@ class NCAsciiTable:
def error(log: Logger, header: Option[String] = None): Unit =
log.error(mkLogString(header))
/**
+ *
+ * @param header
+ */
+ def print(header: String): Unit = println(mkLogString(Some(header)))
+
+ /**
* Renders this table to log as trace.
*
* @param log Logger.
diff --git
a/nlpcraft/src/test/java/org/apache/nlpcraft/internal/nlp/util/NCTestUtils.scala
b/nlpcraft/src/test/java/org/apache/nlpcraft/internal/nlp/util/NCTestUtils.scala
index 0afda8a..15eebf0 100644
---
a/nlpcraft/src/test/java/org/apache/nlpcraft/internal/nlp/util/NCTestUtils.scala
+++
b/nlpcraft/src/test/java/org/apache/nlpcraft/internal/nlp/util/NCTestUtils.scala
@@ -30,9 +30,8 @@ object NCTestUtils:
* @param toks
*/
def printTokens(toks: Seq[NCToken]): Unit =
- val tbl = new NCAsciiTable()
+ val tbl = NCAsciiTable("Text", "Index", "POS", "Stem", "Lemma",
"Start", "End", "Length", "Stopword", "Properties")
- tbl #= ("Text", "Index", "POS", "Stem", "Lemma", "Start", "End",
"Length", "Stopword", "Properties")
for (t <- toks)
tbl += (
t.getText,
@@ -47,8 +46,7 @@ object NCTestUtils:
t.keysSet().asScala.map(p =>
s"$p=${t.get[Any](p)}").mkString("[", ", ", "]")
)
- println(s"Request: ${toks.map(_.getText).mkString(" ")}")
- println(tbl.toString)
+ tbl.print(s"Request: ${toks.map(_.getText).mkString(" ")}")
/**
*
@@ -56,9 +54,8 @@ object NCTestUtils:
* @param ents
*/
def printEntities(req: String, ents: Seq[NCEntity]): Unit =
- val tbl = new NCAsciiTable()
+ val tbl = NCAsciiTable("EntityId", "Tokens", "Properties")
- tbl #= ("EntityId", "Tokens", "Properties")
for (e <- ents)
tbl += (
e.getId,
@@ -66,8 +63,7 @@ object NCTestUtils:
e.keysSet().asScala.map(p =>
s"$p=${e.get[Any](p)}").mkString("{", ", ", "}")
)
- println(s"Request: $req")
- println(tbl.toString)
+ tbl.print(s"Request: $req")
/**
*
@@ -83,7 +79,7 @@ object NCTestUtils:
val started = now()
t.start(null) // TODO: fix it.
- println(s"'${t.getClass.getSimpleName}' created with time=${started -
start} ms and started=${now() - started} ms.")
+ println(s"'${t.getClass.getSimpleName}' created in ${started -
start}ms and started in ${now() - started}ms.")
t
/**