Commit 91b6d732 authored by Sylvain Coulange's avatar Sylvain Coulange
Browse files

passage à spacy v3 + ajout anglais

parent 5a3f2f0d
......@@ -21,6 +21,10 @@ from django.views.decorators.csrf import csrf_exempt
urlpatterns = [
path('admin/', admin.site.urls),
path('', home),
path('fr/', home),
path('en/', home),
path('zh/', home),
path('jp/', home),
path('runSpacy/', csrf_exempt(runSpacy))
]
......@@ -6,6 +6,9 @@ import MeCab
print("Chargement du modèle de français...")
nlpFr = spacy.load('fr_core_news_md')
print("OK")
print("Chargement du modèle d'anglais...")
nlpEn = spacy.load('en_core_web_md')
print("OK")
print("Chargement du modèle de mandarin...")
nlpZh = spacy.load('zh_core_web_md')
print("OK")
......@@ -13,6 +16,7 @@ print("Chargement du modèle de japonais...")
chasen = MeCab.Tagger("-Ochasen")
print("OK")
def home(request):
updateTimeStr = updateTime()
return render(request, 'coloriser.html', {'updateTime': updateTimeStr})
......@@ -24,6 +28,8 @@ def runSpacy(request):
if lang == "fr":
nlpText = nlpFr(text)
elif lang == "en":
nlpText = nlpEn(text)
elif lang == "zh":
nlpText = nlpZh(text)
elif lang == "jp":
......@@ -31,7 +37,29 @@ def runSpacy(request):
outText = []
if lang == "fr" or lang == "zh":
if lang in ["fr","en"]:
for token in nlpText:
tokenInfo = {
"text": token.text,
"lemma": token.lemma_,
"pos": token.pos_,
"tag": str(token.morph),
"dep": token.dep_,
"shape": token.shape_
}
print(tokenInfo)
outText.append(tokenInfo)
if token.whitespace_:
outText.append({
"text": token.whitespace_,
"lemma": "",
"pos": "SPACE",
"tag": "SPACE",
"dep": "",
"shape": ""
})
elif lang in ["zh"]:
for token in nlpText:
tokenInfo = {
"text": token.text,
......
// Liste des exceptions: écraser le résultat de Spacy par celui-ci.
var text2postag = {
"fr": {
"bonjour" : {"pos":"INTJ", "tag":""},
"bravo" : {"pos":"INTJ", "tag":""},
"aïe" : {"pos":"INTJ", "tag":""},
"ah" : {"pos":"INTJ", "tag":""},
"aah" : {"pos":"INTJ", "tag":""},
"aha" : {"pos":"INTJ", "tag":""},
"oh" : {"pos":"INTJ", "tag":""},
"zut" : {"pos":"INTJ", "tag":""},
}
}
// Écraser si mot seul dans la phrase :
// Ciel, Salut...
\ No newline at end of file
......@@ -15,6 +15,7 @@ async function runSpacy() {
var inText = document.getElementById('inText').value;
var lang = document.getElementById('choixLang').value;
console.log(lang)
// REMPLACEMENT DES \n PAR ¬ POUR MECAB (JP)
if(lang == "jp") inText = inText.replace(/\n/g,'¬')
......@@ -48,85 +49,104 @@ async function runSpacy() {
var stylesUnderline = "text-decoration: underline; text-decoration-thickness: 6px;";
for (i=0; i<data.outText.length; i++) {
var thisText = data.outText[i].text;
var thisPos = data.outText[i].pos;
var thisTag = data.outText[i].tag;
console.log(thisText, thisPos, thisTag)
if (Object.keys(text2postag).includes(lang) && Object.keys(text2postag[lang]).includes(thisText.toLowerCase())) {
thisPos = text2postag[lang][thisText.toLowerCase()].pos;
thisTag = text2postag[lang][thisText.toLowerCase()].tag;
}
if (lang=="jp") {
if (Object.keys(pos).includes(data.outText[i].pos + '' + data.outText[i].saibunrui1)) col = pos[data.outText[i].pos + '' + data.outText[i].saibunrui1].color;
if (Object.keys(pos).includes(thisPos + '' + data.outText[i].saibunrui1)) col = pos[thisPos + '' + data.outText[i].saibunrui1].color;
else {
col = "#cccccc"
console.log("MANQUE:",data.outText[i].pos + '' + data.outText[i].saibunrui1)
console.log("MANQUE:",thisPos + '' + data.outText[i].saibunrui1)
}
} else if (lang=="zh") {
if (Object.keys(pos).includes(data.outText[i].tag)) col = pos[data.outText[i].tag].color;
if (Object.keys(pos).includes(thisTag)) col = pos[thisTag].color;
else {
col = "#cccccc"
console.log("MANQUE:",data.outText[i].tag + ' ' + data.outText[i].pos)
console.log("MANQUE:",thisTag + ' ' + thisPos)
}
} else {
col = pos[data.outText[i].pos].color;
// console.log(thisPos)
// console.log(pos[thisPos])
col = pos[thisPos].color;
}
if (lang=="jp") var currentPos = data.outText[i].pos + '' + data.outText[i].saibunrui1;
else if (lang=="zh") var currentPos = data.outText[i].tag;
else var currentPos = data.outText[i].pos;
if (lang=="jp") var currentPos = thisPos + '' + data.outText[i].saibunrui1;
else if (lang=="zh") var currentPos = thisTag;
else var currentPos = thisPos;
// Traitement des tags
var tagdef = "";
if (lang == "fr") {
var taglist = Array.from(data.outText[i].tag.replace(/^\w+__/, '').split('|'))
if (lang == "fr" || lang == "en") {
var taglist = Array.from(thisTag.split('|'))
var tags = [];
taglist.forEach((tag) => {
if (tag in tags2def){
tags.push(tags2def[tag].toLowerCase())
} else {
if (tag in tags2def[lang]){
tags.push(tags2def[lang][tag].toLowerCase())
} else if (tag!="") {
tags.push(tag)
}
})
if (data.outText[i].tag == data.outText[i].pos) {
tagdef = pos[data.outText[i].pos]['def']
if (thisTag == thisPos) {
tagdef = pos[thisPos][lang]
} else if (tags.length>0) {
tagdef = pos[thisPos][lang] + ' : ' + tags.join(', ')
} else {
tagdef = pos[data.outText[i].pos]['def'] + ' : ' + tags.join(', ')
tagdef = pos[thisPos][lang]
}
} else if (lang == "zh") {
if (Object.keys(pos).includes(data.outText[i].tag)) tagdef = pos[data.outText[i].tag]['def']
else tagdef = data.outText[i].tag;
if (Object.keys(pos).includes(thisTag)) tagdef = pos[thisTag][lang]
else tagdef = thisTag;
} else if (lang == "jp") {
// console.log(data.outText[i].pos + '・' + data.outText[i].saibunrui1)
// if (Object.keys(pos).includes(data.outText[i].pos + '・' + data.outText[i].saibunrui1)) tagdef = pos[data.outText[i].pos + ' ' + data.outText[i].saibunrui1].def;
// else tagdef = data.outText[i].pos + ' ' + data.outText[i].saibunrui1
tagdef = data.outText[i].pos + ' ' + data.outText[i].saibunrui1 + ' ' + data.outText[i].saibunrui2;
// console.log(thisPos + '・' + data.outText[i].saibunrui1)
// if (Object.keys(pos).includes(thisPos + '・' + data.outText[i].saibunrui1)) tagdef = pos[thisPos + ' ' + data.outText[i].saibunrui1].def;
// else tagdef = thisPos + ' ' + data.outText[i].saibunrui1
tagdef = thisPos + ' ' + data.outText[i].saibunrui1 + ' ' + data.outText[i].saibunrui2;
}
// saut de ligne
sdl = data.outText[i].text.split(/[\n¬]+/);
sdl = thisText.split(/[\n¬]+/);
if (sdl.length>1) {
for (s=1; s<sdl.length; s++) {
result = result + "<br>";
}
} else if (data.outText[i].text == " ") {
} else if (thisText == " ") {
// ESPACE
result = result
+ "<span style='"+ stylesCommuns +"'> </span>";
} else if (data.outText[i].tag.slice(0,7)== "ADP_DET") {
} else if (thisText.toLowerCase() == "en" || thisText.toLowerCase() == "y" && thisPos == "PRON") {
// BICOLORES → soulignage
// déterminants prépositionnels (du des...)
result = result
+ '<span style="color:'+ pos["DET"].color +';'
+ stylesCommuns
+ stylesUnderline + 'text-decoration-color:' + pos["ADP"].color +'" '
+'title-data="'+ data.outText[i].tag +'" '
+'class="token pos'+ currentPos +'" '
+'>'+ data.outText[i].text + '</span>';
} else if (data.outText[i].text.toLowerCase() == "en" || data.outText[i].text.toLowerCase() == "y" && data.outText[i].pos == "PRON") {
// pronoms adverbiaux (en et y)
thisPos = currentPos = "PRONADV";
tagdef = pos[thisPos][lang]
result = result
+ '<span style="color:'+ pos["PRON"].color +';'
+ stylesCommuns
+ stylesUnderline + 'text-decoration-color:' + pos["ADV"].color +'" '
+'title-data="'+ data.outText[i].tag +'" '
+'title-data="'+ tagdef +'" '
+'class="token pos'+ currentPos +'" '
+'>'+ thisText + '</span>';
} else if (thisPos== "ADP" && ["du","au","aux"].includes(thisText)) {
// BICOLORES → soulignage
// déterminants prépositionnels (du des...)
thisPos = currentPos = "PREPDET";
tagdef = pos[thisPos][lang]
result = result
+ '<span style="color:'+ pos["DET"].color +';'
+ stylesCommuns
+ stylesUnderline + 'text-decoration-color:' + pos["ADP"].color +'" '
+'title-data="'+ tagdef +'" '
+'class="token pos'+ currentPos +'" '
+'>'+ data.outText[i].text + '</span>';
+'>'+ thisText + '</span>';
} else {
// tout le reste
result = result
......@@ -134,7 +154,7 @@ async function runSpacy() {
+ stylesCommuns +'" '
+'title-data="'+ tagdef +'" '
+'class="token pos'+ currentPos +'" '
+'>'+ data.outText[i].text + '</span>';
+'>'+ thisText + '</span>';
}
}
......@@ -235,9 +255,9 @@ var span = document.getElementsByClassName("close")[0];
function getPopUp() {
var outputContent = document.getElementById('outText').innerHTML;
var finalOutput = outputContent.replace(/#000;/g,'#fff;').replace(/ class="token tokenborder"/g, '').replace(/ title(-data)?=".*?"/g, '')
var finalOutput = outputContent.replace(/#000;/g,'#fff;').replace(/ class="token \w+ tokenborder"/g, '').replace(/ title(-data)?=".*?"/g, '')
var finalOutputWhite = outputContent.replace(/#fff;/g,'#000;').replace(/ class="token tokenborder"/g, '').replace(/ title(-data)?=".*?"/g, '')
var finalOutputWhite = outputContent.replace(/#fff;/g,'#000;').replace(/ class="token \w+ tokenborder"/g, '').replace(/ title(-data)?=".*?"/g, '')
// Insertion des résultats dans les div associées du popup
document.getElementById('pLienDiv').innerHTML = finalOutput;
......
// https://universaldependencies.org/u/pos/index.html
var pos = {
"ADJ": { "color":"#980086", "def":"Adjectif"},
"ADP": { "color":"#c00018", "def":"Préposition adverbiale"},
"ADV": { "color":"#3984c6", "def":"Adverbe"},
"AUX": { "color":"#eda01a", "def":"Auxiliaire"},
"CONJ": { "color":"#ffffff", "def":"Conjonction"},
"CCONJ": { "color":"#ffffff", "def":"Conjonction de coordination"},
"DET": { "color":"#f3eb20", "def":"Déterminant"},
"INTJ": { "color":"#8a9092", "def":"Interjection"},
"NOUN": { "color":"#00b54a", "def":"Nom"},
"NUM": { "color":"#f3eb20", "def":"Nombre"},
"PART": { "color":"#cccccc", "def":"Particule"},
"PRON": { "color":"#a56026", "def":"Pronom"},
"PROPN": { "color":"#a56026", "def":"Nom propre"},
"PUNCT": { "color":"#ffffff", "def":"Ponctuation"},
"SCONJ": { "color":"#ffffff", "def":"Conjonction de subordination"},
"SPACE": { "color":"#cccccc", "def":"Espace"},
"SYM": { "color":"#cccccc", "def":"Symbole"},
"VERB": { "color":"#eda01a", "def":"Verbe"},
"X・": { "color":"#cccccc", "def":"X"},
"col_base": { "color":"#555753", "def":""},
"ADJ": { "color":"#980086", "fr":"Adjectif", "en":"Adjective", "help": { "fr":"grand, belle, jolis, vert...", "en":"big, old, green, African, incomprehensible, first..."}},
"ADV": { "color":"#3984c6", "fr":"Adverbe", "en":"Adverb", "help": { "fr":"très, bien, exactement, demain, ensemble", "en":"very, well, exactly, tomorrow, up, where, here..."}},
"AUX": { "color":"#eda01a", "fr":"Auxiliaire", "en":"Auxiliary", "help": { "fr":"être/avoir/faire", "en":"has, is, will, was, got, should..."}},
"CONJ": { "color":"#ffffff", "fr":"Conjonction", "en":"Conjunction", "help": { "fr":"", "en":""}},
"CCONJ": { "color":"#ffffff", "fr":"Conjonction de coordination", "en":"Coordinating conjunction", "help": { "fr":"mais, où, et, donc, or, ni, car...", "en":"and, or, but..."}},
"DET": { "color":"#f3eb20", "fr":"Déterminant", "en":"Determiner", "help": { "fr":"le, la, les, mon, cette, quelles, auncun...", "en":"the, a, an, three, many..."}},
"INTJ": { "color":"#8a9092", "fr":"Interjection", "en":"Interjection", "help": { "fr":"bref, bon, enfin...", "en":"psst, ouch, bravo, hello..."}},
"NOUN": { "color":"#00b54a", "fr":"Nom", "en":"Noun", "help": { "fr":"montagne, nuages, sushi, bateau...", "en":"girl, tree, sushi, decision..."}},
"NUM": { "color":"#f3eb20", "fr":"Nombre", "en":"Numeral", "help": { "fr":"0, 1, 2, 11, soixante-dix-sept, IV...", "en":"0, 1, 2, 11, seventy-seven, K, IV..."}},
"PART": { "color":"#cccccc", "fr":"Particule", "en":"Particle", "help": { "fr":"", "en":"'s, ', not, n't, to..."}},
"ADP": { "color":"#c00018", "fr":"Préposition", "en":"Adposition", "help": { "fr":"pour, de, à, dans...", "en":"in, to, during..."}},
"PREPDET": { "color":"#c00018", "fr":"Déterminant prépositionnel", "en":"", "help": { "fr":"du, des, au, aux...", "en":""}},
"PRON": { "color":"#a56026", "fr":"Pronom", "en":"Pronoun", "help": { "fr":"je, tu, elle, ceux, me, qui...", "en":"I, you, she, myself, who, that, everybody, ours..."}},
"PRONADV": {"color":"#a56026", "fr":"Pronom adverbial", "en":"", "help": { "fr":"en, y", "en":""}},
"PROPN": { "color":"#00b54a", "fr":"Nom propre", "en":"Proper noun", "help": { "fr":"Pierre, ONU, Mexique...", "en":"Mary, John, London, NATO, HBO..."}},
"PUNCT": { "color":"#ffffff", "fr":"Ponctuation", "en":"Punctuation", "help": { "fr":"point, virgule, parenthèses...", "en":"Period, comma, parentheses..."}},
"SCONJ": { "color":"#ffffff", "fr":"Conjonction de subordination", "en":"Subordinating conjunction", "help": { "fr":"quand, parce que, avant que...", "en":"that, if, while..."}},
"SPACE": { "color":"#cccccc", "fr":"Espace", "en":"Space", "help": { "fr":"", "en":""}},
"SYM": { "color":"#cccccc", "fr":"Symbole", "en":"Symbol", "help": { "fr":"$, %, §, ©, ÷, =, <, :), ♥‿♥, 😝...", "en":"$, %, §, ©, ÷, =, <, :), ♥‿♥, 😝..."}},
"VERB": { "color":"#eda01a", "fr":"Verbe", "en":"Verb", "help": { "fr":"manger, mangerons, vois, allions...", "en":"run, eat, runs, ate, running, eating..."}},
"X": { "color":"#cccccc", "fr":"X", "en":"Other", "help": { "fr":"xxx, xfgh, jklw...", "en":"xxx, xfgh, jklw..."}},
"X・": { "color":"#cccccc", "fr":"X", "en":"X", "help": { "fr":"", "en":""}},
"col_base": { "color":"#555753", "fr":"", "en":"", "help": { "fr":"", "en":""}},
"名詞・代名詞" : { "color":"#a56026", "jp":"名詞 代名詞 (pronom)" },
"副詞・一般" : { "color":"#3984c6", "jp":"副詞 一般 (adverbe)" },
"副詞・助詞類接続" : { "color":"#3984c6", "jp":"副詞 助詞類接続 (adverbe à particule)" },
"名詞・副詞可能" : { "color":"#00b54a", "jp":"名詞 副詞可能 (nom adverbe)" },
"感動詞・" : { "color":"#8a9092", "jp":"感動詞 (interjection)" },
"その他・間投" : { "color":"#8a9092", "jp":"その他 間投 (autres interjections)" },
"フィラー・" : { "color":"#8a9092", "jp":"フィラー (filler)" },
"その他・間投" : { "color":"#8a9092", "def":"その他 間投 (autres interjections)" },
"フィラー・" : { "color":"#8a9092", "def":"フィラー (filler)" },
"副詞・一般" : { "color":"#3984c6", "def":"副詞 一般 (adverbe)" },
"副詞・助詞類接続" : { "color":"#3984c6", "def":"副詞 助詞類接続 (adverbe à particule)" },
"助動詞・" : { "color":"#eda01a", "def":"助動詞 (particule auxiliaire)" },
"助詞・副助詞" : { "color":"#f3eb20", "def":"助詞 副助詞 (particule adverbe)" },
"助詞・接続助詞" : { "color":"#f3eb20", "def":"助詞 接続助詞 (particule conjonctive)" },
"助詞・格助詞" : { "color":"#f3eb20", "def":"助詞 格助詞 (particule de cas)" },
"助詞・連体化" : { "color":"#f3eb20", "def":"助詞 連体化 (particule adjectivale)" },
"助詞・係助詞" : { "color":"#f3eb20", "def":"助詞 係助詞 (particule connective)" },
"助詞・副助詞/並立助詞/終助詞" : { "color":"#f3eb20", "def":"助詞 副助詞/並立助詞/終助詞 (particule divers)" },
"助詞・副詞化" : { "color":"#f3eb20", "def":"助詞 副詞化 (particule adverbiale)" },
"助詞・並立助詞" : { "color":"#f3eb20", "def":"助詞 並立助詞 (parallel marker)" },
"助詞・終助詞" : { "color":"#f3eb20", "def":"助詞 終助詞 (particule de fin de phrase)" },
"動詞・接尾" : { "color":"#eda01a", "def":"動詞 接尾 (suffix verbal)" },
"動詞・自立" : { "color":"#eda01a", "def":"動詞 自立 (racine verbale)" },
"動詞・非自立" : { "color":"#eda01a", "def":"動詞 非自立 (verbe dépendant)" },
"名詞・サ変接続" : { "color":"#00b54a", "def":"名詞 サ変接続 (nom sa-hen)" },
"名詞・ナイ形容詞語幹" : { "color":"#00b54a", "def":"名詞 ナイ形容詞語幹 (nom en -nai)" },
"名詞・一般" : { "color":"#00b54a", "def":"名詞 一般 (nom général)" },
"名詞・代名詞" : { "color":"#a56026", "def":"名詞 代名詞 (pronom)" },
"名詞・副詞可能" : { "color":"#00b54a", "def":"名詞 副詞可能 (nom adverbe)" },
"名詞・動詞非自立的" : { "color":"#00b54a", "def":"名詞 動詞非自立的 (nom verbe-dépendant)" },
"名詞・固有名詞" : { "color":"#00b54a", "def":"名詞 固有名詞 (nom propre)" },
"名詞・引用文字列" : { "color":"#00b54a", "def":"名詞 引用文字列 (nom de citation いわく)" },
"名詞・形容動詞語幹" : { "color":"#00b54a", "def":"名詞 形容動詞語幹 (nom adjectif)" },
"名詞・接尾" : { "color":"#00b54a", "def":"名詞 接尾 (suffixe nominal)" },
"名詞・接続詞的" : { "color":"#00b54a", "def":"名詞 接続詞的 (nom conjonctif「VS」、「対」、「兼」)" },
"名詞・数" : { "color":"#00b54a", "def":"名詞 数 (nom numéral)" },
"名詞・特殊" : { "color":"#00b54a", "def":"名詞 特殊 (nom spécial)" },
"名詞・非自立" : { "color":"#00b54a", "def":"名詞 非自立 (nom dépendant)" },
"形容詞・接尾" : { "color":"#980086", "def":"形容詞 接尾 (suffixe adjectival)" },
"形容詞・自立" : { "color":"#980086", "def":"形容詞 自立 (adjectif indépendant)" },
"形容詞・非自立" : { "color":"#980086", "def":"形容詞 非自立 (adjectif dépendant)" },
"感動詞・" : { "color":"#8a9092", "def":"感動詞 (interjection)" },
"接続詞・" : { "color":"#ffffff", "def":"接続詞 (conjonction)" },
"接続詞・並立助詞" : { "color":"#ffffff", "def":"接続詞 並立助詞 (conjonction parallèle)" },
"接続詞・副詞化" : { "color":"#ffffff", "def":"接続詞 副詞化 (conjonction adverbiale)" },
"接続詞・終助詞" : { "color":"#ffffff", "def":"接続詞 終助詞 (conjonction de fin de phrase)" },
"接頭詞・動詞接続" : { "color":"#ffffff", "def":"接頭詞 動詞接続 (préfixe verbal)" },
"接頭詞・名詞接続" : { "color":"#ffffff", "def":"接頭詞 名詞接続 (préfixe nominal)" },
"接頭詞・形容詞接続" : { "color":"#ffffff", "def":"接頭詞 形容詞接続 (préfixe adjectival)" },
"接頭詞・数接続" : { "color":"#ffffff", "def":"接頭詞 数接続 (préfixe numérique)" },
"記号・アルファベット" : { "color":"#cccccc", "def":"記号 アルファベット (lettre latine)" },
"記号・一般" : { "color":"#cccccc", "def":"記号 一般 (symbole général)" },
"記号・句点" : { "color":"#cccccc", "def":"記号 句点 (point)" },
"記号・括弧閉" : { "color":"#cccccc", "def":"記号 括弧閉 (parenthèse fermante)" },
"記号・括弧開" : { "color":"#cccccc", "def":"記号 括弧開 (parenthèse ouvrante)" },
"記号・空白" : { "color":"#cccccc", "def":"記号 空白 (espace)" },
"記号・読点" : { "color":"#cccccc", "def":"記号 読点 (virgule)" },
"連体詞・" : { "color":"#980086", "def":"連体詞 (adjectif prénominal)" },
"連体詞・係助詞" : { "color":"#980086", "def":"連体詞 係助詞" },
"連体詞・副助詞/並立助詞/終助詞" : { "color":"#980086", "def":"連体詞 副助詞/並立助詞/終助詞" },
"連体詞・特殊" : { "color":"#980086", "def":"連体詞 特殊" },
"形容詞・自立" : { "color":"#980086", "jp":"形容詞 自立 (adjectif indépendant)" },
"形容詞・非自立" : { "color":"#980086", "jp":"形容詞 非自立 (adjectif dépendant)" },
"連体詞・" : { "color":"#980086", "jp":"連体詞 (adjectif prénominal)" },
"形容詞・接尾" : { "color":"#980086", "jp":"形容詞 接尾 (suffixe adjectival)" },
"VA": { "color":"#eda01a", "def":"Predicative adjective"},
"VC": { "color":"#eda01a", "def":""},
"VE": { "color":"#eda01a", "def":"有 as the main verb"},
"VV": { "color":"#eda01a", "def":"Other verb"},
"NN": { "color":"#00b54a", "def":"Common noun"},
"NR": { "color":"#a56026", "def":"Proper noun"},
"NT": { "color":"#00b54a", "def":"Temporal noun"},
"FW": { "color":"#00b54a", "def":"Foreign words"},
"LC": { "color":"#c00018", "def":"Localizer"},
"PN": { "color":"#a56026", "def":"Pronoun"},
"DT": { "color":"#f3eb20", "def":"Determiner"},
"CD": { "color":"#f3eb20", "def":"Cardinal number "},
"OD": { "color":"#f3eb20", "def":"Ordinal number "},
"M": { "color":"#f3eb20", "def":"Measure word"},
"AD": { "color":"#3984c6", "def":"Adverb"},
"P": { "color":"#c00018", "def":"Preposition excl. 被 and 把"},
"LB": { "color":"#c00018", "def":"被 in long bei-const"},
"SB": { "color":"#c00018", "def":"被 in short bei-const"},
"BA": { "color":"#c00018", "def":"把 in ba-construction"},
"CC": { "color":"#ffffff", "def":"Coordinating conjunction"},
"CS": { "color":"#ffffff", "def":"Subordinating conjunction"},
"DEC": { "color":"#c00018", "def":"的 in a relative-clause"},
"DER": { "color":"#c00018", "def":"得 in V-de const. and V-de-R"},
"DEG": { "color":"#c00018", "def":"Associative 的"},
"DEV": { "color":"#c00018", "def":"地 before VP"},
"AS": { "color":"#eda01a", "def":"Aspect marker"},
"ETC": { "color":"#3984c6", "def":"For words 等, 等等"},
"SP": { "color":"#8a9092", "def":"Sentence-final particle"},
"MSP": { "color":"#8a9092", "def":"Other particle"},
"IJ": { "color":"#8a9092", "def":"Interjection"},
"ON": { "color":"#8a9092", "def":"Onomatopoeia"},
"JJ": { "color":"#cccccc", "def":"Other noun-modifier"},
"PU": { "color":"#cccccc", "def":"Punctuation"}
"連体詞・係助詞" : { "color":"#980086", "jp":"連体詞 係助詞" },
"連体詞・副助詞/並立助詞/終助詞" : { "color":"#980086", "jp":"連体詞 副助詞/並立助詞/終助詞" },
"連体詞・特殊" : { "color":"#980086", "jp":"連体詞 特殊" },
"接頭詞・形容詞接続" : { "color":"#ffffff", "jp":"接頭詞 形容詞接続 (préfixe adjectival)" },
"名詞・一般" : { "color":"#00b54a", "jp":"名詞 一般 (nom général)" },
"名詞・固有名詞" : { "color":"#00b54a", "jp":"名詞 固有名詞 (nom propre)" },
"名詞・引用文字列" : { "color":"#00b54a", "jp":"名詞 引用文字列 (nom de citation いわく)" },
"名詞・動詞非自立的" : { "color":"#00b54a", "jp":"名詞 動詞非自立的 (nom verbe-dépendant)" },
"名詞・非自立" : { "color":"#00b54a", "jp":"名詞 非自立 (nom dépendant)" },
"名詞・形容動詞語幹" : { "color":"#00b54a", "jp":"名詞 形容動詞語幹 (nom adjectif)" },
"名詞・接尾" : { "color":"#00b54a", "jp":"名詞 接尾 (suffixe nominal)" },
"名詞・特殊" : { "color":"#00b54a", "jp":"名詞 特殊 (nom spécial)" },
"名詞・数" : { "color":"#00b54a", "jp":"名詞 数 (nom numéral)" },
"名詞・接続詞的" : { "color":"#00b54a", "jp":"名詞 接続詞的 (nom conjonctif「VS」、「対」、「兼」)" },
"名詞・サ変接続" : { "color":"#00b54a", "jp":"名詞 サ変接続 (nom sa-hen)" },
"名詞・ナイ形容詞語幹" : { "color":"#00b54a", "jp":"名詞 ナイ形容詞語幹 (nom en -nai)" },
"接頭詞・名詞接続" : { "color":"#00b54a", "jp":"接頭詞 名詞接続 (préfixe nominal)" },
"接頭詞・数接続" : { "color":"#00b54a", "jp":"接頭詞 数接続 (préfixe numérique)" },
"助詞・副助詞" : { "color":"#f3eb20", "jp":"助詞 副助詞 (particule adverbe)" },
"助詞・接続助詞" : { "color":"#f3eb20", "jp":"助詞 接続助詞 (particule conjonctive)" },
"助詞・格助詞" : { "color":"#f3eb20", "jp":"助詞 格助詞 (particule de cas)" },
"助詞・連体化" : { "color":"#f3eb20", "jp":"助詞 連体化 (particule adjectivale)" },
"助詞・係助詞" : { "color":"#f3eb20", "jp":"助詞 係助詞 (particule connective)" },
"助詞・副助詞/並立助詞/終助詞" : { "color":"#f3eb20", "jp":"助詞 副助詞/並立助詞/終助詞 (particule divers)" },
"助詞・副詞化" : { "color":"#f3eb20", "jp":"助詞 副詞化 (particule adverbiale)" },
"助詞・並立助詞" : { "color":"#f3eb20", "jp":"助詞 並立助詞 (parallel marker)" },
"助詞・終助詞" : { "color":"#f3eb20", "jp":"助詞 終助詞 (particule de fin de phrase)" },
"助動詞・" : { "color":"#eda01a", "jp":"助動詞 (particule auxiliaire)" },
"動詞・自立" : { "color":"#eda01a", "jp":"動詞 自立 (racine verbale)" },
"動詞・非自立" : { "color":"#eda01a", "jp":"動詞 非自立 (verbe dépendant)" },
"接頭詞・動詞接続" : { "color":"#eda01a", "jp":"接頭詞 動詞接続 (préfixe verbal)" },
"動詞・接尾" : { "color":"#eda01a", "jp":"動詞 接尾 (suffix verbal)" },
"接続詞・" : { "color":"#ffffff", "jp":"接続詞 (conjonction)" },
"接続詞・並立助詞" : { "color":"#ffffff", "jp":"接続詞 並立助詞 (conjonction parallèle)" },
"接続詞・副詞化" : { "color":"#ffffff", "jp":"接続詞 副詞化 (conjonction adverbiale)" },
"接続詞・終助詞" : { "color":"#ffffff", "jp":"接続詞 終助詞 (conjonction de fin de phrase)" },
"記号・アルファベット" : { "color":"#cccccc", "jp":"記号 アルファベット (lettre latine)" },
"記号・一般" : { "color":"#cccccc", "jp":"記号 一般 (symbole général)" },
"記号・句点" : { "color":"#cccccc", "jp":"記号 句点 (point)" },
"記号・括弧閉" : { "color":"#cccccc", "jp":"記号 括弧閉 (parenthèse fermante)" },
"記号・括弧開" : { "color":"#cccccc", "jp":"記号 括弧開 (parenthèse ouvrante)" },
"記号・空白" : { "color":"#cccccc", "jp":"記号 空白 (espace)" },
"記号・読点" : { "color":"#cccccc", "jp":"記号 読点 (virgule)" },
"PN": { "color":"#a56026", "zh":"Pronoun"},
"AD": { "color":"#3984c6", "zh":"Adverb"},
"IJ": { "color":"#8a9092", "zh":"Interjection"},
"ON": { "color":"#8a9092", "zh":"Onomatopoeia"},
"VA": { "color":"#eda01a", "zh":"Predicative adjective"},
"NN": { "color":"#00b54a", "zh":"Common noun"},
"NR": { "color":"#00b54a", "zh":"Proper noun"},
"VV": { "color":"#eda01a", "zh":"Verb"},
"VC": { "color":"#eda01a", "zh":""},
"NT": { "color":"#00b54a", "zh":"Temporal noun"},
"FW": { "color":"#00b54a", "zh":"Foreign words"},
"VE": { "color":"#eda01a", "zh":"有 as the main verb"},
"AS": { "color":"#eda01a", "zh":"Aspect marker"},
"DT": { "color":"#f3eb20", "zh":"Determiner"},
"CD": { "color":"#f3eb20", "zh":"Cardinal number "},
"OD": { "color":"#f3eb20", "zh":"Ordinal number "},
"M": { "color":"#f3eb20", "zh":"Measure word"},
"LC": { "color":"#c00018", "zh":"Localizer"},
"CC": { "color":"#ffffff", "zh":"Coordinating conjunction"},
"CS": { "color":"#ffffff", "zh":"Subordinating conjunction"},
"P": { "color":"#c00018", "zh":"Preposition excl. 被 and 把"},
"LB": { "color":"#c00018", "zh":"被 in long bei-const"},
"SB": { "color":"#c00018", "zh":"被 in short bei-const"},
"BA": { "color":"#c00018", "zh":"把 in ba-construction"},
"DEC": { "color":"#c00018", "zh":"的 in a relative-clause"},
"DER": { "color":"#c00018", "zh":"得 in V-de const. and V-de-R"},
"DEG": { "color":"#c00018", "zh":"Associative 的"},
"DEV": { "color":"#c00018", "zh":"地 before VP"},
"SP": { "color":"#8a9092", "zh":"Sentence-final particle"},
"MSP": { "color":"#8a9092", "zh":"Other particle"},
"JJ": { "color":"#cccccc", "zh":"Other noun-modifier"},
"ETC": { "color":"#3984c6", "zh":"For words 等, 等等"},
"PU": { "color":"#cccccc", "zh":"Punctuation"}
}
// https://hayashibe.jp/tr/mecab/dictionary/ipadic
......
......@@ -18,19 +18,28 @@ function setCol(thispos, color) {
function togglePhon(cbid) { </