582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
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
642
643
644
645
646
647
648
649
650
|
xSentenceBlock.appendChild(oGrammalecte.createNode("p", {className: "grammalecte_lxg_paragraph_sentence", textContent: oSentence.sSentence}));
let xTokenList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});
for (let oToken of oSentence.lTokens) {
if (oToken["sType"] != "INFO" && !oToken.hasOwnProperty("bMerged")) {
if (oToken["sType"] == "WORD" && !oToken["bValidToken"]) {
oToken["sType"] = "UNKNOWN_WORD";
}
xTokenList.appendChild(this._createTokenBlock2(oToken));
}
}
xSentenceBlock.appendChild(xTokenList);
this.xLxgResultZone.appendChild(xSentenceBlock);
}
}
}
catch (e) {
showError(e);
}
this.stopWaitIcon();
}
_createTokenBlock2 (oToken) {
let xTokenBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
// token description
xTokenBlock.appendChild(this._createTokenDescr2(oToken));
return xTokenBlock;
}
_createTokenDescr2 (oToken) {
try {
let xTokenDescr = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_descr"});
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
if (oToken.aLabels) {
if (oToken.aLabels.length < 2) {
// one morphology only
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem_inline", textContent: oToken.aLabels[0]}));
} else {
// several morphology
let xMorphList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
for (let sLabel of oToken.aLabels) {
xMorphList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
}
xTokenDescr.appendChild(xMorphList);
}
} else {
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem_inline", textContent: "étiquettes non décrites : [" + oToken.lMorph + "]" }));
}
// other labels description
if (oToken.aOtherLabels) {
let xSubBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_subblock"});
for (let sLabel of oToken.aOtherLabels) {
xSubBlock.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_other_tags", textContent: "• " + sLabel}));
}
xTokenDescr.appendChild(xSubBlock);
}
return xTokenDescr;
}
catch (e) {
showError(e);
}
}
// Lexical analysis
getListOfTokens () {
if (!this.bOpened || this.bWorking) {
return;
}
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
|
xSentenceBlock.appendChild(oGrammalecte.createNode("p", {className: "grammalecte_lxg_paragraph_sentence", textContent: oSentence.sSentence}));
let xTokenList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});
for (let oToken of oSentence.lTokens) {
if (oToken["sType"] != "INFO" && !oToken.hasOwnProperty("bMerged")) {
if (oToken["sType"] == "WORD" && !oToken["bValidToken"]) {
oToken["sType"] = "UNKNOWN_WORD";
}
xTokenList.appendChild(this._createTokenBlock(oToken));
}
}
xSentenceBlock.appendChild(xTokenList);
this.xLxgResultZone.appendChild(xSentenceBlock);
}
}
}
catch (e) {
showError(e);
}
this.stopWaitIcon();
}
// Lexical analysis
getListOfTokens () {
if (!this.bOpened || this.bWorking) {
return;
}
|
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
|
catch (e) {
showError(e);
}
}
_createTokenBlock (oToken) {
let xTokenBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
xTokenBlock.appendChild(this._createTokenDescr(oToken));
if (oToken.aSubElem) {
let xSubBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_subblock"});
for (let oSubElem of oToken.aSubElem) {
xSubBlock.appendChild(this._createTokenDescr(oSubElem));
}
xTokenBlock.appendChild(xSubBlock);
}
return xTokenBlock;
}
_createTokenDescr (oToken) {
try {
let xTokenDescr = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_descr"});
if (oToken.sType == "LOCP") {
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_also", textContent: "possiblement › "}));
}
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
if (oToken.aLabel.length === 1) {
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem_inline", textContent: oToken.aLabel[0]}));
} else {
let xMorphList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
for (let sLabel of oToken.aLabel) {
xMorphList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
}
xTokenDescr.appendChild(xMorphList);
}
return xTokenDescr;
}
catch (e) {
showError(e);
}
}
|
>
>
|
|
>
|
>
<
<
<
|
>
>
|
|
>
|
|
|
|
|
>
>
>
|
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
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
677
678
679
|
catch (e) {
showError(e);
}
}
_createTokenBlock (oToken) {
let xTokenBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
// token description
xTokenBlock.appendChild(this._createTokenDescr(oToken));
// subtokens
if (oToken.hasOwnProperty("lSubTokens")) {
let xSubBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_subblock"});
for (let oSubToken of oToken["lSubTokens"]) {
if (oSubToken["sValue"] != "") {
xSubBlock.appendChild(this._createTokenDescr(oSubToken));
}
}
xTokenBlock.appendChild(xSubBlock);
}
return xTokenBlock;
}
_createTokenDescr (oToken) {
try {
let xTokenDescr = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_descr"});
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
if (oToken.aLabels) {
if (oToken.aLabels.length < 2) {
// one morphology only
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem_inline", textContent: oToken.aLabels[0]}));
} else {
// several morphology
let xMorphList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
for (let sLabel of oToken.aLabels) {
xMorphList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
}
xTokenDescr.appendChild(xMorphList);
}
} else {
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem_inline", textContent: "étiquettes non décrites : [" + oToken.lMorph + "]" }));
}
return xTokenDescr;
}
catch (e) {
showError(e);
}
}
|