This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/master by this push:
new 40bd71b WIP.
40bd71b is described below
commit 40bd71bff4b19d4f99403bf6c58346f35de68303
Author: Aaron Radzinski <[email protected]>
AuthorDate: Tue Dec 7 18:59:03 2021 -0800
WIP.
---
.../org/apache/nlpcraft/NCEntityEnricher.java | 15 ++-------
.../scala/org/apache/nlpcraft/NCEntityParser.java | 2 +-
.../main/scala/org/apache/nlpcraft/NCModel.java | 4 +--
.../scala/org/apache/nlpcraft/NCModelAdapter.java | 12 ++++++-
.../scala/org/apache/nlpcraft/NCParameterized.java | 37 ++++++++++------------
.../apache/nlpcraft/NCParameterizedAdapter.java | 32 ++++++++-----------
.../scala/org/apache/nlpcraft/NCTokenEnricher.java | 15 ++-------
.../scala/org/apache/nlpcraft/NCTokenParser.java | 3 +-
8 files changed, 50 insertions(+), 70 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityEnricher.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityEnricher.java
index ccc49f2..fd7b470 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityEnricher.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityEnricher.java
@@ -15,18 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft;/*
- _________ ______________
- __ ____/_______________ __ \__ /_____ _____ __
- _ / _ __ \_ ___/_ /_/ /_ /_ __ `/_ / / /
- / /___ / /_/ /(__ )_ ____/_ / / /_/ /_ /_/ /
- \____/ \____//____/ /_/ /_/ \__,_/ _\__, /
- /____/
-
- 2D ASCII JVM GAME ENGINE FOR SCALA3
- (C) 2021 Rowan Games, Inc.
- ALl rights reserved.
-*/
+package org.apache.nlpcraft;
import java.util.*;
@@ -40,5 +29,5 @@ public interface NCEntityEnricher {
* @param cfg
* @param ents
*/
- void enrich(NCRequest req, NCModelConfig cfg, List<NCEntity> ents);
+ void enrich(NCRequest req, NCModelConfig cfg, List<NCEntity> ents) throws
NCException;
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityParser.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityParser.java
index d58dbc8..20e7cde 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityParser.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityParser.java
@@ -30,5 +30,5 @@ public interface NCEntityParser {
* @param toks
* @return
*/
- List<NCEntity> parse(NCRequest req, NCModelConfig cfg, List<NCToken> toks);
+ List<NCEntity> parse(NCRequest req, NCModelConfig cfg, List<NCToken> toks)
throws NCException;
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
index 876142d..4feec48 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
@@ -31,10 +31,10 @@ public interface NCModel {
/**
*
- * @param var
+ * @param vrn
* @return
*/
- default boolean onVariant(List<NCEntity> var) {
+ default boolean onVariant(List<NCEntity> vrn) {
return true;
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelAdapter.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelAdapter.java
index 73c72e1..ac8a1b5 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelAdapter.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelAdapter.java
@@ -21,8 +21,18 @@ package org.apache.nlpcraft;
*
*/
public class NCModelAdapter implements NCModel {
+ private final NCModelConfig cfg;
+
+ /**
+ *
+ * @param cfg
+ */
+ public NCModelAdapter(NCModelConfig cfg) {
+ this.cfg = cfg;
+ }
+
@Override
public NCModelConfig getConfig() {
- return null; // TODO
+ return cfg;
}
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCParameterized.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCParameterized.java
index 854fbba..3a939d8 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCParameterized.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCParameterized.java
@@ -15,18 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft;/*
- _________ ______________
- __ ____/_______________ __ \__ /_____ _____ __
- _ / _ __ \_ ___/_ /_/ /_ /_ __ `/_ / / /
- / /___ / /_/ /(__ )_ ____/_ / / /_/ /_ /_/ /
- \____/ \____//____/ /_/ /_/ \__,_/ _\__, /
- /____/
-
- 2D ASCII JVM GAME ENGINE FOR SCALA3
- (C) 2021 Rowan Games, Inc.
- ALl rights reserved.
-*/
+package org.apache.nlpcraft;
import java.util.Optional;
@@ -35,7 +24,7 @@ import java.util.Optional;
*/
public interface NCParameterized {
/**
- *
+ *
* @param key
* @param <T>
* @return
@@ -43,7 +32,7 @@ public interface NCParameterized {
<T> T get(String key);
/**
- *
+ *
* @param key
* @param <T>
* @return
@@ -51,14 +40,14 @@ public interface NCParameterized {
<T> Optional<T> getOpt(String key);
/**
- *
+ *
* @param key
* @param obj
*/
- void put(String key, Object obj);
+ <T> T put(String key, Object obj);
/**
- *
+ *
* @param key
* @param obj
* @param <T>
@@ -67,16 +56,24 @@ public interface NCParameterized {
<T> T putIfAbsent(String key, T obj);
/**
- *
+ *
* @param key
* @return
*/
boolean contains(String key);
/**
- *
+ *
* @param key
* @return
*/
- boolean remove(String key);
+ <T> T remove(String key);
+
+ /**
+ *
+ * @param key
+ * @param obj
+ * @return
+ */
+ boolean remove(String key, Object obj);
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCParameterizedAdapter.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCParameterizedAdapter.java
index ec76e29..81d9854 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCParameterizedAdapter.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCParameterizedAdapter.java
@@ -15,18 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft;/*
- _________ ______________
- __ ____/_______________ __ \__ /_____ _____ __
- _ / _ __ \_ ___/_ /_/ /_ /_ __ `/_ / / /
- / /___ / /_/ /(__ )_ ____/_ / / /_/ /_ /_/ /
- \____/ \____//____/ /_/ /_/ \__,_/ _\__, /
- /____/
-
- 2D ASCII JVM GAME ENGINE FOR SCALA3
- (C) 2021 Rowan Games, Inc.
- ALl rights reserved.
-*/
+package org.apache.nlpcraft;
import java.util.HashMap;
import java.util.Optional;
@@ -44,26 +33,31 @@ public class NCParameterizedAdapter implements
NCParameterized {
@Override
public <T> Optional<T> getOpt(String key) {
- return Optional.empty();
+ return Optional.ofNullable((T)map.get(key));
}
@Override
- public void put(String key, Object obj) {
-
+ public <T> T put(String key, Object obj) {
+ return (T)map.put(key, obj);
}
@Override
public <T> T putIfAbsent(String key, T obj) {
- return null;
+ return (T)map.putIfAbsent(key, obj);
}
@Override
public boolean contains(String key) {
- return false;
+ return map.containsKey(key);
+ }
+
+ @Override
+ public <T> T remove(String key) {
+ return (T)map.remove(key);
}
@Override
- public boolean remove(String key) {
- return false;
+ public boolean remove(String key, Object obj) {
+ return map.remove(key, obj);
}
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenEnricher.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenEnricher.java
index a26abe7..ecba755 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenEnricher.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenEnricher.java
@@ -15,18 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft;/*
- _________ ______________
- __ ____/_______________ __ \__ /_____ _____ __
- _ / _ __ \_ ___/_ /_/ /_ /_ __ `/_ / / /
- / /___ / /_/ /(__ )_ ____/_ / / /_/ /_ /_/ /
- \____/ \____//____/ /_/ /_/ \__,_/ _\__, /
- /____/
-
- 2D ASCII JVM GAME ENGINE FOR SCALA3
- (C) 2021 Rowan Games, Inc.
- ALl rights reserved.
-*/
+package org.apache.nlpcraft;
import java.util.*;
@@ -40,5 +29,5 @@ public interface NCTokenEnricher {
* @param cfg
* @param toks
*/
- void enrich(NCRequest req, NCModelConfig cfg, List<NCToken> toks);
+ void enrich(NCRequest req, NCModelConfig cfg, List<NCToken> toks) throws
NCException;
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenParser.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenParser.java
index 0f06198..14d0f69 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenParser.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenParser.java
@@ -27,6 +27,7 @@ public interface NCTokenParser {
*
* @param req
* @return
+ * @throws
*/
- List<NCToken> parse(NCRequest req);
+ List<NCToken> parse(NCRequest req) throws NCException;
}