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

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


The following commit(s) were added to refs/heads/NLPCRAFT-468 by this push:
     new c59b06e  WIP.
c59b06e is described below

commit c59b06e8770111626f4e72668c859b750df6f7e7
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Oct 11 17:52:29 2021 +0300

    WIP.
---
 .../main/scala/org/apache/nlpcraft/NCNlpcraft.java | 10 +++----
 .../scala/org/apache/nlpcraft/model/NCRequest.java |  2 +-
 .../scala/org/apache/nlpcraft/model/NCResult.java  |  2 +-
 .../scala/org/apache/nlpcraft/model/NCToken.java   |  1 +
 .../nlpcraft/model/builders/NCModelBuilder.java    |  9 ++++--
 .../nlpcraft/model/builders/NCResultBuilder.java   | 33 ----------------------
 .../model/{ => impl}/NCMacroProcessor.java         |  3 +-
 .../model/impl/ner/NCSynonymsNerParser.java        |  4 ---
 .../ner/builders/NCSynonymsNerElementBuilder.java  |  1 -
 .../model/impl/opennlp/NCOpenNlpNerParser.java     |  2 +-
 .../src/test/java/org/apache/nlpcraft/ner1.json    |  2 +-
 11 files changed, 17 insertions(+), 52 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCNlpcraft.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCNlpcraft.java
index 0ef9098..e069613 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCNlpcraft.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCNlpcraft.java
@@ -23,7 +23,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-// Maybe all responses should be objects  to be mapped under REST.
+// TODO: Maybe all responses should be objects  to be mapped under REST.
 public interface NCNlpcraft {
     String ask(String txt, Map<String, Object> data, boolean enableLog, String 
userId);
     String ask(String txt, String userId);
@@ -59,15 +59,15 @@ public interface NCNlpcraft {
      *  - `need_curation` (boolean, optional, omitted processed as false)
 
      * 1. Confirmation
-     * - add 'need_confirm' = true flag to intents, which require 
confirmations.
-     * - set NCResult `need_confirm` = true if such intent fired.
-     * - add new API method
+     *  - add 'need_confirm' = true flag to intents, which require 
confirmations.
+     *  - set NCResult `need_confirm` = true if such intent fired.
+     *  - add new API method
      *    `void confirm(String srvReqId, boolean confirm)`;
      *
      * 2. Curation.
      *  - add 'need_curation' = true flag to model, which supports curation.
      *  - set `need_curation` = true in NCResult if there isn't intent found.
-     * - add new API method
+     *  - add new API method
      *     - `String curateText(String srvReqId)`; - which returns fixes 
request text
      *     or
      *     - `NCVariant curateVariant(String srvReqId)`; - which returns 
created winner variant.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java
index 4be5f91..1cfd499 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java
@@ -27,7 +27,7 @@ import java.util.Optional;
  */
 public interface NCRequest extends NCMetadata {
     /**
-     * TODO:
+     * TODO: optional?
      * Gets descriptor of the user on behalf of which this request was 
submitted.
      *
      * @return User descriptor.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCResult.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCResult.java
index b557b07..f26d6bb 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCResult.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCResult.java
@@ -25,7 +25,7 @@ import java.io.Serializable;
 import java.util.Collection;
 
 /**
- * TODO: it should be interface. Drop yaml. Drop html.
+ * TODO: it should be interface. Drop yaml. Drop html. Look at NCNlpcraft 
interface (confirmation and curation)
  * Data model result returned from model intent callbacks. Result consists of 
the
  * text body and the type. The type is similar in notion to MIME types.
  * <table class="dl-table">
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java
index 9a30a37..6397d74 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java
@@ -29,6 +29,7 @@ import java.util.List;
  */
 public interface NCToken extends NCMetadata {
     /**
+     * TODO: drop it.
      * Gets reference to the model this token belongs to.
      *
      * @return Model reference.
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
index 4d0b3ec..6549e51 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
@@ -34,6 +34,7 @@ import java.util.function.Function;
 // All other - optional.
 public class NCModelBuilder {
     // 1. Common  properties.
+    // Mandatory.
     public NCModelBuilder withId(String description) {
         return null;
     }
@@ -111,12 +112,12 @@ public class NCModelBuilder {
         return null;
     }
 
-    // 3. Base Nlp parser (open nlp, standord)
+    // 3. Base Nlp parser (open nlp - default, stanford)
     public NCModelBuilder withNlpWordsParser(NCNlpTextParser parser) {
         return null;
     }
 
-    // 4. NER parsers (open nlp, standord, our one built parser 
NCDefaultNerParser + any custom)
+    // 4. NER parsers (open nlp - default, stanford, our one built parser 
NCDefaultNerParser + any custom)
     public NCModelBuilder withNlpNerParsers(List<NCNlpNerParser> parsers) {
         return null;
     }
@@ -148,11 +149,13 @@ public class NCModelBuilder {
         return null;
     }
 
-    // 6. Behaviour
+    // 6. Behaviour.
     public NCModelBuilder withModelBehaviour(NCModelBehaviour behaviour) {
         return null;
     }
 
+    // Intents or Behaviour - mandatory.
+
     public NCModel getModel() {
         return null;
     }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCResultBuilder.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCResultBuilder.java
deleted file mode 100644
index 30cfc91..0000000
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCResultBuilder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.nlpcraft.model.builders;
-
-import org.apache.nlpcraft.model.NCResult;
-
-// Can be refactored after any server (spring, akka etc) implementation.
-// Maybe some 'result type' will be added again etc.
-public class NCResultBuilder {
-    // TODO: implement it.
-    public NCResultBuilder withBody(Object o) {
-        return null;
-    }
-
-    public NCResult getResult() {
-        return null;
-    }
-}
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCMacroProcessor.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCMacroProcessor.java
similarity index 98%
rename from 
nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCMacroProcessor.java
rename to 
nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCMacroProcessor.java
index b0b6037..c595aae 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCMacroProcessor.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCMacroProcessor.java
@@ -15,14 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.nlpcraft.model;
+package org.apache.nlpcraft.model.impl;
 
 import org.apache.nlpcraft.common.NCException;
 import org.apache.nlpcraft.common.makro.NCMacroJavaParserTrait;
 
 import java.util.Set;
 
-// TODO: move it from public API.
 /**
  * Standalone synonym macro DSL processor.
  * <p>
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/ner/NCSynonymsNerParser.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/ner/NCSynonymsNerParser.java
index 8cb0a7c..458c5f5 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/ner/NCSynonymsNerParser.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/ner/NCSynonymsNerParser.java
@@ -25,10 +25,6 @@ import java.util.Map;
 import java.util.Set;
 
 // TODO: maybe class.
-// With NCNlpNerToken elements metadata provided
-//  - `Value`.
-//  - group
-//  - parent  attributes 
 public interface NCSynonymsNerParser extends NCNlpNerParser {
     /**
      * Default value for {@link #getMaxElementSynonyms()} method.
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/ner/builders/NCSynonymsNerElementBuilder.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/ner/builders/NCSynonymsNerElementBuilder.java
index a4cb782..e3b3410 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/ner/builders/NCSynonymsNerElementBuilder.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/ner/builders/NCSynonymsNerElementBuilder.java
@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 
 // withId is only one mandatory call.
-// It is named NCSingleElementBuilder to have different name with 
NCMultiElementsBuilder.
 public class NCSynonymsNerElementBuilder {
     public NCSynonymsNerElementBuilder withId(String id) {
         return null;
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpNerParser.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpNerParser.java
index 8083e4b..591558e 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpNerParser.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpNerParser.java
@@ -25,7 +25,7 @@ import org.apache.nlpcraft.model.nlp.NCNlpRichWord;
 
 import java.util.List;
 
-// Implementation by default. Stanford in another module. Can  be provided by 
user.
+// Implementation by default for opennlp NERs. Stanford in another module.
 public class NCOpenNlpNerParser implements NCNlpNerParser {
     @Override
     public List<NCNlpNerToken> parse(NCRequest req, NCModelView mdl, 
List<NCNlpRichWord> words, List<NCNlpNerToken> elements) {
diff --git a/nlpcraft/src/test/java/org/apache/nlpcraft/ner1.json 
b/nlpcraft/src/test/java/org/apache/nlpcraft/ner1.json
index 8371d48..79d9409 100644
--- a/nlpcraft/src/test/java/org/apache/nlpcraft/ner1.json
+++ b/nlpcraft/src/test/java/org/apache/nlpcraft/ner1.json
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- * TODO: - there anly 2 sections:
+ * TODO: - there are only 2 sections:
  *  - macros - optional.
  *  - elements - mandatory.
  */

Reply via email to