This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-492
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-492 by this push:
new 782a72a3 WIP.
782a72a3 is described below
commit 782a72a37d365545e2c6df96bb0fe0f98a886615
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Apr 4 13:12:34 2022 +0300
WIP.
---
nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityMapper.java | 8 ++++----
.../apache/nlpcraft/internal/impl/NCModelPipelineManager.scala | 2 +-
.../test/scala/org/apache/nlpcraft/nlp/NCEntityMapperSpec.scala | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityMapper.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityMapper.java
index bc2a0409..f84434f0 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityMapper.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityMapper.java
@@ -25,10 +25,10 @@ import java.util.List;
public interface NCEntityMapper extends NCLifecycle {
/**
*
- * @param req
- * @param entities
- * @param toks
+ * @param req Input request descriptor.
+ * @param cfg Configuration of the model this components is associated
with.
+ * @param ents List of entities to enrich.
* @return
*/
- List<NCEntity> convert(NCRequest req, List<NCEntity> entities,
List<NCToken> toks);
+ List<NCEntity> map(NCRequest req, NCModelConfig cfg, List<NCEntity>
entities);
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelPipelineManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelPipelineManager.scala
index c0c5653a..3b9ba2b4 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelPipelineManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelPipelineManager.scala
@@ -150,7 +150,7 @@ class NCModelPipelineManager(cfg: NCModelConfig, pipeline:
NCPipeline) extends L
for (v <- entVals) v.validate(req, cfg, entsList)
for (m <- entMappers)
- entsList = m.convert(req, entsList, toks)
+ entsList = m.map(req, cfg, entsList)
if entsList == null then E("Entity mapper cannot return null
values.")
val entities = entsList.asScala.toSeq
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityMapperSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityMapperSpec.scala
index 5a309b08..1a75cbdf 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityMapperSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/NCEntityMapperSpec.scala
@@ -34,7 +34,7 @@ import scala.jdk.CollectionConverters.*
*/
class NCEntityMapperSpec:
private case class Combiner(ids: String*) extends NCEntityMapper:
- override def convert(req: NCRequest, entities: JList[NCEntity], toks:
JList[NCToken]): JList[NCEntity] =
+ override def map(req: NCRequest, cfg: NCModelConfig, entities:
JList[NCEntity]): JList[NCEntity] =
val es = entities.asScala
val replaced = es.filter(p => ids.contains(p.getId))