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 7a435fd WIP.
7a435fd is described below
commit 7a435fd825711721bec5c2c9aaa4718f9b2b62a3
Author: Sergey Kamov <[email protected]>
AuthorDate: Sat Sep 25 13:18:46 2021 +0300
WIP.
---
.../nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
index 4354d59..2889394 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
@@ -557,9 +557,11 @@ object NCSentenceManager extends NCService {
* @param mdl
* @param ns
*/
- private def dropAbstract(mdl: NCModel, ns: NCNlpSentence): Unit =
- if (!mdl.getAbstractTokens.isEmpty) {
- val notes = ns.flatten.distinct
+ private def dropAbstract(mdl: NCModel, ns: NCNlpSentence): Unit = {
+ val abstractToks = mdl.getAbstractTokens
+
+ if (!abstractToks.isEmpty) {
+ val notes = ns.flatten.distinct.filter(n =>
abstractToks.contains(n.noteType))
val keys = getPartKeys(notes)
val noteLinks = getLinks(notes)
@@ -567,11 +569,11 @@ object NCSentenceManager extends NCService {
notes.filter(n => {
lazy val noteToks = ns.tokens.filter(t => t.index >=
n.tokenFrom && t.index <= n.tokenTo)
- mdl.getAbstractTokens.contains(n.noteType) &&
- !keys.exists(_.intersect(n.noteType,
noteToks.head.startCharIndex, noteToks.last.startCharIndex)) &&
- !noteLinks.contains(NoteLink(n.noteType,
n.tokenIndexes.sorted))
+ !noteLinks.contains(NoteLink(n.noteType,
n.tokenIndexes.sorted)) &&
+ !keys.exists(_.intersect(n.noteType,
noteToks.head.startCharIndex, noteToks.last.startCharIndex))
}).foreach(ns.removeNote)
}
+ }
/**
*