546
547
548
549
550
551
552
553
554
555
556
557
558
559
|
bTokenFound = true;
}
}
}
}
}
}
}
// token tags
if (oToken.hasOwnProperty("aTags") && oNode.hasOwnProperty("<tags>")) {
for (let sTag of oToken["aTags"]) {
if (oNode["<tags>"].hasOwnProperty(sTag)) {
yield ["/", sTag, oNode["<tags>"][sTag]];
bTokenFound = true;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
|
bTokenFound = true;
}
}
}
}
}
}
// regex multi morph arcs
if (oNode.hasOwnProperty("<re_mmorph>")) {
if (oToken.hasOwnProperty("nMultiStartTo")) {
let lMorph = oToken["oMultiToken"]["lMorph"];
for (let sRegex in oNode["<re_mmorph>"]) {
if (!sRegex.includes("¬")) {
// no anti-pattern
if (lMorph.some(sMorph => (sMorph.search(sRegex) !== -1))) {
yield ["&", sRegex, oNode["<re_mmorph>"][sRegex]];
bTokenFound = true;
}
} else {
// there is an anti-pattern
let [sPattern, sNegPattern] = sRegex.split("¬", 2);
if (sNegPattern == "*") {
// all morphologies must match with <sPattern>
if (sPattern) {
if (lMorph.every(sMorph => (sMorph.search(sPattern) !== -1))) {
yield ["&", sRegex, oNode["<re_mmorph>"][sRegex]];
bTokenFound = true;
}
}
} else {
if (sNegPattern && lMorph.some(sMorph => (sMorph.search(sNegPattern) !== -1))) {
continue;
}
if (!sPattern || lMorph.some(sMorph => (sMorph.search(sPattern) !== -1))) {
yield ["&", sRegex, oNode["<re_mmorph>"][sRegex]];
bTokenFound = true;
}
}
}
}
}
}
}
// token tags
if (oToken.hasOwnProperty("aTags") && oNode.hasOwnProperty("<tags>")) {
for (let sTag of oToken["aTags"]) {
if (oNode["<tags>"].hasOwnProperty(sTag)) {
yield ["/", sTag, oNode["<tags>"][sTag]];
bTokenFound = true;
|
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
|
if (cNodeType === null) {
lNextPointers.push(oPointer);
continue;
}
if (bDebug) {
console.log(" MATCH: " + cNodeType + sMatch);
}
let nMultiEnd = (cNodeType != "&") ? -1 : dToken["nMultiStartTo"];
lNextPointers.push({ "iToken1": oPointer["iToken1"], "iNode": iNode, "nMultiEnd": nMultiEnd });
}
}
lPointers = lNextPointers;
// check arcs of first nodes
for (let [cNodeType, sMatch, iNode] of this._getNextNodes(oGraph, oToken, oGraph[0])) {
if (cNodeType === null) {
continue;
}
if (bDebug) {
console.log(" MATCH: " + cNodeType + sMatch);
}
let nMultiEnd = (cNodeType != "&") ? -1 : dToken["nMultiStartTo"];
lPointers.push({ "iToken1": iToken, "iNode": iNode, "nMultiEnd": nMultiEnd });
}
// check if there is rules to check for each pointer
for (let oPointer of lPointers) {
if (oPointer["nMultiEnd"] != -1) {
if (oToken["i"] < oPointer["nMultiEnd"]) {
continue;
|
|
|
|
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
|
if (cNodeType === null) {
lNextPointers.push(oPointer);
continue;
}
if (bDebug) {
console.log(" MATCH: " + cNodeType + sMatch);
}
let nMultiEnd = (cNodeType != "&") ? -1 : oToken["nMultiStartTo"];
lNextPointers.push({ "iToken1": oPointer["iToken1"], "iNode": iNode, "nMultiEnd": nMultiEnd });
}
}
lPointers = lNextPointers;
// check arcs of first nodes
for (let [cNodeType, sMatch, iNode] of this._getNextNodes(oGraph, oToken, oGraph[0])) {
if (cNodeType === null) {
continue;
}
if (bDebug) {
console.log(" MATCH: " + cNodeType + sMatch);
}
let nMultiEnd = (cNodeType != "&") ? -1 : oToken["nMultiStartTo"];
lPointers.push({ "iToken1": iToken, "iNode": iNode, "nMultiEnd": nMultiEnd });
}
// check if there is rules to check for each pointer
for (let oPointer of lPointers) {
if (oPointer["nMultiEnd"] != -1) {
if (oToken["i"] < oPointer["nMultiEnd"]) {
continue;
|