This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-520
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-520 by this push:
new 85963868 WIP.
85963868 is described below
commit 85963868a6c505de93cfe0b562e89f9e903486b7
Author: Sergey Kamov <[email protected]>
AuthorDate: Fri Jan 6 17:39:14 2023 +0400
WIP.
---
.../org/apache/nlpcraft/nlp/parsers/NCSemanticElement.scala | 6 +++++-
.../nlpcraft/nlp/parsers/NCSemanticEntityParser.scala | 13 +++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticElement.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticElement.scala
index 68371517..7c4e8bb9 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticElement.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticElement.scala
@@ -34,10 +34,14 @@ import org.apache.nlpcraft.*
* with stemmatized forms of user input which were lemmatized preliminarily.
* This approach allows to provide more accurate matching and doesn't force
users to prepare synonyms in initial words form.
*
- * Also **semantic** element can have an optional set of special synonyms
called values or "proper nouns" for this element.
+ * Also semantic element can have an optional set of special synonyms called
values or "proper nouns" for this element.
* Unlike basic synonyms, each value is a pair of a name and a set of
standard synonyms by which that value,
* and ultimately its element, can be recognized in the user input.
*
+ * So [[NCEntity named entity]] can be found via
[[NCSemanticElement.getSynonyms element synonyms]] or
+ * [[NCSemanticElement.getValues element values]].
+ * Other [[NCSemanticElement]] properties are passed into created
corresponded [[NCEntity]] instance.
+ *
* See detailed description on the website
[[https://nlpcraft.apache.org/built-in-entity-parser.html#parser-semantic
Semantic Parser]].
*
* @see [[NCSemanticEntityParser]]
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParser.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParser.scala
index 2f4204f5..2b4e3742 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParser.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParser.scala
@@ -137,6 +137,19 @@ import NCSemanticEntityParser.*
* These macros also can be provided via YAML and JSON files or passed
directly in case of programmatically prepared
* [[NCSemanticElement]] list.
*
+ * Example of YAML elements definition.
+ * <pre>
+ * macros:
+ * "<OF>": "{of|for|per}"
+ * "<CUR>": "{current|present|now|local}"
+ * "<TIME>": "{time <OF> day|day
time|date|time|moment|datetime|hour|o'clock|clock|date time|date and time|time
and date}"
+ * elements:
+ * - id: "x:time"
+ * description: "Date and/or time token indicator."
+ * synonyms:
+ * - "{<CUR>|_} <TIME>"
+ * - "what <TIME> {is it now|now|is it|_}"
+ * </pre>
* See detailed description on the website
[[https://nlpcraft.apache.org/built-in-entity-parser.html#parser-semantic
Semantic Parser]].
*
* **NOTE:** [[NCSemanticElement]] synonyms, **stemmer** and **parser**
parameters must be configured for the same language.