This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-471
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-471 by this push:
new 69b8b7a WIP
69b8b7a is described below
commit 69b8b7a6ac1f0e57ef5ae0b4a7dc07a5b71553ab
Author: Aaron Radzinski <[email protected]>
AuthorDate: Tue Dec 28 15:11:43 2021 -0800
WIP
---
.../nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java | 2 --
.../entity/parser/opennlp/impl/NCOpenNlpEntityParserImpl.scala | 6 ++----
.../nlpcraft/nlp/token/enricher/impl/en/NCEnQuotesImpl.scala | 4 ++--
.../nlp/token/enricher/impl/en/NCEnSwearWordsImpl.scala | 10 ++++------
4 files changed, 8 insertions(+), 14 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java
index 6873dc5..4d4b5dd 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java
@@ -40,7 +40,6 @@ public class NCOpenNlpEntityParser implements NCEntityParser {
private final NCOpenNlpEntityParserImpl impl;
/**
- * @param name
* @param modelSrc
*/
public NCOpenNlpEntityParser(String modelSrc) {
@@ -50,7 +49,6 @@ public class NCOpenNlpEntityParser implements NCEntityParser {
}
/**
- * @param name
* @param modelFile
*/
public NCOpenNlpEntityParser(File modelFile) {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpEntityParserImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpEntityParserImpl.scala
index ac36d95..dd3e24e 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpEntityParserImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpEntityParserImpl.scala
@@ -33,10 +33,9 @@ import scala.language.postfixOps
import scala.util.Using
import scala.util.control.Exception.catching
-object NCOpenNlpEntityParserImpl {
+object NCOpenNlpEntityParserImpl:
def apply(res: String): NCOpenNlpEntityParserImpl = new
NCOpenNlpEntityParserImpl(NCUtils.getStream(res), res)
def apply(f: File): NCOpenNlpEntityParserImpl = new
NCOpenNlpEntityParserImpl(new FileInputStream(f), f.getAbsolutePath)
-}
/**
*
@@ -76,8 +75,7 @@ class NCOpenNlpEntityParserImpl(is: InputStream, res: String)
extends NCEntityPa
new NCPropertyMapAdapter with NCEntity {
put(s"opennlp:${h.name}:probability", h.probability)
- override def getTokens: JList[NCToken] =
- toksSeq.flatMap(t => Option.when(t.getIndex >= i1 &&
t.getIndex <= i2)(t)).asJava
+ override def getTokens: JList[NCToken] = toksSeq.flatMap(t
=> Option.when(t.getIndex >= i1 && t.getIndex <= i2)(t)).asJava
override def getRequestId: String = req.getRequestId
override def getId: String = s"opennlp:${h.name}"
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/impl/en/NCEnQuotesImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/impl/en/NCEnQuotesImpl.scala
index 5a7b2b7..d18eeff 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/impl/en/NCEnQuotesImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/impl/en/NCEnQuotesImpl.scala
@@ -45,8 +45,8 @@ class NCEnQuotesImpl extends NCTokenEnricher with LazyLogging:
// Start and end quote mustn't be same ("a` processed as valid)
if quotes.nonEmpty && quotes.size % 2 == 0 then
val m = toksSeq.zipWithIndex.toMap
- val pairs = quotes.zipWithIndex.drop(1).flatMap {
- (t, idx) => Option.when(idx % 2 != 0)(m(t) -> m(quotes(idx -
1)))
+ val pairs = quotes.zipWithIndex.drop(1).flatMap { (t, idx) =>
+ Option.when(idx % 2 != 0)(m(t) -> m(quotes(idx - 1)))
}
toksSeq.zipWithIndex.foreach { (tok, idx) =>
tok.put("quoted:en", pairs.exists { case (from, to) => from >
idx && to < idx })
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/impl/en/NCEnSwearWordsImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/impl/en/NCEnSwearWordsImpl.scala
index a54ff1a..c383e5b 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/impl/en/NCEnSwearWordsImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/impl/en/NCEnSwearWordsImpl.scala
@@ -33,18 +33,16 @@ object NCEnSwearWordsImpl:
* @param mdlFile
* @return
*/
- def apply(mdlFile: File): NCEnSwearWordsImpl = new NCEnSwearWordsImpl(
- new BufferedInputStream(new FileInputStream(mdlFile)), mdlFile.getPath
- )
+ def apply(mdlFile: File): NCEnSwearWordsImpl =
+ new NCEnSwearWordsImpl(new BufferedInputStream(new
FileInputStream(mdlFile)), mdlFile.getPath)
/**
*
* @param mdlSrc
* @return
*/
- def apply(mdlSrc: String): NCEnSwearWordsImpl = new NCEnSwearWordsImpl(
- NCUtils.getStream(mdlSrc), mdlSrc
- )
+ def apply(mdlSrc: String): NCEnSwearWordsImpl =
+ new NCEnSwearWordsImpl(NCUtils.getStream(mdlSrc), mdlSrc)
/**
*