This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-443
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-443 by this push:
new f45ab04 WIP.
f45ab04 is described below
commit f45ab04198848c11369038f5d16da0afb36827cd
Author: Sergey Kamov <[email protected]>
AuthorDate: Sat Sep 25 21:38:19 2021 +0300
WIP.
---
.../nlpcraft/probe/mgrs/synonyms/NCSynonymsManager.scala | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/synonyms/NCSynonymsManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/synonyms/NCSynonymsManager.scala
index 369fa9d..e2d59f6 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/synonyms/NCSynonymsManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/synonyms/NCSynonymsManager.scala
@@ -217,7 +217,9 @@ object NCSynonymsManager extends NCService {
* @param req
* @param variantsToks
*/
- private def isMatch(tow: IdlToken, chunk: NCProbeSynonymChunk, req:
NCRequest, variantsToks: Seq[Seq[NCToken]]): Boolean =
+ private def isMatch(
+ tow: IdlToken, chunk: NCProbeSynonymChunk, req: NCRequest,
variantsToks: Seq[Seq[NCToken]]
+ ): Boolean =
idlChunksCache.
getOrElseUpdate(req.getServerRequestId,
mutable.HashMap.empty[(IdlToken, NCProbeSynonymChunk), Boolean]
@@ -226,21 +228,21 @@ object NCSynonymsManager extends NCService {
(tow, chunk),
{
def get0[T](fromToken: NCToken => T, fromWord: NlpToken =>
T): T =
- if (tow.isToken) fromToken(tow.token)
- else fromWord(tow.word)
+ if (tow.isToken) fromToken(tow.token) else
fromWord(tow.word)
chunk.kind match {
case TEXT => chunk.wordStem == get0(_.stem, _.stem)
case REGEX =>
chunk.regex.matcher(get0(_.origText,
_.origText)).matches() ||
- chunk.regex.matcher(get0(_.normText,
_.normText)).matches()
+ chunk.regex.matcher(get0(_.normText,
_.normText)).matches()
case IDL =>
val ok =
variantsToks.par.exists(vrntToks =>
get0(t =>
- chunk.idlPred.apply(t,
NCIdlContext(toks = vrntToks, req = req)).value.asInstanceOf[Boolean],
+ chunk.idlPred.apply(t,
NCIdlContext(toks = vrntToks, req = req)).
+ value.asInstanceOf[Boolean],
_ => false
)
)