You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2022/08/03 17:57:39 UTC

[incubator-nlpcraft] branch NLPCRAFT-491 updated: WIP

This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a commit to branch NLPCRAFT-491
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-491 by this push:
     new 3d449816 WIP
3d449816 is described below

commit 3d449816160d3d3207a33b484eab5003c0af8902
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Wed Aug 3 10:57:32 2022 -0700

    WIP
---
 .../scala/org/apache/nlpcraft/NCCuration.scala     | 11 ++--
 .../main/scala/org/apache/nlpcraft/NCModel.scala   | 77 +++++++++++-----------
 2 files changed, 46 insertions(+), 42 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCCuration.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCCuration.scala
index 7819b585..b49abf58 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCCuration.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCCuration.scala
@@ -19,10 +19,13 @@ package org.apache.nlpcraft
 
 /**
   * A type of rejection indicating that human curation is required. Curation is typically an indication that input
-  * query is likely valid but needs a human correction like a type fix, slang resolution, etc.
-  * <p>
+  * query is likely valid but needs a human correction like a typo fix, slang resolution, etc.
+  *
   * Note that NLPCraft does not handle the curation process itself but only allows to indicate the curation
-  * request by throwing this exception. Curation is a special type of rejection. User code is responsible for the actual
-  * handling of the curation logic.
+  * request by throwing this exception. Curation is a special type of rejection. The user code is responsible for
+  * he actual handling of the curation logic.
+  *
+  * @param msg Curation message.
+  * @param cause Optional cause of this exception.
   */
 class NCCuration(msg: String, cause: Throwable = null) extends NCRejection(msg, cause)
\ No newline at end of file
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.scala
index 6a121a29..8e5a1de1 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.scala
@@ -18,51 +18,52 @@
 package org.apache.nlpcraft
 
 /**
-  * User data model
-  * <p>
-  * Data model is a holder for user-define NLP processing logic that provides an interface to your data sources like a
-  * database or a SaaS application. NLPCraft employs model-as-a-code approach where entire data model is an
-  * implementation of this interface which can be developed using any JVM programming language like Java, Scala,
-  * Kotlin, or Groovy. The instance of this interface is passed to {@link NCModelClient} class and contains:
-  * <ul>
-  * <li>Model {@link # getConfig ( ) configurfation}.</li>
-  * <li>Model {@link # getPipeline ( ) processing pipeline}.</li>
-  * <li>Life-cycle callbacks.</li>
-  * </ul>
-  * Note that model-as-a-code approach natively supports any software life cycle tools and frameworks like various
-  * build tools, CI/SCM tools, IDEs, etc. You don't need an additional web-based tools to manage
+  * User data model.
+  *
+  * Data model is a holder for user-defined NLP processing logic. NLPCraft employs model-as-a-code approach where
+  * entire data model is an implementation of this interface which can be simply developed using any JVM programming
+  * language like Java, Scala, Kotlin, or Groovy.
+  *
+  * The instance of this interface is passed to [[NCModelClient]] class and contains:
+  *  - Model [[NCModel.getConfig configuration]].
+  *  - Model [[NCModel.getPipeline processing pipeline]].
+  *  - Life-cycle callbacks.
+  *
+  * Note that this model-as-a-code approach natively supports any software life cycle tools and frameworks like various
+  * build tools, CI/SCM tools, IDEs, etc. You don't need any additional tools to manage
   * some aspects of your data models - your entire model and all of its components are part of your project's source code.
-  * <p>
-  * In most cases, one would use a convenient {@link NCModelAdapter} adapter to implement this interface. Here's a snippet
+  *
+  * In most cases, one would use a convenient [[NCModelAdapter]] adapter to implement this interface. Here's a snippet
   * of the user data model from LightSwitch example:
-  * <pre class="brush: java, highlight: [1]">
+  * {{{
   * public class LightSwitchJavaModel extends NCModelAdapter {
-  * public LightSwitchJavaModel() {
-  * super(
-  * new NCModelConfig("nlpcraft.lightswitch.java.ex", "LightSwitch Example Model", "1.0"),
-  * new NCPipelineBuilder().withSemantic("en", "lightswitch_model.yaml").build()
-  * );
-  * }
+  *     public LightSwitchJavaModel() {
+  *         super(
+  *             new NCModelConfig("nlpcraft.lightswitch.java.ex", "LightSwitch Example Model", "1.0"),
+  *             new NCPipelineBuilder().withSemantic("en", "lightswitch_model.yaml").build()
+  *         );
+  *     }
   *
-  * &#64;NCIntent("intent=ls term(act)={has(ent_groups, 'act')} term(loc)={# == 'ls:loc'}*")
-  * NCResult onMatch(
-  * &#64;NCIntentTerm("act") NCEntity actEnt,
-  * &#64;NCIntentTerm("loc") List&lt;NCEntity&gt; locEnts
-  * ) {
-  * String status=actEnt.getId().equals("ls:on")?"on":"off";
-  * String locations=locEnts.isEmpty() ? "entire house":
-  * locEnts.stream().map(NCEntity::mkText).collect(Collectors.joining(", "));
+  *     &#64;NCIntent("intent=ls term(act)={has(ent_groups, 'act')} term(loc)={# == 'ls:loc'}*")
+  *     NCResult onMatch(
+  *         &#64;NCIntentTerm("act") NCEntity actEnt,
+  *         &#64;NCIntentTerm("loc") List&lt;NCEntity&gt; locEnts
+  *     ) {
+  *         String status=actEnt.getId().equals("ls:on")?"on":"off";
+  *         String locations=locEnts.isEmpty() ? "entire house":
+  *         locEnts.stream().map(NCEntity::mkText).collect(Collectors.joining(", "));
   *
-  * return new NCResult(
-  * "Lights are [" + status + "] in [" + locations.toLowerCase() + "].",
-  * NCResultType.ASK_RESULT
-  * );
-  * }
+  *         return new NCResult(
+  *             "Lights are [" + status + "] in [" + locations.toLowerCase() + "].",
+  *             NCResultType.ASK_RESULT
+  *         );
+  *     }
   * }
-  * </pre>
+  * }}}
   *
-  * @see NCModelClient
-  * @see NCModelAdapter */
+  * @see [[NCModelClient]]
+  * @see [[NCModelAdapter]]
+  */
 trait NCModel:
     /**
       * Gets model configuration.