From 451d7bf0db58d42afc5a5086353558d227040dff Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 23 Nov 2020 03:41:54 +0100 Subject: Update everything --- Makefile | 2 +- README.md | 19 +- dicofr.py | 22 +- download/bz2toDB.py | 25 + download/download.py | 130 +++++ download/dump2msgp.py | 339 +++++++++++ download/msgPack2sqlite_msgPack.py | 52 ++ download/sectionList.py | 96 ++++ download/template.py | 1086 ++++++++++++++++++++++++++++++++++++ dump2msgp.py | 309 ---------- getSection.py | 129 ----- msgPack2sqlite_msgPack.py | 56 -- requirements.txt | 3 + sectionList.py | 96 ---- template.py | 1086 ------------------------------------ ui.py | 35 +- web.py | 16 + 17 files changed, 1798 insertions(+), 1703 deletions(-) create mode 100644 download/bz2toDB.py create mode 100755 download/download.py create mode 100644 download/dump2msgp.py create mode 100644 download/msgPack2sqlite_msgPack.py create mode 100644 download/sectionList.py create mode 100644 download/template.py delete mode 100644 dump2msgp.py delete mode 100644 getSection.py delete mode 100644 msgPack2sqlite_msgPack.py create mode 100644 requirements.txt delete mode 100644 sectionList.py delete mode 100644 template.py diff --git a/Makefile b/Makefile index 33a63fd..95d438f 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ DIR_BIN=/usr/bin/ install: mkdir -p ${DIR_INSTALL_PATH} - cp -u *.py wiktfr.sql ${DIR_INSTALL_PATH} + cp -u *.py *.sql ${DIR_INSTALL_PATH} cp -u dicofr.py ${DIR_BIN}/dicofr chmod +rw ${DIR_BIN}/dicofr diff --git a/README.md b/README.md index 6d9a041..dfa1c84 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ A bunch of **Python** scripts to transform wiktionary archive dump to MySQL data - With a simple CLI. - With a simple WUI, flask based. - Regex support. - - How to create the database -------------------------- @@ -32,12 +31,12 @@ This file is interesting for developers not for end users. It's a serialization of the internal used dictionary (python dictionary). ~~~shell -$ python dump2msgp.py -i frwiktionary-20200601-pages-articles.xml.bz2 +$ python dump2msgp.py -i frwiktionary-20200601-pages-articles.xml ~~~ Then, you can create the SQLite database file. ~~~shell -$ python msgPack2sqlite_msgPack.py -i dicofr.msgpk -o dicofr.db +$ python msgPack2sqlite_msgPack.py -i dicofr.msgpk ~~~ You can then use `dicofr.py` to search a word from the CLI or use the WUI with the command: @@ -93,6 +92,20 @@ juliennois juliens ~~~ +Or the WUI : + +~~~shell +$ python web.py +~~~ + +Why only french ? +----------------- + +Because that's the only language I'm able to tackle. +I can't verify anything about others languages. + +Feel free to contribute. + How to contribute ? ------------------- diff --git a/dicofr.py b/dicofr.py index 9bef7ac..7e6888d 100755 --- a/dicofr.py +++ b/dicofr.py @@ -1,16 +1,32 @@ #!/bin/env python +""" +# Main file. + +A program to retrieve the definition of a french word (in french). + +Maybe extended to other languages later. +""" + import sys import argparse import msgpack import sqlite3 from os.path import exists +import ui + + +debug = False + +if debug: + DIR_PATH = 'assets/' +else: + DIR_PATH = '/usr/share/dicofr/assets/' -DIR_PATH = '/usr/share/dicofr' sys.path.insert(-1, DIR_PATH) -import ui + dico = 'dicofr.db' @@ -102,8 +118,6 @@ if __name__ == '__main__': const=get_def_sql_reg, default=get_def_sql, help='search a definition using SQL regex, ' '_ to match a letter, %% to match a group of letters') - parser.add_argument('-w', '--wordlist', dest='wordList', - action='store_const', default='list_word.msgpack') parser.add_argument('-m', '--matching', dest='matching', action='store_true', help='search the french words that match the regex') parser.add_argument('word', metavar='PATTERN', type=str, diff --git a/download/bz2toDB.py b/download/bz2toDB.py new file mode 100644 index 0000000..1fddd85 --- /dev/null +++ b/download/bz2toDB.py @@ -0,0 +1,25 @@ +import bz2 +import sys + + +def unbz2(file): + decomp = bz2.BZ2Decompressor() + buf = b'' + for c in file: + buf += decomp.decompress(c) + + while b'\n' in buf: + i = buf.index(b'\n') + if i + 1 < len(buf): + ret = buf[:i + 1] + buf = buf[i + 1:] + yield ret.decode("utf-8") + else: + yield buf + buf = b'' + + +with open('./wiktionary_dump.xml.bz2', 'rb') as f: + it = iter(lambda: f.read(32768), b'') + for a in unbz2(it): + print(a, end='') diff --git a/download/download.py b/download/download.py new file mode 100755 index 0000000..a941b90 --- /dev/null +++ b/download/download.py @@ -0,0 +1,130 @@ +import argparse +import sys +import urllib.request +import dump2msgp +import msgPack2sqlite_msgPack +import subprocess + +from os.path import exists + + +URL_DUMP = "https://dumps.wikimedia.org/frwiktionary/latest/frwiktionary-latest-pages-meta-current.xml.bz2" + + +def unbz2(file): + decomp = bz2.BZ2Decompressor() + buf = b'' + for c in file: + buf += decomp.decompress(c) + + while b'\n' in buf: + i = buf.index(b'\n') + if i + 1 < len(buf): + ret = buf[:i + 1] + buf = buf[i + 1:] + yield ret.decode("utf-8") + else: + yield buf.decode("utf-8") + buf = b'' + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Download and create the database') + parser.add_argument('-o', '--out', dest='outputF', action='store', + help='the output, the database file', + default='dicofr.db') + parser.add_argument('-i', '--in', dest='dumpF', action='store', + help='the input dump file\'s filename', + default='') + parser.add_argument('-d', '--download', dest='download', action='store_true', + help='to download the lastest dump') + + arg = parser.parse_args() + + download = True + + if download and arg.dumpF: + print("Incompatible options '-i' and '-d'.") + exit(1) + elif download: + arg.dumpF = URL_DUMP[URL_DUMP.rindex('/') + 1:] + + if not arg.dumpF or not arg.dumpF.endswith('bz2'): + print('A bz2 dump file filename needed', file=sys.stderr) + exit(-1) + + if exists(arg.dumpF) and download: + print(f"{arg.dumpF} exists. Force downloading ? (y/N)") + answer = input('> ') + if answer.lower()[0] != 'y': + download = False + + if download: + print(f"Downloading the dump ({arg.dumpF})\nIt should take some time") + urllib.request.urlretrieve(URL_DUMP, arg.dumpF) + + if not exists(arg.dumpF): + print('Download failed.\nExiting.', file=sys.stderr) + exit(-2) + + decompress = False + + try: + print("Trying the bzip2 command") + assert(subprocess.call(['bzip2', '-d', arg.dumpF]) == 0) + decompress = True + except: + print("The command “bzip” doesn't exists, or doesn't work as intended") + print("Fallback to Python bz2 module decompressor") + + # Decompression using bzip2 + if not decompress: + try: + import bz2 + with open(arg.dumpF, 'rb') as f: + it = iter(lambda: f.read(2**16), b'') + + output_fn = arg.dumpF[:-4] + + with open(output_fn, 'wb') as fout: + dcomp = bz2.BZ2Decompressor() + for chunk in it: + datal = len(chunk) + data = dcomp.decompress(chunk) + fout.write(data) + decompress = True + except: + print("Python bz2 module decompressor failed, maybe you don't have any space available") + print("Fallback to on the fly decompressor (RAM will be needed)") + + if not decompress: + try: + # On the fly Decompression + with open(arg.dumpF, 'rb') as f: + it = iter(lambda: f.read(2**16), b'') + print("Data extraction on the fly") + res = dump2msgp.extractAll(unbz2(it), "error.log", False) + msgPack2sqlite_msgPack.writeDB(arg.outputF, res) + print(f"Database { arg.outputF } created ! 👏 🎉") + except: + print("Error: Can't extract the dump file") + print("Exiting (-1)") + exit(-1) + + print(f"Removing temporary files") + os.remove(arg.dumpF) + else: + try: + output_fn = arg.dumpF[:-4] + with open(output_fn, 'r') as f: + print("Create the database") + res = dump2msgp.extractAll(f, "error.log", False) + msgPack2sqlite_msgPack.writeDB(arg.outputF, res) + print(f"Database { arg.outputF } created ! 👏 🎉") + except: + print("Failed to extract database") + print(("Exiting (-3)") + exit(-3) + + print(f"Removing temporary files") + os.remove(output_fn) diff --git a/download/dump2msgp.py b/download/dump2msgp.py new file mode 100644 index 0000000..70b483c --- /dev/null +++ b/download/dump2msgp.py @@ -0,0 +1,339 @@ +import tempfile as tmp +import re +import sys +import msgpack +import argparse + +from sectionList import listInfoSection +from template import template + + +""" + +Extract words from the Wiktionnary archive + +""" + +DEFAULT_OUTPUT = 'dicofr.msgpk' + + +template_second = ['link', 'bd', 'pc', 'nom w pc', 'w', 'smcp', 'lien', 'ws', + 'in', 'siècle2', 'fchim', 'nobr', 'wp', 'r', + 'clé de tri', 'contexte', 'emploi', 'l', 'polytonique', + 'pron-API', 'registre', 'scmp', 'siècle', 'x', + ] + + +template_second_lambda_trd = { + 'refnec': (lambda x: '(Référence nécessaire : ' + x + ')'), + 'refnéc': (lambda x: '(Référence nécessaire : ' + x + ')'), +} + +template_second_lambda_snd = { + 'term': (lambda x: '(' + x.title() + ')'), + 'terme': (lambda x: '(' + x.title() + ')'), + 'ex': (lambda x: '^{' + x if x else 'e' + '}'), + 'exp': (lambda x: '^{' + x if x else 'e' + '}'), + 'e': (lambda x: '^{' + x if x else 'e' + '}'), + 'er': (lambda x: '^{' + x if x else 'er' + '}'), + 'ère': (lambda x: '^{' + x if x else 'ère' + '}'), + 'ème': (lambda x: '^{' + x if x else 'ème' + '}'), + 'Ier': (lambda x: '^{' + x if x else 'Ier' + '}'), + 'III': (lambda x: '^{' + x if x else 'III' + '}'), + 'small': (lambda x: '_{' + x if x else '' + '}'), + 'indice': (lambda x: '_{' + x if x else '' + '}'), + 'graphie': (lambda x: '«' + x if x else '»'), + 'petites capitales': (lambda x: x.upper()), + 'isbn': (lambda x: 'cf. ISBN ' + x), + 'OCLC': (lambda x: 'cf. OCLC ' + x), + 'variante de': (lambda x: 'Variante de ' + x), + 'variante de': (lambda x: 'Variante de ' + x), + 'variante ortho de': (lambda x: 'Variante orthographique de ' + x), + 'variante ortho de': (lambda x: 'Variante orthographique de ' + x), + 'variante ortho de': (lambda x: 'Variante orthographique de ' + x), + 'variante orthographique de': (lambda x: 'Variante orthographique de ' + x), + 'sic !': (lambda x: '^{sic ' + x + '}'), + 'sic': (lambda x: '^{sic ' + x + '}'), + 'incise': (lambda x: '_' + x + '_'), + 'n°': (lambda x: 'n°' + x), + 'superlatif de': (lambda x: 'Superlatif de' + x), + 'vérifier': (lambda x: '(À vérifier : ' + x + ')'), +} + +dictMatch = {x['match']: i for (i, x) in enumerate(listInfoSection)} + +interdit = " :" + + +def transclusion(trans, info, errorF): + trans = trans[2:-2] + + while '{{' in trans: + l0 = trans.rfind('{{') + l1 = trans.find('}}', l0) + if l1 == -1: + break + else: + l1 += 2 + t = trans[l0:l1] + t = transclusion(t, info, errorF) + trans = trans[:l0] + t + trans[l1:] + + s = list(map(lambda x: x.strip(), trans.split('|'))) + if s[0] in template: + return template[s[0]] + + if s[0].lower() in template_second: + return s[1] if len(s) > 1 else info['mot'] + + if s[0].lower().startswith('citation'): + cit = s[0].split('/') + if len(cit) == 4: + return 'Par ' + cit[1] + ', ' + cit[2] + ', ' + cit[3] + if len(cit) == 3: + return 'Par ' + cit[1] + ', ' + cit[2] + if len(cit) == 5: + return cit[1] + '/' + cit[2] + '/' + cit[3] + ', ' + cit[4] + if len(cit) <= 2: + return '' + else: + return '/'.join(cit[1:]) + + if s[0].lower() in template_second_lambda_snd: + return template_second_lambda_snd[s[0].lower()](s[1] if len(s) > 1 else '') + + if s[0].lower() in template_second_lambda_trd: + return template_second_lambda_trd[s[0].lower()](s[2] if len(s) > 2 else '') + + if errorF: + with open(errorF, 'a') as err: + print(s[0], file=err) + print("Incompréhension de la transclusion {} du mot {}".format(trans, + info['mot']), file=err) + return '' + + +def extract(f, w, errorF): + infoFin = [] + + toRead = True + goBack = 0 + + while toRead: + toRead = False + + info = {'mot': w, + 'cat-gram': None, + 'def': [], + 'API': None, + 'infos': [], + 'genre': '', + 'accord': None} + + # State 0 // Initialisation ! + while line := f.readline(): + + if line.startswith('=== ') or line.startswith('==={'): + if re.match('^=== *{{ *S\\|([^|]+)|.*$', line): + try: + r = re.match('^=== *{{ *S\\|([^|]+)|.*$', line) + r = r.groups() + nat = r[0].strip() + if nat in dictMatch.keys(): + info['cat-gram'] = nat + toRead = True + break + except Exception as e: + if errorF: + with open(errorF, 'a') as err: + print("^[1] Problème à l'initialisation du mot {mot}: {e}", file=err) + print(f'line: [{line}]: {e}', file=err) + e = sys.exc_info()[0] + print("Erreur :", e, file=err) + + if not toRead: + break + + # State 1 + while line := f.readline(): + if line.startswith('{{fr-'): + e = line.find('}}') + if e == -1: + continue + ex = line[:e] + try: + infos = list(map(lambda x: x.strip(), ex.split('|'))) + info['infos'] = infos + info['accord'] = infos[0] + if len(infos) > 1: + info['API'] = infos[1] + except e: + err = sys.exc_info()[0] + print(ex) + print("Erreur :", e) + print("Erreur :", err) + if line.rstrip().startswith("'''"): + if '{{pron' in line: + p0 = line.find('{{pron') + p1 = line.find('}}', p0) + if p1 > 0: + p1 += 2 + p = line[p0:p1] + p = p.split('|') + info['API'] = p[1] + if '{{m}}' in line: + info['genre'] = 'mas' + elif '{{f}}' in line: + info['genre'] = 'fem' + + if line.startswith('# '): + info['def'].append({'def': wikiToMd(line[2:], info, errorF)}) + elif line.startswith('#* '): + if not info['def']: + with open('wiki_err.log', 'a') as err: + print("Exemple sans définition pour le mot {}".format( + info['mot']), file=err) + elif 'ex' in info['def'][-1]: + info['def'][-1]['ex'].append(wikiToMd(line[3:], info, errorF)) + else: + info['def'][-1]['ex'] = [wikiToMd(line[3:], info, errorF)] + elif line.startswith('#') and not line.startswith('##'): + info['def'].append({'def': wikiToMd(line[1:], info, errorF)}) + if line.startswith('==='): + goBack = len(line) + break + if goBack: + f.seek(f.tell() - goBack) + goBack = 0 + toRead = True + infoFin.append(info) + + return infoFin + + +def wikiToMd(line, info, errorF): + line = line.strip() + # 3 Étapes: + # - Links [...] + # - Style ''ita'' / '''bold''' + # - Template / Transclusion {{info}} = (Informatique) + + # Template + while '{{' in line: + l0 = line.rfind('{{') + l1 = line.find('}}', l0) + if l1 == -1: + break + else: + l1 += 2 + trans = line[l0:l1] + trans = transclusion(trans, info, errorF) + line = line[:l0] + trans + line[l1:] + + # Links ! + while '[[' in line: + link0 = line.rfind('[[') + link1 = line.find(']]', link0) + if link1 == -1: + break + else: + link1 += 2 + + link = line[link0:link1] + link = link[2:-2].split('|') + line = line[:link0] + (link[1] if len(link) > 1 else link[0]) + line[link1:] + + # Style + line = line.replace("'''", '*').replace("''", '') + + return line + + +def extractAll(f, errorF, ignore): + title = "" + isFr = False + hasForbidden = False + hasText = False + tf = None + + dict_ = dict() + + for line in f: + if "" in line and tf: + tf.seek(0) + i = extract(tf, title, errorF) + + dict_[title] = i + tf.close() + + tf = None + hasForbidden = False + hasText = False + isFr = False + title = "" + elif "" in line: + tf = None + hasForbidden = False + hasText = False + isFr = False + title = "" + + if "" in line: + title = line[line.find('>') + 1:] + title = title[:title.find('<')] + + for c in interdit: + if c in title: + hasForbidden = True + if not hasForbidden and "<text bytes=\"" in line and "\" xml:space=\"preserve\">" in line: + hasText = True + if not hasForbidden and "== {{langue|fr}}" in line and hasText: + isFr = True + if tf: + if not ignore: + if errorF: + with open(errorF, 'a') as err: + print(f"{title}: Erreur tf encore ouvert !", + file=err) + else: + print(f"{title}: Erreur tf encore ouvert !") + tf.seek(0) + while line2 := tf.readline(): + print(line2, end='') + print(line) + + exit(-1) + else: + tf = tmp.NamedTemporaryFile(mode="w+t") + elif not hasForbidden and "== {{langue|" in line: + isFr = False + if not hasForbidden and isFr and tf: + tf.write(line) + + return dict_ + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='wiktionary dump to msgpack') + parser.add_argument('-o', '--out', dest='outputF', action='store_const', + const=DEFAULT_OUTPUT, default=DEFAULT_OUTPUT, + help='the output filename') + parser.add_argument('-i', '--input', dest='inputF', action='store', + help='the input filename, a dump of witionary') + parser.add_argument('-e', '--error', dest='errorF', action='store', + help='the filename to log errors') + parser.add_argument('--ignore', dest='ignoreError', action='store_true', + help='the filename to log errors') + + arg = parser.parse_args() + + if arg.inputF is None: + print('A wiktionary dump is needed', file=sys.stderr) + exit(-1) + + with open(arg.inputF, 'r') as f: + res = extractAll(f, arg.errorF, arg.ignoreError) + + with open(arg.outputF, 'wb') as f: + to_w = msgpack.packb(res) + f.write(to_w) diff --git a/download/msgPack2sqlite_msgPack.py b/download/msgPack2sqlite_msgPack.py new file mode 100644 index 0000000..38d34cd --- /dev/null +++ b/download/msgPack2sqlite_msgPack.py @@ -0,0 +1,52 @@ +import msgpack +import sys + +import sqlite3 +import argparse + + +def writeDB(outputF, data): + with sqlite3.connect(outputF) as con: + cur = con.cursor() + cur.execute('''CREATE TABLE IF NOT EXISTS entry ( + word TEXT, + cat_gram TEXT, + API TEXT, + infos TEXT, + genre TEXT, + accord TEXT, + defs BLOG, + ID INTEGER PRIMARY KEY)''') + con.commit() + + for w, listW in data.items(): + for word in listW: + data = (w, word['cat-gram'], word['API'], "\t".join(word['infos']), + word['genre'], word['accord'], + msgpack.packb(word['def'])) + cur.execute('''INSERT INTO entry (word, cat_gram, API, infos, + genre, accord, defs) VALUES (?, ?, ?, ?, ?, ?, ?)''', data) + con.commit() + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='wiktionary dump msgpack ' + 'to SQLite database file') + parser.add_argument('-o', '--out', dest='outputF', action='store', + help='the output filename') + parser.add_argument('-i', '--input', dest='inputF', action='store', + help='the input filename, a dump of witionary') + + arg = parser.parse_args() + + if arg.inputF is None: + print('Error input file needed', file=sys.stderr) + if arg.outputF is None: + print('Error output file needed', file=sys.stderr) + + with open(arg.inputF, 'rb') as f: + r = f.read() + + d = p = msgpack.unpackb(r, raw=False) + del r + writeDB(arg.outputF, d) diff --git a/download/sectionList.py b/download/sectionList.py new file mode 100644 index 0000000..68dd657 --- /dev/null +++ b/download/sectionList.py @@ -0,0 +1,96 @@ + +listInfoSection = [ + {'type': 'adjectif', 'match': 'adj', 'o': 'adjectif'}, + {'type': 'adjectif', 'match': 'adjectif', 'o': 'adjectif'}, + {'type': 'adjectif', 'match': 'adj-dém', 'o': 'adjectif démonstratif'}, + {'type': 'adjectif', 'match': 'adjectif démonstratif', 'o': 'adjectif démonstratif'}, + {'type': 'adjectif', 'match': 'adjectif exclamatif', 'o': 'adjectif exclamatif'}, + {'type': 'adjectif', 'match': 'adjectif indéfini', 'o': 'adjectif indéfini'}, + {'type': 'adjectif', 'match': 'adjectif interrogatif', 'o': 'adjectif interrogatif'}, + {'type': 'adjectif', 'match': 'adjectif numéral', 'o': 'adjectif numéral'}, + {'type': 'adjectif', 'match': 'adjectif possessif', 'o': 'adjectif possessif'}, + {'type': 'adjectif', 'match': 'adjectif relatif', 'o': 'adjectif relatif'}, + + {'type': 'adverbe', 'match': 'adv', 'o': 'adverbe'}, + {'type': 'adverbe', 'match': 'adverbe', 'o': 'adverbe'}, + {'type': 'adverbe', 'match': 'adverbe interrogatif', 'o': 'adverbe interrogatif'}, + {'type': 'adverbe', 'match': 'adverbe relatif', 'o': 'adverbe relatif'}, + + {'type': 'article', 'match': 'article', 'o': 'article'}, + {'type': 'article', 'match': 'article défini', 'o': 'article défini'}, + {'type': 'article', 'match': 'article indéfini', 'o': 'article indéfini'}, + {'type': 'article', 'match': 'article partitif', 'o': 'article partitif'}, + + {'type': 'conjonction', 'match': 'conjonction', 'o': 'conjonction'}, + {'type': 'conjonction', 'match': 'conjonction de coordination', 'o': 'conjonction de coordination'}, + + + {'type': 'erreur', 'match': 'erreur', 'o': 'faute courante'}, + {'type': 'erreur', 'match': 'faute', 'o': 'faute courante'}, + + {'type': 'interjection', 'match': 'interj', 'o': 'interjection'}, + {'type': 'interjection', 'match': 'interjection', 'o': 'interjection'}, + + {'type': 'interjection', 'match': 'interjection', 'o': 'interjection'}, + + {'type': 'locuton nominale', 'match': 'loc-phr', 'o': 'locution nominale'}, + {'type': 'locuton nominale', 'match': 'locution', 'o': 'locution nominale'}, + {'type': 'locuton nominale', 'match': 'locution nominale', 'o': 'locution nominale'}, + {'type': 'locuton nominale', 'match': 'locution phrase', 'o': 'locution nominale'}, + {'type': 'locuton nominale', 'match': 'locution-phrase', 'o': 'locution nominale'}, + + {'type': 'nom', 'match': 'nom', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom1', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom2', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom3', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom4', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom5', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom6', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom7', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom8', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom9', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom10', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom11', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom12', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom13', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom14', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom15', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom16', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom17', 'o': 'nom'}, + {'type': 'nom', 'match': 'nom commun', 'o': 'nom'}, + {'type': 'nom', 'match': 'substantif', 'o': 'substantif'}, + + + {'type': 'nom de famille', 'match': 'nom de famille', 'o': 'nom de famille'}, + {'type': 'nom de famille', 'match': 'nom de famille anglais', 'o': 'nom de famille'}, + {'type': 'nom de famille', 'match': 'nom-fam', 'o': 'nom de famille'}, + {'type': 'nom de famille', 'match': 'nom-pr', 'o': 'nom de famille'}, + {'type': 'nom de famille', 'match': 'nom-propre', 'o': 'nom de famille'}, + {'type': 'nom de famille', 'match': 'nom pr', 'o': 'nom de famille'}, + {'type': 'nom de famille', 'match': 'nom propre', 'o': 'nom de famille'}, + {'type': 'nom scientifique', 'match': 'nom scientifique', 'o': 'nom scientifique'}, + {'type': 'particule', 'match': 'particule', 'o': 'particule'}, + {'type': 'nom de famille', 'match': 'patronyme', 'o': 'nom de famille'}, + {'type': 'préfixe', 'match': 'préfixe', 'o': 'préfixe'}, + {'type': 'suffixe', 'match': 'suffixe', 'o': 'suffixe'}, + {'type': 'prénom', 'match': 'prénom', 'o': 'prénom'}, + + {'type': 'onomatopée', 'match': 'onomatopée', 'o': 'onomatopée'}, + {'type': 'onomatopée', 'match': 'onom', 'o': 'onomatopée'}, + + {'type': 'préposition', 'match': 'prép', 'o': 'préposition'}, + {'type': 'préposition', 'match': 'préposition', 'o': 'préposition'}, + + {'type': 'pronom', 'match': 'pronom', 'o': 'pronom'}, + {'type': 'pronom', 'match': 'pronom démonstratif', 'o': 'pronom démonstratif'}, + {'type': 'pronom', 'match': 'pronom indéfini', 'o': 'pronom indéfini'}, + {'type': 'pronom', 'match': 'pronom interrogatif', 'o': 'pronom interrogatif'}, + {'type': 'pronom', 'match': 'pronom personnel', 'o': 'pronom personnel'}, + {'type': 'pronom', 'match': 'pronom possessif', 'o': 'pronom possessif'}, + {'type': 'pronom', 'match': 'pronom relatif', 'o': 'pronom relatif'}, + + {'type': 'verbe', 'match': 'verb', 'o': 'verbe'}, + {'type': 'verbe', 'match': 'verbe', 'o': 'verbe'}, + {'type': 'verbe', 'match': 'verbe pronominal', 'o': 'verbe pronominal'} +] + diff --git a/download/template.py b/download/template.py new file mode 100644 index 0000000..fa0394a --- /dev/null +++ b/download/template.py @@ -0,0 +1,1086 @@ + +""" + +File of template. + +To deal with Wikicode format. + +""" + +template = {'info': '(Informatique)', + 'informatique': '(Informatique)', + 'regex': '(Regex)', + 'mathématiques': '(Mathématiques)', + 'paléographie': '(Paléographie)', + 'math': '(Mathématiques)', + 'statistiques': '(Statistiques)', + 'stat': '(Statistiques)', + 'géostatistique': '(Géostatistiques)', + 'montagnes': '(Géostatistiques)', + 'géostatistiques': '(Géostatistiques)', + 'départements': '(Géostatistiques)', + 'morphologie végétale': '(Morphologie végétale)', + 'mot-valise': '(Mot-valise)', + 'déserts': '(Géostatistiques)', + 'typog': '(Typographie)', + 'logi': '(Logique)', + 'logique': '(Logique)', + 'ironique': '(Ironique)', + 'iron': '(Ironique)', + 'ironie': '(Ironique)', + 'linguistique': '(Linguistique)', + 'métaplasmes': '(Linguistique)', + 'vieilli': '(Vieilli)', + 'vieux': '(Vieilli)', + 'obsolète': '(Désuet)', + 'désuet': '(Désuet)', + 'familier': '(Familier)', + 'très familier': '(Très amilier)', + 'chiromancie': '(Chiromancie)', + 'climatologie': '(Climatologie)', + 'cnidaires': '(Zoologie)', + 'singes': '(Zoologie)', + 'quagga': '(Zoologie)', + 'argot': '(Familier)', + 'argot internet': '(1337)', + 'argot Internet': '(1337)', + 'argot policier': '(Argot policier)', + 'argot militaire': '(Argot militaire)', + 'argot poilu': '(Argot militaire)', + 'argot polytechnicien': '(Argot de l\'X)', + 'argot scolaire': '(Argot scolaire)', + 'argot typographes': '(Argot de typographes)', + 'argot voleurs': '(Argot)', + 'jeux vidéo': 'Jeux vidéo', + 'internet': '(Internet)', + 'Internet': '(Internet)', + 'vulgaire': '(Vulgaire)', + 'vulg': '(Vulgaire)', + 'popu': '(Populaire)', + 'injur': '(Injurieux)', + 'insultes': '(Injurieux)', + 'intelligence artificielle': '(IA)', + 'interjection': '(Interjection)', + 'soutenu': '(Soutenu)', + 'sout': '(Soutenu)', + 'régio': '(Régionalisme)', + 'régional': '(Régionalisme)', + 'régionalisme': '(Régionalisme)', + 'créatures': '(Mythologie)', + 'stéréotype': '(Stéréotype)', + 'divinités': '(Mythologie)', + 'mythol': '(Mythologie)', + 'stéréochimie': '(Stéréochimie)', + 'formule chimique': '(Chimie)', + 'chimie': '(Chimie)', + 'substance': '(Chimie)', + 'substances': '(Chimie)', + 'biochimie': '(Biohimie)', + 'bioch': '(Biohimie)', + 'enzymes': '(Biochimie)', + 'thérapies': '(Thérapies)', + 'cours d’eau': '(Géographie)', + 'plans d\'eau': '(Géographie)', + 'jeu de go': '(Jeu de go)', + 'mythologie grecque': '(Anthroponyme)', + 'jazz': '(Musique)', + 'jeux': '(Jeux)', + 'musiques': '(Musique)', + 'musique': '(Musique)', + 'musiciens': '(Musique)', + 'musi': '(Musique)', + 'pêche': '(Pêche)', + 'pêch': '(Pêche)', + 'hist': '(Histoire)', + 'histologie': '(Histoire)', + 'histoire': '(Histoire)', + 'anciennes divisions': '(Histoire)', + 'anciennes localités': '(Histoire)', + 'téléphonie': '(Téléphonie)', + 'télécom': '(Télécommunications)', + 'télécoms': '(Télécommunications)', + 'télécommunications': '(Télécommunications)', + 'comm': '(Commerce)', + 'commerce': '(Commerce)', + 'commerces': '(Commerce)', + 'e-commerce': '(E-commerce)', + 'maçonnerie': '(Maçonnerie)', + 'maçon': '(Maçonnerie)', + 'architecture': '(Architecture)', + 'architecture des ordinateurs‎': '(Architecture des ordinateurs)', + 'architecture des ordinateurs': '(Architecture des ordinateurs)', + 'archi': '(Architecture)', + 'technique': '(Technique)', + 'tech': '(Technique)', + 'meubres': '(Mobilier)', + 'mobilier': '(Mobilier)', + 'automatique': '(Automatique)', + 'automo': '(Automobile)', + 'auto': '(Automobile)', + 'automobile': '(Automobile)', + 'véhicules': '(Véhicules)', + 'véhicule': '(Véhicules)', + 'voitures': '(Véhicules)', + 'anatomie': '(Anatomie)', + 'muscles': '(Anatomie)', + 'muscle': '(Anatomie)', + 'anat': '(Anatomie)', + 'un os': '(Anatomie)', + 'squelette': '(Anatomie)', + 'musculation': '(Musculation)', + 'justice': '(Justice)', + 'échecs': '(Échecs)', + 'théâtre': '(Théâtre)', + 'théât': '(Théâtre)', + 'audiovi': '(Audiovisuel)', + 'audiovisuel': '(Audiovisuel)', + 'minéralogie': '(Minéralogie)', + 'minéraux': '(Minéralogie)', + 'minér': '(Minéralogie)', + 'Mme': 'Mme', + 'moderne': '(Moderne)', + 'genres littéraires': '(Littéraire)', + 'genres musicaux': '(Musique)', + 'poét': '(Littéraire Poétique)', + 'poétique': '(Littéraire Poétique)', + 'poés': '(Littéraire Poétique)', + 'points cardinaux': '(Géographie)', + 'poires': '(Botanique)', + 'prunes': '(Botanique)', + 'pommes': '(Botanique)', + 'poésie': '(Littéraire Poétique)', + 'didactique': '(Didactique)', + 'didact': '(Didactique)', + 'néol': '(Néologisme)', + 'néologisme': '(Néologisme)', + 'archaïsme': '(Archaïsme)', + 'roches': '(Pétrographie)', + 'wiki': '(jargon des Wikis)', + 'localités': '(Géographie)', + 'région': '(Géographie)', + 'régions': '(Géographie)', + 'géologie': '(Géologie)', + 'géol': '(Géologie)', + 'géométrie': '(Géométrie)', + 'géomatique': '(Géomatique)', + 'géophysique': '(Géophysique)', + 'géom': '(Géométrie)', + 'rugby': '(Rugby)', + 'tennis': '(Tennis)', + 'tennis de table': '(Tennis de table)', + 'sport': '(Sport)', + 'volley': '(Sport)', + 'triathlon': '(Triathlon)', + 'sportifs': '(Sport)', + 'sports': '(Sport)', + 'patinage': '(Patinage)', + 'roller': '(Patinage)', + 'pâtisserie': '(Pâtisserie)', + 'pâtisseries': '(Pâtisserie)', + 'ciné': '(Cinéma)', + 'cinéma': '(Cinéma)', + 'cirque': '(Cirque)', + 'philo': '(Philosophie)', + 'philosophie': '(Philosophie)', + 'psychologie': '(Psychologie)', + 'psychanalyse': '(Psychanalyse)', + 'psychia': '(Psychiatrie)', + 'psychiatrie': '(Psychiatrie)', + 'psycho': '(Psychologie)', + 'psychotropes': '(Psychotropes)', + 'psychol': '(Psychologie)', + 'religion': '(Religion)', + 'religions': '(Religion)', + 'religieux': '(Religion)', + 'reli': '(Religion)', + 'christianisme': '(Christianisme)', + 'protestantisme': '(Christianisme)', + 'catholicisme': '(Catholicisme)', + 'dinosaures': '(Paléontologie)', + 'paléontologie': '(Paléontologie)', + 'poules': '(Zoologie)', + 'rongeurs': '(Zoologie)', + 'préciser': '(À préciser)', + 'préhistoire': '(Préhistoire)', + 'prestidigitation': '(Prestidigitation)', + 'prnl': 'pronominal', + 'probabilités': '(Probabilités)', + 'procédure': '(Justice)', + 'propre': '(Sens propre)', + 'protéines': '(Biochimie)', + 'chevaux': '(Zoologie)', + 'poissons': '(Zoologie)', + 'raies': '(Ichtyologie)', + 'dindons': '(Zoologie)', + 'chien': '(Zoologie)', + 'céphalopodes': '(Zoologie)', + 'diplomatie': '(Diplomatie)', + 'céramique': '(Arts de la céramique)', + 'escalade': '(Escalade)', + 'escrime': '(Escrime)', + 'états': '(État)', + 'céréales': '(Botanique)', + 'légumes': '(Botanique)', + 'lexicographie': '(Lexicographie)', + 'lézards': '(Zoologie)', + 'cervidés': '(Zoologie)', + 'cétacés': '(Zoologie)', + 'caséologie': '(Zoologie)', + 'caséologie‎': '(Zoologie)', + 'pétrochimie': '(Pétrochimie)', + 'islam': '(Islam)', + 'bouddhisme': '(Bouddhisme)', + 'bouddhisme‎': '(Bouddhisme)', + 'liturgie': '(Liturgie orthodoxe)', + 'arthropodes': '(arthropodes)', + 'arts martiaux': '(Art martiaux)', + 'couteaux': '(Couteaux)', + 'armes': '(Armement)', + 'armures': '(Armement)', + 'armement': '(Armement)', + 'guerre': '(Militaire)', + 'soldats': '(Militaire)', + 'militaire': '(Militaire)', + 'mili': '(Militaire)', + 'artillerie': '(Militaire)', + 'marine': '(Marine)', + 'avant 1835': '(Avant 1835)', + 'ortho1990': '(Orthographe rectifiée de 1990)', + 'outils': '(Outils)', + 'ustensiles': '(Cuisine)', + 'desserts': '(Cuisine)', + 'viandes': '(Cuisine)', + 'dessin': '(Dessin)', + 'étoiles': '(Astronomie)', + 'astronomie': '(Astronomie)', + 'astron': '(Astronomie)', + 'astrol': '(Astrologie)', + 'astrologie': '(Astrologie)', + 'astronautique': '(Astronautique)', + 'astrophysique': '(Astrophysique)', + 'athlétisme': '(Athlétisme)', + 'course à pied': '(Athlétisme)', + 'chimie organique': '(Chimie organique)', + 'chimie physique': '(Chimie)', + 'atomes': '(Chimie)', + 'chim': '(Chimie)', + 'attention': 'Note ⚠️:', + 'non standard': 'Note ⚠️: (Mot d\'usage non standard)', + 'non attesté': 'Note ⚠️: (Mot d\'usage non attesté)', + 'Audet': 'Audet', + 'Boudoux': 'Boudoux', + 'Euzennat': 'Euzennat', + 'féminin': '(Au féminin)', + 'au féminin': '(Au féminin)', + 'figures': '(Rhétorique)', + 'rhéto': '(Rhétorique)', + 'rhétorique': '(Rhétorique)', + 'au figuré': '(Au figuré)', + 'au masculin': '(Au masculin)', + + 'infographie': '(Infographie)', + 'dermatologie': '(Dermatologie)', + 'fiscalité': '(Fiscalité)', + 'finances': '(Finance)', + 'finance': '(Finance)', + 'finan': '(Finance)', + 'travail': '(Travail)', + 'beaux-arts': '(Beaux-arts)', + 'transport': '(Transport)', + 'transp': '(Transport)', + 'transports': '(Transport)', + 'mythologie': '(Mythologie)', + 'arts': '(Arts)', + 'figuré': '(Au sens figuré)', + 'méton': '(Par métonymie)', + 'au singulier': '(Au singulier)', + 'p': '(Au pluriel)', + 'au pluriel': '(Au pluriel)', + 'propriété': '(Droit)', + 'dabeur': '(Droit)', + 'droit': '(Droit)', + 'geocacher': '(Droit)', + 'crimes': '(Droit)', + 'délits': '(Droit)', + 'droit féodal': '(Droit féodal)', + 'cristallographie': '(Cristallographie)', + 'élec': '(Électricité)', + 'électricité': '(Électricité)', + 'électron': '(Électronique)', + 'composants': '(Électronique)', + 'composants électriques': '(Électronique)', + 'comptabilité': '(Comptabilité)', + 'compta': '(Comptabilité)', + 'électronique': '(Électronique)', + 'électrot': '(Électronique)', + 'électrotechnique': '(Électronique)', + 'péjoratif': '(Péjoratif)', + 'souvent péjoratif': '(Péjoratif)', + 'péj': '(Péjoratif)', + 'gastronomie': '(Gastronomie)', + 'héraldique': '(Héraldique)', + 'héral': '(Héraldique)', + 'meuble': '(Meuble)', + 'meubles': '(Meuble)', + 'microbiologie': '(Microbiologie)', + 'meubles héraldiques': '(Héraldique)', + 'beaucoup plus courant': '(Courant)', + 'plus courant': '(Courant)', + 'peu usité': '(Peu usité)', + 'p us': '(Peu usité)', + 'p-us': '(Peu usité)', + 'pyrotechnie': '(Pyrotechnie)', + + 'barriérage': '(Usage critiqué)', + 'rare': '(Rare)', + 'beaucoup moins courant': '(Rare)', + 'moins courant': '(Rare)', + 'b-m-cour': '(Rare)', + 'rare': '(Rare)', + 'plus rare': '(Rare)', + 'pl-rare': '(Rare)', + 'très-rare': '(Très rare)', + 'très très rare': '(Très rare)', + 'très rare': '(Très rare)', + 'ex-rare': '(Extrêmement rare)', + 'famille': '(Famille)', + 'fantastique': '(Fantastisque)', + 'fanta': '(Fantastisque)', + 'fant': '(Fantastisque)', + + 'extrêmement rare': '(Extrêmement rare)', + 'renseignement': '(Renseignement)', + 'reproduction': '(Reproduction)', + 'reliure': '(Reliure)', + 'littéraire': '(Littéraire)', + 'litt': '(Littéraire)', + 'livre': '(Livre)', + 'logistique': '(Logistique)', + 'Loiret': '(Loiret)', + 'loisirs': '(Loisirs)', + 'Lorraine': '(Lorraine)', + 'louchébem': '(Louchébem)', + 'lusi': '(Lusitanisme)', + 'Luxembourg': '(Luxembourg)', + 'littérature': '(Littéraire)', + 'cartographie': '(Cartographie)', + 'neurologie': '(Neurologie)', + 'neurol': '(Neurologie)', + 'médecine': '(Médecine)', + 'pédiatrie': '(Médecine)', + 'pédologie': '(Pédologie)', + 'pédol': '(Pédologie)', + 'peinture': '(Peinture)', + 'philatélie': '(Philatélie)', + 'phobies': '(Médecine)', + 'phonétique': '(Phonétique)', + 'phonologie': '(Phonologie)', + 'ophtalmologie': '(Médecine)', + 'optimisation': '(Optimisation)', + 'particules': '(Physique)', + 'optique': '(Physique)', + 'phys': '(Physique)', + 'physiol': '(Physiologie)', + 'physiologie': '(Physiologie)', + 'phytosociologie': '(Phytosociologie)', + 'oncologie': '(Médecine)', + 'obstétrique': '(Médecine)', + 'méde': '(Médecine)', + 'antonomase': '(Médecine)', + 'aphérèse': 'Aphérèse', + 'apiculture': '(Apiculture)', + 'apJC': 'Antiquité', + 'avJC': 'Antiquité', + 'apocope': '(Apocope)', + 'application': '(Couche application)', + 'couche application': '(Couche OSI application)', + 'couche liaison': '(Couche OSI liaison)', + 'couche physique': '(Couche OSI physique)', + 'couche réseau': '(Couche OSI réseau)', + 'couche session': '(Couche OSI session)', + 'couche transport': '(Couche OSI transport)', + 'apposition': '(En apposition)', + 'baby-foot': '(Baby-foot)', + 'bactéries': '(Bactériologie)', + 'bactériologie': '(Bactériologie)', + 'bandes dessinées': '(BD)', + 'baseball': '(Baseball)', + 'base de données': '(BDD)', + 'basket': '(Basket-ball)', + 'basket-ball': '(Basket-ball)', + 'basketball': '(Basket-ball)', + 'bâtiment': '(Construction)', + 'BDD': '(BDD)', + 'TAAF': '(Vocabulaire des TAAF)', + 'taille de pierre': '(Taille de pierre)', + + + 'chir': '(Chirurgie)', + 'urban': '(Urbanisme)', + 'urbanisme': '(Urbanisme)', + 'chirurgie': '(Chirurgie)', + 'photo': '(Photographie)', + 'photographie': '(Photographie)', + 'transitif': '(Transitif)', + 't': '(Transitif)', + 'transit': '(Transitif)', + 'trans': '(Transitif)', + 'intransitif': '(Intransitif)', + 'intrans': '(Intransitif)', + 'i': '(Intransitif)', + 'ibid': '(ibid.)', + 'illégalité': '(Illégalité)', + 'impersonnel': '(Impersonnel)', + 'ichtyologie': '(Ichtyologie)', + 'pronl': '(Pronominal)', + 'pronominal': '(Pronominal)', + 'forme pronominale': '(Pronominal)', + 'physique': '(Physique)', + 'nanotechnologie': '(Physique)', + 'ébauch-exe': '', + 'ébauche-exe': '', + 'ébauche-déf': '', + 'ébauche-étym': '', + 'mécanique': '(Mécanique)', + 'méca': '(Mécanique)', + 'médecine non conv': '(Médecine non conventionnelle)', + 'médecine non conventionnelle': '(Médecine non conventionnelle)', + 'temps géologiques': '(Géologie)', + 'tératologie': '(Tératologie)', + 'temps': '(Chronologie)', + 'télé': '(Média)', + 'télévision': '(Média)', + 'média': '(Média)', + 'presse': '(Média)', + 'radio': '(Média)', + 'politique': '(Politique)', + 'polit': '(Politique)', + 'LGBT': '(LGBT)', + 'économie': '(Économie)', + 'écon': '(Économie)', + 'juri': '(Droit)', + 'manège': '(Équitation)', + 'marbrerie': '(Marbrerie)', + 'maréchalerie': '(Maréchalerie)', + 'équitation': '(Équitation)', + 'hippisme': '(Équitation)', + 'impr': '(Imprimerie)', + 'imprimerie': '(Imprimerie)', + 'industriel': '(Industrie)', + 'industrie': '(Industrie)', + 'indus': '(Industrie)', + 'usines': '(Industrie)', + 'indus pétrolière': '(Petro mafia)', + 'raffinage': '(Pétro mafia)', + 'informel': '(Informel)', + 'insectes': '(Entomologie)', + 'mouches': '(Entomologie)', + 'Moyen Âge': '(Moyen Âge)', + 'instruments': '(Musique)', + 'boucherie': '(Boucherie)', + 'distinctions': '(Distinctions)', + 'documents': '(Média)', + 'doute': '(information à vérifier)', + 'vaudou': '(Vaudou)', + 'médicaments': '(Pharmacologie)', + 'drogue': '(Pharmacologie)', + 'drogues': '(Pharmacologie)', + 'mélioratif': '(Mélioratif)', + 'pharma': '(pharmacologie)', + 'surf': '(Surf)', + + + 'Québec': '(Québec)', + 'QC': '(Québec)', + 'québec': '(Québec)', + 'Canada': '(Canada)', + 'CA': '(Canada)', + 'BE': '(Belgique)', + 'France': '(France)', + 'Inde': '(Inde)', + 'Liban': '(Liban)', + 'Japon': '(Japon)', + 'jardi': '(Jardinage)', + 'jardinage': '(Jardinage)', + 'Franche-Compté': '(Franche-Compté)', + 'franc-maçonnerie': '(Franc-maçonnerie)', + 'Europe': '(Europe)', + 'Espagne': '(Espagne)', + 'Roumanie': '(Roumanie)', + 'Royaume-Uni': '(Royaume-Uni)', + 'Pays basque': '(Pays basque)', + 'pelote': '(Pelote Basque)', + 'Australie': '(Australie)', + 'Russie': '(Russie)', + 'Rwanda': '(Rwanda)', + 'Saint-Pierre-et-Miquelon': '(Saint-Pierre-et-Miquelon)', + 'Autriche': '(Autriche)', + 'Auvergne': '(Auvergne)', + 'Touraine': '(Touraine)', + 'Occitanie': '(Occitanie)', + 'Égypte': '(Égypte)', + 'USA': '(États-Unis)', + 'États-Unis': '(États-Unis)', + 'Normandie': '(Normandie)', + 'Congo-Kinshasa': '(Congo-Kinshasa)', + 'République Démocratique du Congo': '(Congo-Kinshasa)', + 'RDC': '(Congo-Kinshasa)', + 'RDCongo': '(Congo-Kinshasa)', + 'Congo-Brazzaville': '(Congo-Brazzaville)', + 'Bordelais': '(Bordelais)', + 'Lyon': '(Lyon)', + 'Mâconnais': '(Lyon)', + 'lyonnais': '(Lyon)', + 'Champagne': '(Champagne)', + 'Nice': '(Nice)', + 'Lille': '(Lille)', + 'Paris': '(Paris)', + 'Marseille': '(Marseille)', + 'Midi toulousain': '(Midi)', + 'Midi': '(Midi)', + 'champignon': '(Mycologie)', + 'champignons': '(Mycologie)', + 'Beaujolais': '(Beaujolais)', + 'Bourdonnais': '(Bourdonnais)', + 'Boureau-Louvet': '(Boureau-Louvet)', + 'Bourgogne': '(Bourgogne)', + 'reptiles': '(Zoologie)', + 'requins': '(Zoologie)', + 'mollusques': '(Zoologie)', + 'échinodermes': '(Zoologie)', + 'marsupial': '(Zoologie)', + 'marsupiaux': '(Zoologie)', + 'bovins': '(Zoologie)', + 'crustacés': '(Zoologie)', + 'boxe': '(Boxe)', + 'b-pl-cour': '(Courant)', + 'cour': '(Courant)', + 'courant': '(Courant)', + 'crypto': '(Cryptologie)', + 'cryptologie': '(Cryptologie)', + 'cryptographie': '(Cryptologie)', + 'cryptomonnaie': '(Cryptologie)', + 'cryptomonnaies': '(Cryptologie)', + 'bridge': '(Bridge)', + 'Mâconnais': '(Mâconnais)', + 'Nantes': '(Nantes)', + 'Vendée': '(Vendée)', + 'Velay': '(Velay)', + 'Picardie': '(Picardie)', + 'Poitou': '(Poitou)', + 'Vosges': '(Vosges)', + 'Provence': '(Provence)', + 'Rhône-Alpes': '(Rhône-Alpes)', + 'rire': '(😄)', + 'sourire': '(😄)', + 'Niger': '(Niger)', + 'Nicaragua': '(Nicaragua)', + 'natation': '(Natation)', + 'navigation': '(Navigation)', + 'Écosse': '(Écosse)', + 'Lyonnais': '(Lyon)', + 'Savoie': '(Savoie)', + 'Guadeloupe': '(Guadeloupe)', + 'Martinique': '(Martinique)', + 'Réunion': '(Réunion)', + 'Guyane': '(Guyane)', + 'Maurice': '(Guyane)', + 'Mayotte': '(Mayotte)', + 'Haïti': '(Haïti)', + 'herpétologie': '(Herpétologie)', + 'Bretagne': '(Bretagne)', + 'Madagascar': '(Madagascar)', + 'magnétisme': '(Magnétisme)', + 'maintenance': '(Maintenance)', + 'Maghreb': '(Maghreb)', + 'france': '(France)', + 'FR': '(France)', + 'fr': '(France)', + 'Belgique': '(Belgique)', + 'Suisse': '(Suisse)', + 'CH': '(Suisse)', + 'suisse': '(Suisse)', + 'Acadie': '(Acadie)', + 'Louisiane': '(Louisiane)', + 'Languedoc-Roussillon': '(Languedoc-Roussillon)', + 'Languedoc': '(Languedoc)', + 'Limousin': '(Limousin)', + 'Vietnam': '(Viêt Nam)', + 'Viêt Nam': '(Viêt Nam)', + 'Afrique': '(Agrique)', + 'Mali': '(Mali)', + 'Burkina Faso': '(Burkina Faso)', + 'Sénégal': '(Sénégal)', + 'Bénin': '(Bénin)', + 'Togo': '(Togo)', + 'Gabon': '(Gabon)', + 'Tchad': '(Tchad)', + 'Gascogne': '(Gascogne)', + 'Gaspésie': '(Gaspésie)', + 'Géliot': '(Héraldique)', + 'généalogie': '(Généalogie)', + 'généralement': '(Généralement)', + 'généralement singulier': '(Généralement au singulier)', + 'Cameroun': '(Cameroun)', + 'Centrafrique': '(Centrafrique)', + 'Mauritanie': '(Mauritanie)', + 'Berry': '(Berry)', + 'Afrique du Sud': '(Afrique du Sud)', + 'Algérie': '(Algérie)', + 'Maroc': '(Maroc)', + 'Tunisie': '(Tunisie)', + 'Orient': '(Orient)', + 'ornement': '(Ornement)', + 'maroquinerie': '(Maroquinerie)', + 'marque': '(Marque)', + 'Allemagne': '(Allemagne)', + 'Alsace': '(Alsace)', + 'Amérique du Nord': '(Amérique du Nord)', + 'Amérique du Sud': '(Amérique du Sud)', + 'Nord-Pas-de-Calais': '(Nord-Pas-de-Calais)', + 'Nouvelle-Calédonie': '(Nouvelle-Calédonie)', + 'Terre-Neuve': '(Terre-Neuve)', + 'nucléaire': '(Nucléaire)', + 'nucl': '(Nucléaire)', + 'numismatique': '(Numismatique)', + 'numis': '(Numismatique)', + 'nutrition': '(Nutrition)', + 'Anjou': '(Anjou)', + 'Antilles': '(Antilles)', + 'Aquitaine': '(Aquitaine)', + 'Asie centrale': '(Asie centrale)', + 'Kirghizistan': '(Asie centrale)', + 'Chine': '(Chine)', + 'saliculture': '(Saliculture)', + 'satellites': '(Astonomie)', + 'saut en hauteur': '(Saut en hauteur)', + 'sciences': '(Sciences)', + 'scientifiques': '(Scientifiques)', + 'scol': '(Scolaire)', + 'scolaire': '(Scolaire)', + 'sculpture': '(Sculpture)', + 'secourisme': '(Secourisme)', + 'seigneuries': '(Histoire)', + + + 'CB': '(Citizen-band)', + 'bibli': '(Bibliothéconomie)', + 'bibliothéconomie': '(Bibliothéconomie)', + 'assurance': '(Assurance)', + 'arboriculture': '(Arboriculture)', + 'anthropologie': '(Anthropologie)', + 'peupliers': '(Botanique)', + 'agrumes': '(Botanique)', + 'algues': '(Botanique)', + 'fleurs': '(Botanique)', + 'aïkido': '(Aïkido)', + 'éléments': '(Chimie)', + 'alcaloïdes': '(Chimie)', + 'alliage': '(Chimie)', + 'alpinisme': '(Alpinisme)', + 'alchimie': '(Alchimie)', + 'alcools': '(Boisson)', + 'cocktails': '(Boisson)', + 'bières': '(Boisson)', + 'algèbre': '(Algèbre)', + 'orfèvrerie': '(Bijou)', + 'bijou': '(Bijou)', + 'bijouterie': '(Bijou)', + 'joaillerie': '(Bijou)', + 'jonglerie': '(Jonglerie)', + 'judaïsme': '(Judaïsme)', + 'judo': '(Judo)', + 'karaté': '(Karaté)', + 'kung-fu': '(Kung-fu)', + 'Jura': '(Jura)', + 'billard': '(Billard)', + 'coiffure': '(Coiffure)', + 'biogéographie': '(Biogéographie)', + 'biol': '(Biologie)', + 'biologie cellulaire': '(Biologie cellulaire)', + 'bivalves': '(Malacologie)', + 'b-m-cour': '(Rare)', + 'm-cour': '(Plus Rare)', + 'bonsaï': '(Bonsaï)', + + 'calendrier': '(Chronologie)', + 'agrohomardinenomie': '(Agronomie)', + 'dames:': '(Jeu de Dames)', + 'danse': '(Dance)', + 'danses': '(Dance)', + 'dauphinois': '', + 'pâtes': '(Cuisine)', + 'pâtes alimentaires': '(Cuisine)', + 'bâteaux': '(Cuisine)', + 'cuisine': '(Cuisine)', + 'cuis': '(Cuisine)', + 'aliments': '(Cuisine)', + 'préparations': '(Cuisine)', + 'canoë-kayak': '(Canoë-kayak)', + 'confiserie': '(Confiserie)', + 'confiseries': '(Confiserie)', + 'colorimétrie': '(Colorimétrie)', + 'couture': '(Couture)', + 'cout': '(Couture)', + 'textile': '(Textile)', + 'tissage': '(Textile)', + 'tissus': '(Textile)', + 'textiles': '(textile)', + 'couverture': '(Couvertures)', + 'broderie': '(Textile)', + 'vêtements': '(Vêtements)', + 'habil': '(Vêtements)', + 'vête': '(Vêtements)', + 'chaussures': '(Vêtements)', + 'couvre-chefs': '(Vêtements)', + 'coléoptères': '(Zoologie)', + 'mammifères': '(Zoologie)', + 'crabes': '(Zoologie)', + 'écureils': '(Zoologie)', + 'chauves-souris': '(Zoologie)', + 'carnivore': '(Zoologie)', + 'vétérinaire': '(Médecine vétérinaire)', + 'vexillologie': '(Vexillologie)', + 'cartes': '(Cartes à jouer)', + 'poker': '(Poker)', + 'jeux de cartes': '(Cartes à jouer)', + 'tonnellerie': '(Tonnellerie)', + 'topographie': '(Topographie)', + 'caprins': '(Zoologie)', + 'camélidés': '(Zoologie)', + 'antilopes': '(Zoologie)', + 'animaux': '(Zoologie)', + 'zool': '(Zoologie)', + 'zoologie': '(Zoologie)', + 'zootechnie': '(Zoologie)', + 'serpents': '(Zoologie)', + 'serrurerie': '(Serrurerie)', + 'fauconnerie': '(Fauconnerie)', + 'sentiments': '(Psychologie)', + 'yoga': '(Yoga)', + 'yogana': '(Yoga)', + 'virologie': '(Virologie)', + 'virus': '(Virologie)', + 'viticulture': '(viticulture)', + 'volcanologie': '(Géologie)', + 'mf': 'masculin et féminin identiques', + 'œnologie': '(Œnologie)', + 'vins': '(Œnologie)', + 'œnol': '(Œnologie)', + 'oenologie': '(Œnologie)', + 'cépages': '(Œnologie)', + 'oenol': '(Œnologie)', + 'papeterie': '(Papeterie)', + 'papèterie': '(Papeterie)', + 'ornithologie': '(Ornithologie)', + 'palmipèdes': '(Ornithologie)', + 'oiseaux': '(Ornithologie)', + 'ornithol': '(Ornithologie)', + 'entomol': '(Entomologie)', + 'papillons': '(Entomologie)', + 'entomologie': '(Entomologie)', + 'pharmacologie': '(Pharmacologie)', + 'pharmacie': '(Pharmacologie)', + 'épithète': '(Employé comme épithète)', + 'symboles unités': '(Métrologie)', + 'instruments de mesure': '(Métrologie)', + 'unités': '(Métrologie)', + 'unité': '(Métrologie)', + 'métro': '(Métrologie)', + 'métrol': '(Métrologie)', + 'métrologie': '(Métrologie)', + 'vents': '(Météorologie)', + 'verlan': '(Verlan)', + 'météorologie': '(Météorologie)', + 'météorol': '(Météorologie)', + 'météo': '(Météorologie)', + 'cordonnerie': '(Cordonnerie)', + 'Corée du Nord': '(Corée du Nord)', + 'cosmétique': '(Cosmétique)', + 'Côte d’Ivoire': '(Côte d’Ivoire)', + 'robotique': '(Robotique)', + 'science-fiction': '(SF)', + 'sci-fi': '(SF)', + 'pathologie': '(Nosologie)', + 'maladie': '(Nosologie)', + 'nosologie': '(Nosologie)', + 'maladies': '(Nosologie)', + 'réciproque': '(réciproque)', + 'populaire': '(Par abuus de langage)', + 'enfantin': '(Langage enfantin)', + 'parler gaga': '(Langage enfantin)', + 'Parler gaga': '(Langage enfantin)', + 'enfant': '(Langage enfantin)', + 'par métonymie': '(Linguistique)', + 'métonymie': '(Linguistique)', + 'langues': '(Linguistique)', + 'lang': '(Linguistique)', + 'langages': '(Linguistique)', + 'SMS': '(Langage SMS)', + 'langage SMS': '(Langage SMS)', + 'Lang': '(Linguistique)', + 'ling': '(Linguistique)', + 'langage Java': '(Informatique)', + 'protocoles': '(Réseaux)', + 'réseaux': '(Réseaux)', + 'POO': '(Programmation Orientée Objet)', + 'absolument': '(Absolument, Sans complément)', + 'OTAN': '(OTAN)', + 'absol': '(Absolument, Sans complément)', + 'VII': '(Antiquité)', + 'antiq': '(Antiquité)', + 'Antiquité': '(Antiquité)', + 'antiquité': '(Antiquité)', + 'topol': '(Topologie)', + 'topologie': '(Topologie)', + 'topon': '(Toponymie)', + 'toponymes': '(Toponymie)', + 'toponymes‎': '(Toponymie)', + 'territoires': '(Toponymie)', + 'toponymie': '(Toponymie)', + 'quartiers': '(Toponymie)', + 'ferroviaire': '(Chemin de fer)', + 'ferro': '(Chemin de fer)', + 'chemin de fer': '(Chemin de fer)', + 'typographie': '(Typographie)', + 'typo': '(Typographie)', + 'diacritiques': '(Grammaire)', + 'dialectes': '(Dialecte)', + 'langue': '(Linguistique)', + 'humour': '(Humour)', + 'management': '(Management)', + 'ufologie': '(Ufologie)', + 'marketing': '(Marketing)', + 'publicité': '(Marketing)', + 'plaisanterie': '(Humour)', + 'plais': '(Humour)', + 'plance à neige': '(Snowboard)', + 'snowboard': '(Snowboard)', + 'planche à roulettes': '(Plance à roulettes)', + 'skateboard': '(Plance à roulettes)', + 'plomberie': '(Plomberie)', + 'plongée': '(Plongée)', + 'Marne': '(Marne)', + 'ski alpin': '(Ski alpin)', + 'socialisme': '(Socialisme)', + 'sociologie': '(Sociologie)', + 'sylviculture': '(Sylviculture)', + 'sylv': '(Sylviculture)', + 'lacs': '(Géographie)', + 'pays': '(Géographie)', + 'océanographie': '(Océanographie)', + 'tourisme': '(Tourisme)', + 'tradit': '(Orthographe traditionnelle)', + 'détroits': '(Géographie)', + 'gentilés': '(Géographie)', + 'chaînes de montagnes': '(Géographie)', + 'géographie': '(Géographie)', + 'géog': '(Géographie)', + 'îles': '(Géographie)', + 'île': '(Géographie)', + 'provinces': '(Géographie)', + 'botanique': '(Botanique)', + 'fruits': '(Botanique)', + 'phyton': '(Botanique)', + 'botan': '(Botanique)', + 'arbres': '(Botanique)', + 'familles de plantes': '(Botanique)', + 'plantes': '(Botanique)', + 'dentisterie': '(Dentisterie)', + 'cyclisme': '(Cyclisme)', + 'vélo': '(Cyclisme)', + 'motocyclisme': '(Motocyclisme)', + 'moto': '(Motocyclisme)', + 'Moto': '(Motocyclisme)', + 'prog': '(Informatique)', + 'programmation': '(Informatique)', + 'programation': '(Informatique)', + 'anglicismes informatiques': '(Anglicisme informatique)', + 'anglicisme informatique': '(Anglicisme informatique)', + 'germanisme': '(Germanisme)', + 'italianisme': '(Italianisme)', + 'latinisme': '(Latinisme)', + 'latinisme droit': '(Latinisme du Droit)', + 'hispanisme': '(Hispanisme)', + 'hisp': '(Hispanisme)', + 'histoire de France': '(Histoire)', + 'monarchie': '(Histoire)', + 'histol': '(Histologie)', + 'horticulture': '(Horticulture)', + 'hydrobiologie': '(Hydrobiologie)', + 'hydrologie': '(Hydrologie)', + 'monnaies': '(Numismatique)', + + 'versification': '(Versification)', + 'giraffidés': '(Zoologie)', + 'vers': '(Zoologie)', + 'tortues': '(Zoologie)', + 'glaciologie': '(Glaciologie)', + 'gladiateurs': '(Antiquité)', + 'angl': '(Anglicisme)', + 'golf': '(Golf)', + 'gymnastique': '(Gym)', + 'gram': '(Grammaire)', + 'théologie': '(Théologie)', + 'théologie': '(Théol)', + 'semi-logarithmique': '(Informatique)', + 'thermodynamique': '(Thermodynamique)', + 'graph': '(Théorie des graphes)', + 'anglicisme': '(Anglicisme)', + 'faux anglicisme': '(Faux anglicisme)', + 'paume': '(Jeu de paume)', + 'Union européenne': '(Union européenne)', + 'abréviation': '(Abréviation)', + 'abréviation de': '(Abréviation)', + 'par ext': 'Par extension; ', + 'euphémisme': 'Par euphémisme; ', + 'exagération': 'Par hyperbole; ', + 'dérision': 'Par dérision; ', + 'par extension': 'Par extension; ', + 'analyse': '(Analyse)', + 'anal': 'Par analogie; ', + 'par analogie': 'Par analogie; ', + 'exploitation forestière': '(Exploitation forestière)', + 'expression': '(Expression)', + 'analogie': 'Par analogie; ', + 'part': 'En particulier; ', + 'en particulier': 'En particulier; ', + 'particulier': 'En particulier; ', + 'spécialement': 'En particulier; ', + 'spéc': 'En particulier; ', + 'spécifiquement': '(Spécifiquement)', + 'archaïque': '(Archaïque)', + 'arch': '(Archaïque)', + 'archéologie': '(Archéologie)', + 'Argadz': '(Argot des Gadz’Arts ?!)', + 'agriculture': '(Agriculture)', + 'élevage': '(Agriculture)', + 'éleva': '(Agriculture)', + 'embryologie': '(Embryologie)', + 'agri': '(Agriculture)', + 'sexualité': '(Sexualité)', + 'sexe': '(Sexualité)', + 'numéro': 'n°', + 'biologie': '(Biologie)', + 'parasitologie': '(Biologie)', + 'micro-biologie': '(Micro-biologie)', + 'grammaire': '(Grammaire)', + 'ellipse': '(Par ellipse)', + 'par ellipse': '(Par ellipse)', + 'écologie': '(Écologie)', + 'éco': '(Écologie)', + 'bateaux': '(Navigation)', + 'ethnologie': '(Ethnologie)', + 'ethnobiologie': '(Ethnologie)', + 'usage': 'Note d\'usage: ', + 'note': 'Note: ', + 'réfléchi': '(Réfléchi)', + 'cf': '', + 'réf ?': '', + 'RÉF': '', + 'référence nécessaire': '', + 'périodique': '', + 'article': '', + 'Article': '', + 'périodique ': '', + 'lire en ligne': '', + 'lien vidéo': '', + 'Lien web ': '', + 'Lien web': '', + 'lien web': '', + 'lien brisé': '', + 'Lien brisé': '', + 'ouvrage': '', + 'Ouvrage': '', + 'compo': '', + 'écouter': '', + 'voir': '', + 'pron': '', # Prononciation + 'réf': '', # Référence + 'cit_réf': '', # Référence + 'cit réf': '', # Référence + 'trad+': '', + 'p.': 'p.', + 'trad-': '', + 'source': '', # Source + '?': '', # Source + 'réf?': '', # Source + 'Wikipédia': '', + 'Wikisource': '', + 'wsp': '', + 'WSP': '', + + + 'vitrerie': '(Vitrerie)', + 'miroiterie': '(Miroiterie)', + 'menuiserie': '(Menuiserie)', + 'menu': '(Menuiserie)', + 'charpenterie': '(Charpenterie)', + 'charpente': '(Charpenterie)', + 'charronnerie': '(Charronerie)', + 'chasse': '(Chasse)', + 'hindouisme': '(Hindouisme)', + 'gravure': '(Gravue)', + 'tauromachie': '(Tauromachie)', + 'catch': '(Catch)', + 'cosmétologie': '(Cosmétologie)', + 'parfumerie': '(Cosmétologie)', + 'mycologie': '(Mycologie)', + 'mycol': '(Mycologie)', + 'aéro': '(Aéronautique)', + 'aéronautique': '(Aéronautique)', + 'avion': '(Aéronautique)', + 'avions': '(Aéronautique)', + 'paléontol': '(Paléontologie)', + 'occultisme': '(Occultisme)', + 'indénombrable': '(Indénombrable)', + 'indén': '(Indénombrable)', + 'dénombrable': '(Dénombrable)', + 'police': '(Police)', + 'Pologne': '(Pologne)', + 'Polynésie française': '(Polynésie française)', + 'sigle': '(Sigle)', + 'Seychelles': '(Seychelles)', + 'sidérurgie': '(Sidérurgie)', + 'affectueux': '(Affectueux)', + 'technologie': '(Technologie)', + 'technol': '(Technologie)', + 'machines': '(Technologie)', + 'boissons': '(Boisson)', + 'boisson': '(Boisson)', + 'construction': '(Construction)', + 'édifices': '(Construction)', + 'constr': '(Construction)', + 'titres': '(Noblesse)', + 'noblesse': '(Histoire)', + 'horlogerie': '(Horlogerie)', + 'numismatique': '(Numismatique)', + 'génétique': '(Génétique)', + 'génét': '(Génétique)', + 'génériquement': '(Génériquement)', + 'admin': '(Administration)', + 'administration': '(Administration)', + 'journalisme': '(Journalisme)', + 'édition': '(Édition)', + 'fromages': '(Fromage)', + 'fromage': '(Fromage)', + 'éducation': '(Éducation)', + 'éduc': '(Éducation)', + 'hapax': '(Hapax)', + 'handisport': '(Handisport)', + 'handball': '(Handball)', + 'football': '(Football)', + 'foot': '(Football)', + 'foresterie': '(Foresterie)', + 'metal': '(Métallurgie)', + 'métal': '(Métallurgie)', + 'métallurgie': '(Métallurgie)', + 'fonderie': '(Métallurgie)', + 'métaphore': '(Métaphore)', + 'acoustique': '(Acoustique)', + 'acoustique': '(Acoustique)', + 'acron': '(Acronyme)', + 'acronyme': '(Acronyme)', + + + } diff --git a/dump2msgp.py b/dump2msgp.py deleted file mode 100644 index d4fb050..0000000 --- a/dump2msgp.py +++ /dev/null @@ -1,309 +0,0 @@ -import tempfile as tmp -import re -import sys -import msgpack - -from listSection import listInfoSection -from template import template - - -""" - -Extract words from the Wiktionnary archive - -""" - -template_second = ['link', 'bd', 'pc', 'nom w pc', 'w', 'smcp', 'lien', 'ws', - 'in', 'siècle2', 'fchim', 'nobr', 'wp', 'r', - 'clé de tri', 'contexte', 'emploi', 'l', 'polytonique', - 'pron-API', 'registre', 'scmp', 'siècle', 'x', - ] - - -template_second_lambda_trd = { - 'refnec': (lambda x: '(Référence nécessaire : ' + x + ')'), - 'refnéc': (lambda x: '(Référence nécessaire : ' + x + ')'), -} - -template_second_lambda_snd = { - 'term': (lambda x: '(' + x.title() + ')'), - 'terme': (lambda x: '(' + x.title() + ')'), - 'ex': (lambda x: '^{' + x if x else 'e' + '}'), - 'exp': (lambda x: '^{' + x if x else 'e' + '}'), - 'e': (lambda x: '^{' + x if x else 'e' + '}'), - 'er': (lambda x: '^{' + x if x else 'er' + '}'), - 'ère': (lambda x: '^{' + x if x else 'ère' + '}'), - 'ème': (lambda x: '^{' + x if x else 'ème' + '}'), - 'Ier': (lambda x: '^{' + x if x else 'Ier' + '}'), - 'III': (lambda x: '^{' + x if x else 'III' + '}'), - 'III': (lambda x: '^{' + x if x else 'III' + '}'), - 'small': (lambda x: '_{' + x if x else '' + '}'), - 'indice': (lambda x: '_{' + x if x else '' + '}'), - 'graphie': (lambda x: '«' + x if x else '»'), - 'petites capitales': (lambda x: x.upper()), - 'isbn': (lambda x: 'cf. ISBN ' + x), - 'OCLC': (lambda x: 'cf. OCLC ' + x), - 'variante de': (lambda x: 'Variante de ' + x), - 'variante de': (lambda x: 'Variante de ' + x), - 'variante ortho de': (lambda x: 'Variante orthographique de ' + x), - 'variante ortho de': (lambda x: 'Variante orthographique de ' + x), - 'variante ortho de': (lambda x: 'Variante orthographique de ' + x), - 'variante orthographique de': (lambda x: 'Variante orthographique de ' + x), - 'sic !': (lambda x: '^{sic ' + x + '}'), - 'sic': (lambda x: '^{sic ' + x + '}'), - 'incise': (lambda x: '_' + x + '_'), - 'n°': (lambda x: 'n°' + x), - 'superlatif de': (lambda x: 'Superlatif de' + x), - 'vérifier': (lambda x: '(À vérifier : ' + x + ')'), -} - -dictMatch = {x['match']: i for (i, x) in enumerate(listInfoSection)} - -interdit = " :" - - -def transclusion(trans, info): - trans = trans[2:-2] - - while '{{' in trans: - l0 = trans.rfind('{{') - l1 = trans.find('}}', l0) - if l1 == -1: - break - else: - l1 += 2 - t = trans[l0:l1] - t = transclusion(t, info) - trans = trans[:l0] + t + trans[l1:] - - s = list(map(lambda x: x.strip(), trans.split('|'))) - if s[0] in template: - return template[s[0]] - - if s[0].lower() in template_second: - - return s[1] if len(s) > 1 else title - - if s[0].lower().startswith('citation'): - cit = s[0].split('/') - if len(cit) == 4: - return 'Par ' + cit[1] + ', ' + cit[2] + ', ' + cit[3] - if len(cit) == 3: - return 'Par ' + cit[1] + ', ' + cit[2] - if len(cit) == 5: - return cit[1] + '/' + cit[2] + '/' + cit[3] + ', ' + cit[4] - if len(cit) <= 2: - return '' - else: - return '/'.join(c[1:]) - - if s[0].lower() in template_second_lambda_snd: - return template_second_lambda_snd[s[0].lower()](s[1] if len(s) > 1 else '') - - if s[0].lower() in template_second_lambda_trd: - return template_second_lambda_trd[s[0].lower()](s[2] if len(s) > 2 else '') - - with open('wiki_err.log', 'a') as err: - print(s[0], file=err) -# print("Incompréhension de la transclusion {} du mot {}".format(trans, -# info['mot']), file=err) - return '' - - -def extract(f, w): - infoFin = [] - - toRead = True - goBack = 0 - - while toRead: - toRead = False - - info = {'mot': w, - 'cat-gram': None, - 'def': [], - 'API': None, - 'infos': [], - 'genre': '', - 'accord': None} - - # State 0 // Initialisation ! - while line := f.readline(): - - if line.startswith('=== ') or line.startswith('==={'): - if re.match('^=== *{{ *S\\|([^|]+)|.*$', line): - try: - r = re.match('^=== *{{ *S\\|([^|]+)|.*$', line) - r = r.groups() - nat = r[0].strip() - if nat in dictMatch.keys(): - info['cat-gram'] = nat - toRead = True - break - except e: - with open('wiki_err.log', 'a') as err: - print("^[1] Problème à l'initialisation du mot {}:" - " {}".format(info['mot'], e), file=err) - print('line: [{}]'.format(line, e), file=err) - e = sys.exc_info()[0] - print("Erreur :", e, file=err) - - if not toRead: - break - - # State 1 - while line := f.readline(): - if line.startswith('{{fr-'): - e = line.find('}}') - if e == -1: - continue - ex = line[:e] - try: - infos = list(map(lambda x: x.strip(), ex.split('|'))) - info['infos'] = infos - info['accord'] = infos[0] - if len(infos) > 1: - info['API'] = infos[1] - except e: - err = sys.exc_info()[0] - print(ex) - print("Erreur :", e) - print("Erreur :", err) - if line.rstrip().startswith("'''"): - if '{{pron' in line: - p0 = line.find('{{pron') - p1 = line.find('}}', p0) - if p1 > 0: - p1 += 2 - p = line[p0:p1] - p = p.split('|') - info['API'] = p[1] - if '{{m}}' in line: - info['genre'] = 'mas' - elif '{{f}}' in line: - info['genre'] = 'fem' - - if line.startswith('# '): - info['def'].append({'def': wikiToMd(line[2:], info)}) - elif line.startswith('#* '): - if not info['def']: - with open('wiki_err.log', 'a') as err: - print("Exemple sans définition pour le mot {}".format( - info['mot']), file=err) - elif 'ex' in info['def'][-1]: - info['def'][-1]['ex'].append(wikiToMd(line[3:], info)) - else: - info['def'][-1]['ex'] = [wikiToMd(line[3:], info)] - elif line.startswith('#') and not line.startswith('##'): - info['def'].append({'def': wikiToMd(line[1:], info)}) - if line.startswith('==='): - goBack = len(line) - break - if goBack: - tf.seek(tf.tell() - goBack) - goBack = 0 - toRead = True - infoFin.append(info) - - return infoFin - - -def wikiToMd(line, info): - line = line.strip() - # 3 Étapes: - # - Links [...] - # - Style ''ita'' / '''bold''' - # - Template / Transclusion {{info}} = (Informatique) - - # Template - while '{{' in line: - l0 = line.rfind('{{') - l1 = line.find('}}', l0) - if l1 == -1: - break - else: - l1 += 2 - trans = line[l0:l1] - trans = transclusion(trans, info) - line = line[:l0] + trans + line[l1:] - - # Links ! - while '[[' in line: - link0 = line.rfind('[[') - link1 = line.find(']]', link0) - if link1 == -1: - break - else: - link1 += 2 - - link = line[link0:link1] - link = link[2:-2].split('|') - line = line[:link0] + (link[1] if len(link) > 1 else link[0]) + line[link1:] - - # Style - line = line.replace("'''", '*').replace("''", '') - - return line - - -with open("./fr_wiktionary_all.xml", 'r') as f: - title = "" - isFr = False - hasForbidden = False - hasText = False - tf = None - - dict_ = dict() - - for line in f: - if "</page>" in line and tf: - tf.seek(0) - i = extract(tf, title) - - for w in i: - if w['mot'] == 'président': - print("What we exstract from it:") - print(i) - - dict_[title] = i - tf.close() - - tf = None - hasForbidden = False - hasText = False - isFr = False - title = "" - elif "</page>" in line: - tf = None - hasForbidden = False - hasText = False - isFr = False - title = "" - - if "<title>" in line: - title = line[line.find('>') + 1:] - title = title[:title.find('<')] - - for c in interdit: - if c in title: - hasForbidden = True - if not hasForbidden and "<text xml:space=\"preserve\">" in line: - hasText = True - if not hasForbidden and "== {{langue|fr}}" in line and hasText: - isFr = True - if tf: - print("Erreur tf encore ouvert !") - exit(-1) - tf = tmp.NamedTemporaryFile(mode="w+t") - # print(title) - elif not hasForbidden and "== {{langue|" in line: - isFr = False - if not hasForbidden and isFr and tf: - tf.write(line) - - print("Will save the result") - - with open('result_all.pack', 'wb') as f: - to_w = msgpack.packb(dict_) - f.write(to_w) - diff --git a/getSection.py b/getSection.py deleted file mode 100644 index 62b74be..0000000 --- a/getSection.py +++ /dev/null @@ -1,129 +0,0 @@ -listInfoSection= [ - {'type': 'adjectif', 'match': 'adj', 'o': 'adjectif'}, - {'type': 'adjectif', 'match': 'adjectif', 'o': 'adjectif'}, - {'type': 'adjectif', 'match': 'adj-dém', 'o': 'adjectif démonstratif'}, - {'type': 'adjectif', 'match': 'adjectif démonstratif', 'o': 'adjectif démonstratif'}, - {'type': 'adjectif', 'match': 'adjectif exclamatif', 'o': 'adjectif exclamatif'}, - {'type': 'adjectif', 'match': 'adjectif indéfini', 'o': 'adjectif indéfini'}, - {'type': 'adjectif', 'match': 'adjectif interrogatif', 'o': 'adjectif interrogatif'}, - {'type': 'adjectif', 'match': 'adjectif numéral', 'o': 'adjectif numéral'}, - {'type': 'adjectif', 'match': 'adjectif possessif', 'o': 'adjectif possessif'}, - {'type': 'adjectif', 'match': 'adjectif relatif', 'o': 'adjectif relatif'}, - - {'type': 'adverbe', 'match': 'adv', 'o': 'adverbe'}, - {'type': 'adverbe', 'match': 'adverbe', 'o': 'adverbe'}, - {'type': 'adverbe', 'match': 'adverbe interrogatif', 'o': 'adverbe interrogatif'}, - {'type': 'adverbe', 'match': 'adverbe relatif', 'o': 'adverbe relatif'}, - - {'type': 'article', 'match': 'article', 'o': 'article'}, - {'type': 'article', 'match': 'article défini', 'o': 'article défini'}, - {'type': 'article', 'match': 'article indéfini', 'o': 'article indéfini'}, - {'type': 'article', 'match': 'article partitif', 'o': 'article partitif'}, - - {'type': 'conjonction', 'match': 'conjonction', 'o': 'conjonction'}, - {'type': 'conjonction', 'match': 'conjonction de coordination', 'o': 'conjonction de coordination'}, - - - {'type': 'erreur', 'match': 'erreur', 'o': 'faute courante'}, - {'type': 'erreur', 'match': 'faute', 'o': 'faute courante'}, - - {'type': 'interjection', 'match': 'interj', 'o': 'interjection'}, - {'type': 'interjection', 'match': 'interjection', 'o': 'interjection'}, - - {'type': 'interjection', 'match': 'interjection', 'o': 'interjection'}, - - {'type': 'locuton nominale', 'match': 'loc-phr', 'o': 'locution nominale'}, - {'type': 'locuton nominale', 'match': 'locution', 'o': 'locution nominale'}, - {'type': 'locuton nominale', 'match': 'locution nominale', 'o': 'locution nominale'}, - {'type': 'locuton nominale', 'match': 'locution phrase', 'o': 'locution nominale'}, - {'type': 'locuton nominale', 'match': 'locution-phrase', 'o': 'locution nominale'}, - - {'type': 'nom', 'match': 'nom', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom1', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom2', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom3', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom4', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom5', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom6', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom7', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom8', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom9', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom10', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom11', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom12', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom13', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom14', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom15', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom16', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom17', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom commun', 'o': 'nom'}, - {'type': 'nom', 'match': 'substantif', 'o': 'substantif'}, - - - {'type': 'nom de famille', 'match': 'nom de famille', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom de famille anglais', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom-fam', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom-pr', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom-propre', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom pr', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom propre', 'o': 'nom de famille'}, - {'type': 'nom scientifique', 'match': 'nom scientifique', 'o': 'nom scientifique'}, - {'type': 'particule', 'match': 'particule', 'o': 'particule'}, - {'type': 'nom de famille', 'match': 'patronyme', 'o': 'nom de famille'}, - {'type': 'préfixe', 'match': 'préfixe', 'o': 'préfixe'}, - {'type': 'suffixe', 'match': 'suffixe', 'o': 'suffixe'}, - {'type': 'prénom', 'match': 'prénom', 'o': 'prénom'}, - - {'type': 'onomatopée', 'match': 'onomatopée', 'o': 'onomatopée'}, - {'type': 'onomatopée', 'match': 'onom', 'o': 'onomatopée'}, - - {'type': 'préposition', 'match': 'prép', 'o': 'préposition'}, - {'type': 'préposition', 'match': 'préposition', 'o': 'préposition'}, - - {'type': 'pronom', 'match': 'pronom', 'o': 'pronom'}, - {'type': 'pronom', 'match': 'pronom démonstratif', 'o': 'pronom démonstratif'}, - {'type': 'pronom', 'match': 'pronom indéfini', 'o': 'pronom indéfini'}, - {'type': 'pronom', 'match': 'pronom interrogatif', 'o': 'pronom interrogatif'}, - {'type': 'pronom', 'match': 'pronom personnel', 'o': 'pronom personnel'}, - {'type': 'pronom', 'match': 'pronom possessif', 'o': 'pronom possessif'}, - {'type': 'pronom', 'match': 'pronom relatif', 'o': 'pronom relatif'}, - - {'type': 'verbe', 'match': 'verb', 'o': 'verbe'}, - {'type': 'verbe', 'match': 'verbe', 'o': 'verbe'}, - {'type': 'verbe', 'match': 'verbe pronominal', 'o': 'verbe pronominal'} -] - -listSections = [] -with open("./listSections", "r") as f: - for line in f: - line = line.strip() - if line[-3:] != "===": - continue - - s = line.find('{{')+2 - e = line.find('}}') - if not s < e: - continue - - argsStr = line[s:e] - args = list(map(lambda x: x.strip().lower(), argsStr.split('|'))) - - if len(args) <= 2 or not args[1]: - continue - - if not args[2].startswith('fr'): - continue - - classed = False - for m in listInfoSection: - if m['match'] == args[1]: - classed = True - continue - if not classed: - listSections.append(args[1]) - -for section in (list(set(listSections))): - print(section) - - - diff --git a/msgPack2sqlite_msgPack.py b/msgPack2sqlite_msgPack.py deleted file mode 100644 index c251d59..0000000 --- a/msgPack2sqlite_msgPack.py +++ /dev/null @@ -1,56 +0,0 @@ -# To load with python interpreter - -import msgpack -import ui -import sys - -import sqlite3 -import argparse - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='wiktionary dump msgpack ' - 'to SQLite database file') - parser.add_argument('-o', '--out', dest='outputF', action='store', - help='the output filename') - parser.add_argument('-i', '--input', dest='inputF', action='store', - help='the input filename, a dump of witionary') - - arg = parser.parse_args() - - if arg.inputF is None: - print('Error input file needed', file=sys.stderr) - if arg.outputF is None: - print('Error output file needed', file=sys.stderr) - - with open(arg.inputF, 'rb') as f: - r = f.read() - - d = p = msgpack.unpackb(r, raw=False) - del r - - with sqlite3.connect(arg.outputF) as con: - cur = con.cursor() - cur.execute('''CREATE TABLE IF NOT EXISTS entry ( - word TEXT, - cat_gram TEXT, - API TEXT, - infos TEXT, - genre TEXT, - accord TEXT, - defs BLOG, - ID INTEGER PRIMARY KEY)''') - con.commit() - - for w, listW in d.items(): - for word in listW: - data = (w, word['cat-gram'], word['API'], "\t".join(word['infos']), - word['genre'], word['accord'], - msgpack.packb(word['def'])) - cur.execute('''INSERT INTO entry (word, cat_gram, API, infos, - genre, accord, defs) VALUES (?, ?, ?, ?, ?, ?, ?)''', data) - con.commit() - - -def give_def(w): - ui.show_terminal(d[w]) - diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c429cce --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +msgpack==1.0.0 +PyMySQL==0.9.3 +Flask==1.1.2 diff --git a/sectionList.py b/sectionList.py deleted file mode 100644 index 68dd657..0000000 --- a/sectionList.py +++ /dev/null @@ -1,96 +0,0 @@ - -listInfoSection = [ - {'type': 'adjectif', 'match': 'adj', 'o': 'adjectif'}, - {'type': 'adjectif', 'match': 'adjectif', 'o': 'adjectif'}, - {'type': 'adjectif', 'match': 'adj-dém', 'o': 'adjectif démonstratif'}, - {'type': 'adjectif', 'match': 'adjectif démonstratif', 'o': 'adjectif démonstratif'}, - {'type': 'adjectif', 'match': 'adjectif exclamatif', 'o': 'adjectif exclamatif'}, - {'type': 'adjectif', 'match': 'adjectif indéfini', 'o': 'adjectif indéfini'}, - {'type': 'adjectif', 'match': 'adjectif interrogatif', 'o': 'adjectif interrogatif'}, - {'type': 'adjectif', 'match': 'adjectif numéral', 'o': 'adjectif numéral'}, - {'type': 'adjectif', 'match': 'adjectif possessif', 'o': 'adjectif possessif'}, - {'type': 'adjectif', 'match': 'adjectif relatif', 'o': 'adjectif relatif'}, - - {'type': 'adverbe', 'match': 'adv', 'o': 'adverbe'}, - {'type': 'adverbe', 'match': 'adverbe', 'o': 'adverbe'}, - {'type': 'adverbe', 'match': 'adverbe interrogatif', 'o': 'adverbe interrogatif'}, - {'type': 'adverbe', 'match': 'adverbe relatif', 'o': 'adverbe relatif'}, - - {'type': 'article', 'match': 'article', 'o': 'article'}, - {'type': 'article', 'match': 'article défini', 'o': 'article défini'}, - {'type': 'article', 'match': 'article indéfini', 'o': 'article indéfini'}, - {'type': 'article', 'match': 'article partitif', 'o': 'article partitif'}, - - {'type': 'conjonction', 'match': 'conjonction', 'o': 'conjonction'}, - {'type': 'conjonction', 'match': 'conjonction de coordination', 'o': 'conjonction de coordination'}, - - - {'type': 'erreur', 'match': 'erreur', 'o': 'faute courante'}, - {'type': 'erreur', 'match': 'faute', 'o': 'faute courante'}, - - {'type': 'interjection', 'match': 'interj', 'o': 'interjection'}, - {'type': 'interjection', 'match': 'interjection', 'o': 'interjection'}, - - {'type': 'interjection', 'match': 'interjection', 'o': 'interjection'}, - - {'type': 'locuton nominale', 'match': 'loc-phr', 'o': 'locution nominale'}, - {'type': 'locuton nominale', 'match': 'locution', 'o': 'locution nominale'}, - {'type': 'locuton nominale', 'match': 'locution nominale', 'o': 'locution nominale'}, - {'type': 'locuton nominale', 'match': 'locution phrase', 'o': 'locution nominale'}, - {'type': 'locuton nominale', 'match': 'locution-phrase', 'o': 'locution nominale'}, - - {'type': 'nom', 'match': 'nom', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom1', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom2', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom3', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom4', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom5', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom6', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom7', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom8', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom9', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom10', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom11', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom12', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom13', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom14', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom15', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom16', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom17', 'o': 'nom'}, - {'type': 'nom', 'match': 'nom commun', 'o': 'nom'}, - {'type': 'nom', 'match': 'substantif', 'o': 'substantif'}, - - - {'type': 'nom de famille', 'match': 'nom de famille', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom de famille anglais', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom-fam', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom-pr', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom-propre', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom pr', 'o': 'nom de famille'}, - {'type': 'nom de famille', 'match': 'nom propre', 'o': 'nom de famille'}, - {'type': 'nom scientifique', 'match': 'nom scientifique', 'o': 'nom scientifique'}, - {'type': 'particule', 'match': 'particule', 'o': 'particule'}, - {'type': 'nom de famille', 'match': 'patronyme', 'o': 'nom de famille'}, - {'type': 'préfixe', 'match': 'préfixe', 'o': 'préfixe'}, - {'type': 'suffixe', 'match': 'suffixe', 'o': 'suffixe'}, - {'type': 'prénom', 'match': 'prénom', 'o': 'prénom'}, - - {'type': 'onomatopée', 'match': 'onomatopée', 'o': 'onomatopée'}, - {'type': 'onomatopée', 'match': 'onom', 'o': 'onomatopée'}, - - {'type': 'préposition', 'match': 'prép', 'o': 'préposition'}, - {'type': 'préposition', 'match': 'préposition', 'o': 'préposition'}, - - {'type': 'pronom', 'match': 'pronom', 'o': 'pronom'}, - {'type': 'pronom', 'match': 'pronom démonstratif', 'o': 'pronom démonstratif'}, - {'type': 'pronom', 'match': 'pronom indéfini', 'o': 'pronom indéfini'}, - {'type': 'pronom', 'match': 'pronom interrogatif', 'o': 'pronom interrogatif'}, - {'type': 'pronom', 'match': 'pronom personnel', 'o': 'pronom personnel'}, - {'type': 'pronom', 'match': 'pronom possessif', 'o': 'pronom possessif'}, - {'type': 'pronom', 'match': 'pronom relatif', 'o': 'pronom relatif'}, - - {'type': 'verbe', 'match': 'verb', 'o': 'verbe'}, - {'type': 'verbe', 'match': 'verbe', 'o': 'verbe'}, - {'type': 'verbe', 'match': 'verbe pronominal', 'o': 'verbe pronominal'} -] - diff --git a/template.py b/template.py deleted file mode 100644 index fa0394a..0000000 --- a/template.py +++ /dev/null @@ -1,1086 +0,0 @@ - -""" - -File of template. - -To deal with Wikicode format. - -""" - -template = {'info': '(Informatique)', - 'informatique': '(Informatique)', - 'regex': '(Regex)', - 'mathématiques': '(Mathématiques)', - 'paléographie': '(Paléographie)', - 'math': '(Mathématiques)', - 'statistiques': '(Statistiques)', - 'stat': '(Statistiques)', - 'géostatistique': '(Géostatistiques)', - 'montagnes': '(Géostatistiques)', - 'géostatistiques': '(Géostatistiques)', - 'départements': '(Géostatistiques)', - 'morphologie végétale': '(Morphologie végétale)', - 'mot-valise': '(Mot-valise)', - 'déserts': '(Géostatistiques)', - 'typog': '(Typographie)', - 'logi': '(Logique)', - 'logique': '(Logique)', - 'ironique': '(Ironique)', - 'iron': '(Ironique)', - 'ironie': '(Ironique)', - 'linguistique': '(Linguistique)', - 'métaplasmes': '(Linguistique)', - 'vieilli': '(Vieilli)', - 'vieux': '(Vieilli)', - 'obsolète': '(Désuet)', - 'désuet': '(Désuet)', - 'familier': '(Familier)', - 'très familier': '(Très amilier)', - 'chiromancie': '(Chiromancie)', - 'climatologie': '(Climatologie)', - 'cnidaires': '(Zoologie)', - 'singes': '(Zoologie)', - 'quagga': '(Zoologie)', - 'argot': '(Familier)', - 'argot internet': '(1337)', - 'argot Internet': '(1337)', - 'argot policier': '(Argot policier)', - 'argot militaire': '(Argot militaire)', - 'argot poilu': '(Argot militaire)', - 'argot polytechnicien': '(Argot de l\'X)', - 'argot scolaire': '(Argot scolaire)', - 'argot typographes': '(Argot de typographes)', - 'argot voleurs': '(Argot)', - 'jeux vidéo': 'Jeux vidéo', - 'internet': '(Internet)', - 'Internet': '(Internet)', - 'vulgaire': '(Vulgaire)', - 'vulg': '(Vulgaire)', - 'popu': '(Populaire)', - 'injur': '(Injurieux)', - 'insultes': '(Injurieux)', - 'intelligence artificielle': '(IA)', - 'interjection': '(Interjection)', - 'soutenu': '(Soutenu)', - 'sout': '(Soutenu)', - 'régio': '(Régionalisme)', - 'régional': '(Régionalisme)', - 'régionalisme': '(Régionalisme)', - 'créatures': '(Mythologie)', - 'stéréotype': '(Stéréotype)', - 'divinités': '(Mythologie)', - 'mythol': '(Mythologie)', - 'stéréochimie': '(Stéréochimie)', - 'formule chimique': '(Chimie)', - 'chimie': '(Chimie)', - 'substance': '(Chimie)', - 'substances': '(Chimie)', - 'biochimie': '(Biohimie)', - 'bioch': '(Biohimie)', - 'enzymes': '(Biochimie)', - 'thérapies': '(Thérapies)', - 'cours d’eau': '(Géographie)', - 'plans d\'eau': '(Géographie)', - 'jeu de go': '(Jeu de go)', - 'mythologie grecque': '(Anthroponyme)', - 'jazz': '(Musique)', - 'jeux': '(Jeux)', - 'musiques': '(Musique)', - 'musique': '(Musique)', - 'musiciens': '(Musique)', - 'musi': '(Musique)', - 'pêche': '(Pêche)', - 'pêch': '(Pêche)', - 'hist': '(Histoire)', - 'histologie': '(Histoire)', - 'histoire': '(Histoire)', - 'anciennes divisions': '(Histoire)', - 'anciennes localités': '(Histoire)', - 'téléphonie': '(Téléphonie)', - 'télécom': '(Télécommunications)', - 'télécoms': '(Télécommunications)', - 'télécommunications': '(Télécommunications)', - 'comm': '(Commerce)', - 'commerce': '(Commerce)', - 'commerces': '(Commerce)', - 'e-commerce': '(E-commerce)', - 'maçonnerie': '(Maçonnerie)', - 'maçon': '(Maçonnerie)', - 'architecture': '(Architecture)', - 'architecture des ordinateurs‎': '(Architecture des ordinateurs)', - 'architecture des ordinateurs': '(Architecture des ordinateurs)', - 'archi': '(Architecture)', - 'technique': '(Technique)', - 'tech': '(Technique)', - 'meubres': '(Mobilier)', - 'mobilier': '(Mobilier)', - 'automatique': '(Automatique)', - 'automo': '(Automobile)', - 'auto': '(Automobile)', - 'automobile': '(Automobile)', - 'véhicules': '(Véhicules)', - 'véhicule': '(Véhicules)', - 'voitures': '(Véhicules)', - 'anatomie': '(Anatomie)', - 'muscles': '(Anatomie)', - 'muscle': '(Anatomie)', - 'anat': '(Anatomie)', - 'un os': '(Anatomie)', - 'squelette': '(Anatomie)', - 'musculation': '(Musculation)', - 'justice': '(Justice)', - 'échecs': '(Échecs)', - 'théâtre': '(Théâtre)', - 'théât': '(Théâtre)', - 'audiovi': '(Audiovisuel)', - 'audiovisuel': '(Audiovisuel)', - 'minéralogie': '(Minéralogie)', - 'minéraux': '(Minéralogie)', - 'minér': '(Minéralogie)', - 'Mme': 'Mme', - 'moderne': '(Moderne)', - 'genres littéraires': '(Littéraire)', - 'genres musicaux': '(Musique)', - 'poét': '(Littéraire Poétique)', - 'poétique': '(Littéraire Poétique)', - 'poés': '(Littéraire Poétique)', - 'points cardinaux': '(Géographie)', - 'poires': '(Botanique)', - 'prunes': '(Botanique)', - 'pommes': '(Botanique)', - 'poésie': '(Littéraire Poétique)', - 'didactique': '(Didactique)', - 'didact': '(Didactique)', - 'néol': '(Néologisme)', - 'néologisme': '(Néologisme)', - 'archaïsme': '(Archaïsme)', - 'roches': '(Pétrographie)', - 'wiki': '(jargon des Wikis)', - 'localités': '(Géographie)', - 'région': '(Géographie)', - 'régions': '(Géographie)', - 'géologie': '(Géologie)', - 'géol': '(Géologie)', - 'géométrie': '(Géométrie)', - 'géomatique': '(Géomatique)', - 'géophysique': '(Géophysique)', - 'géom': '(Géométrie)', - 'rugby': '(Rugby)', - 'tennis': '(Tennis)', - 'tennis de table': '(Tennis de table)', - 'sport': '(Sport)', - 'volley': '(Sport)', - 'triathlon': '(Triathlon)', - 'sportifs': '(Sport)', - 'sports': '(Sport)', - 'patinage': '(Patinage)', - 'roller': '(Patinage)', - 'pâtisserie': '(Pâtisserie)', - 'pâtisseries': '(Pâtisserie)', - 'ciné': '(Cinéma)', - 'cinéma': '(Cinéma)', - 'cirque': '(Cirque)', - 'philo': '(Philosophie)', - 'philosophie': '(Philosophie)', - 'psychologie': '(Psychologie)', - 'psychanalyse': '(Psychanalyse)', - 'psychia': '(Psychiatrie)', - 'psychiatrie': '(Psychiatrie)', - 'psycho': '(Psychologie)', - 'psychotropes': '(Psychotropes)', - 'psychol': '(Psychologie)', - 'religion': '(Religion)', - 'religions': '(Religion)', - 'religieux': '(Religion)', - 'reli': '(Religion)', - 'christianisme': '(Christianisme)', - 'protestantisme': '(Christianisme)', - 'catholicisme': '(Catholicisme)', - 'dinosaures': '(Paléontologie)', - 'paléontologie': '(Paléontologie)', - 'poules': '(Zoologie)', - 'rongeurs': '(Zoologie)', - 'préciser': '(À préciser)', - 'préhistoire': '(Préhistoire)', - 'prestidigitation': '(Prestidigitation)', - 'prnl': 'pronominal', - 'probabilités': '(Probabilités)', - 'procédure': '(Justice)', - 'propre': '(Sens propre)', - 'protéines': '(Biochimie)', - 'chevaux': '(Zoologie)', - 'poissons': '(Zoologie)', - 'raies': '(Ichtyologie)', - 'dindons': '(Zoologie)', - 'chien': '(Zoologie)', - 'céphalopodes': '(Zoologie)', - 'diplomatie': '(Diplomatie)', - 'céramique': '(Arts de la céramique)', - 'escalade': '(Escalade)', - 'escrime': '(Escrime)', - 'états': '(État)', - 'céréales': '(Botanique)', - 'légumes': '(Botanique)', - 'lexicographie': '(Lexicographie)', - 'lézards': '(Zoologie)', - 'cervidés': '(Zoologie)', - 'cétacés': '(Zoologie)', - 'caséologie': '(Zoologie)', - 'caséologie‎': '(Zoologie)', - 'pétrochimie': '(Pétrochimie)', - 'islam': '(Islam)', - 'bouddhisme': '(Bouddhisme)', - 'bouddhisme‎': '(Bouddhisme)', - 'liturgie': '(Liturgie orthodoxe)', - 'arthropodes': '(arthropodes)', - 'arts martiaux': '(Art martiaux)', - 'couteaux': '(Couteaux)', - 'armes': '(Armement)', - 'armures': '(Armement)', - 'armement': '(Armement)', - 'guerre': '(Militaire)', - 'soldats': '(Militaire)', - 'militaire': '(Militaire)', - 'mili': '(Militaire)', - 'artillerie': '(Militaire)', - 'marine': '(Marine)', - 'avant 1835': '(Avant 1835)', - 'ortho1990': '(Orthographe rectifiée de 1990)', - 'outils': '(Outils)', - 'ustensiles': '(Cuisine)', - 'desserts': '(Cuisine)', - 'viandes': '(Cuisine)', - 'dessin': '(Dessin)', - 'étoiles': '(Astronomie)', - 'astronomie': '(Astronomie)', - 'astron': '(Astronomie)', - 'astrol': '(Astrologie)', - 'astrologie': '(Astrologie)', - 'astronautique': '(Astronautique)', - 'astrophysique': '(Astrophysique)', - 'athlétisme': '(Athlétisme)', - 'course à pied': '(Athlétisme)', - 'chimie organique': '(Chimie organique)', - 'chimie physique': '(Chimie)', - 'atomes': '(Chimie)', - 'chim': '(Chimie)', - 'attention': 'Note ⚠️:', - 'non standard': 'Note ⚠️: (Mot d\'usage non standard)', - 'non attesté': 'Note ⚠️: (Mot d\'usage non attesté)', - 'Audet': 'Audet', - 'Boudoux': 'Boudoux', - 'Euzennat': 'Euzennat', - 'féminin': '(Au féminin)', - 'au féminin': '(Au féminin)', - 'figures': '(Rhétorique)', - 'rhéto': '(Rhétorique)', - 'rhétorique': '(Rhétorique)', - 'au figuré': '(Au figuré)', - 'au masculin': '(Au masculin)', - - 'infographie': '(Infographie)', - 'dermatologie': '(Dermatologie)', - 'fiscalité': '(Fiscalité)', - 'finances': '(Finance)', - 'finance': '(Finance)', - 'finan': '(Finance)', - 'travail': '(Travail)', - 'beaux-arts': '(Beaux-arts)', - 'transport': '(Transport)', - 'transp': '(Transport)', - 'transports': '(Transport)', - 'mythologie': '(Mythologie)', - 'arts': '(Arts)', - 'figuré': '(Au sens figuré)', - 'méton': '(Par métonymie)', - 'au singulier': '(Au singulier)', - 'p': '(Au pluriel)', - 'au pluriel': '(Au pluriel)', - 'propriété': '(Droit)', - 'dabeur': '(Droit)', - 'droit': '(Droit)', - 'geocacher': '(Droit)', - 'crimes': '(Droit)', - 'délits': '(Droit)', - 'droit féodal': '(Droit féodal)', - 'cristallographie': '(Cristallographie)', - 'élec': '(Électricité)', - 'électricité': '(Électricité)', - 'électron': '(Électronique)', - 'composants': '(Électronique)', - 'composants électriques': '(Électronique)', - 'comptabilité': '(Comptabilité)', - 'compta': '(Comptabilité)', - 'électronique': '(Électronique)', - 'électrot': '(Électronique)', - 'électrotechnique': '(Électronique)', - 'péjoratif': '(Péjoratif)', - 'souvent péjoratif': '(Péjoratif)', - 'péj': '(Péjoratif)', - 'gastronomie': '(Gastronomie)', - 'héraldique': '(Héraldique)', - 'héral': '(Héraldique)', - 'meuble': '(Meuble)', - 'meubles': '(Meuble)', - 'microbiologie': '(Microbiologie)', - 'meubles héraldiques': '(Héraldique)', - 'beaucoup plus courant': '(Courant)', - 'plus courant': '(Courant)', - 'peu usité': '(Peu usité)', - 'p us': '(Peu usité)', - 'p-us': '(Peu usité)', - 'pyrotechnie': '(Pyrotechnie)', - - 'barriérage': '(Usage critiqué)', - 'rare': '(Rare)', - 'beaucoup moins courant': '(Rare)', - 'moins courant': '(Rare)', - 'b-m-cour': '(Rare)', - 'rare': '(Rare)', - 'plus rare': '(Rare)', - 'pl-rare': '(Rare)', - 'très-rare': '(Très rare)', - 'très très rare': '(Très rare)', - 'très rare': '(Très rare)', - 'ex-rare': '(Extrêmement rare)', - 'famille': '(Famille)', - 'fantastique': '(Fantastisque)', - 'fanta': '(Fantastisque)', - 'fant': '(Fantastisque)', - - 'extrêmement rare': '(Extrêmement rare)', - 'renseignement': '(Renseignement)', - 'reproduction': '(Reproduction)', - 'reliure': '(Reliure)', - 'littéraire': '(Littéraire)', - 'litt': '(Littéraire)', - 'livre': '(Livre)', - 'logistique': '(Logistique)', - 'Loiret': '(Loiret)', - 'loisirs': '(Loisirs)', - 'Lorraine': '(Lorraine)', - 'louchébem': '(Louchébem)', - 'lusi': '(Lusitanisme)', - 'Luxembourg': '(Luxembourg)', - 'littérature': '(Littéraire)', - 'cartographie': '(Cartographie)', - 'neurologie': '(Neurologie)', - 'neurol': '(Neurologie)', - 'médecine': '(Médecine)', - 'pédiatrie': '(Médecine)', - 'pédologie': '(Pédologie)', - 'pédol': '(Pédologie)', - 'peinture': '(Peinture)', - 'philatélie': '(Philatélie)', - 'phobies': '(Médecine)', - 'phonétique': '(Phonétique)', - 'phonologie': '(Phonologie)', - 'ophtalmologie': '(Médecine)', - 'optimisation': '(Optimisation)', - 'particules': '(Physique)', - 'optique': '(Physique)', - 'phys': '(Physique)', - 'physiol': '(Physiologie)', - 'physiologie': '(Physiologie)', - 'phytosociologie': '(Phytosociologie)', - 'oncologie': '(Médecine)', - 'obstétrique': '(Médecine)', - 'méde': '(Médecine)', - 'antonomase': '(Médecine)', - 'aphérèse': 'Aphérèse', - 'apiculture': '(Apiculture)', - 'apJC': 'Antiquité', - 'avJC': 'Antiquité', - 'apocope': '(Apocope)', - 'application': '(Couche application)', - 'couche application': '(Couche OSI application)', - 'couche liaison': '(Couche OSI liaison)', - 'couche physique': '(Couche OSI physique)', - 'couche réseau': '(Couche OSI réseau)', - 'couche session': '(Couche OSI session)', - 'couche transport': '(Couche OSI transport)', - 'apposition': '(En apposition)', - 'baby-foot': '(Baby-foot)', - 'bactéries': '(Bactériologie)', - 'bactériologie': '(Bactériologie)', - 'bandes dessinées': '(BD)', - 'baseball': '(Baseball)', - 'base de données': '(BDD)', - 'basket': '(Basket-ball)', - 'basket-ball': '(Basket-ball)', - 'basketball': '(Basket-ball)', - 'bâtiment': '(Construction)', - 'BDD': '(BDD)', - 'TAAF': '(Vocabulaire des TAAF)', - 'taille de pierre': '(Taille de pierre)', - - - 'chir': '(Chirurgie)', - 'urban': '(Urbanisme)', - 'urbanisme': '(Urbanisme)', - 'chirurgie': '(Chirurgie)', - 'photo': '(Photographie)', - 'photographie': '(Photographie)', - 'transitif': '(Transitif)', - 't': '(Transitif)', - 'transit': '(Transitif)', - 'trans': '(Transitif)', - 'intransitif': '(Intransitif)', - 'intrans': '(Intransitif)', - 'i': '(Intransitif)', - 'ibid': '(ibid.)', - 'illégalité': '(Illégalité)', - 'impersonnel': '(Impersonnel)', - 'ichtyologie': '(Ichtyologie)', - 'pronl': '(Pronominal)', - 'pronominal': '(Pronominal)', - 'forme pronominale': '(Pronominal)', - 'physique': '(Physique)', - 'nanotechnologie': '(Physique)', - 'ébauch-exe': '', - 'ébauche-exe': '', - 'ébauche-déf': '', - 'ébauche-étym': '', - 'mécanique': '(Mécanique)', - 'méca': '(Mécanique)', - 'médecine non conv': '(Médecine non conventionnelle)', - 'médecine non conventionnelle': '(Médecine non conventionnelle)', - 'temps géologiques': '(Géologie)', - 'tératologie': '(Tératologie)', - 'temps': '(Chronologie)', - 'télé': '(Média)', - 'télévision': '(Média)', - 'média': '(Média)', - 'presse': '(Média)', - 'radio': '(Média)', - 'politique': '(Politique)', - 'polit': '(Politique)', - 'LGBT': '(LGBT)', - 'économie': '(Économie)', - 'écon': '(Économie)', - 'juri': '(Droit)', - 'manège': '(Équitation)', - 'marbrerie': '(Marbrerie)', - 'maréchalerie': '(Maréchalerie)', - 'équitation': '(Équitation)', - 'hippisme': '(Équitation)', - 'impr': '(Imprimerie)', - 'imprimerie': '(Imprimerie)', - 'industriel': '(Industrie)', - 'industrie': '(Industrie)', - 'indus': '(Industrie)', - 'usines': '(Industrie)', - 'indus pétrolière': '(Petro mafia)', - 'raffinage': '(Pétro mafia)', - 'informel': '(Informel)', - 'insectes': '(Entomologie)', - 'mouches': '(Entomologie)', - 'Moyen Âge': '(Moyen Âge)', - 'instruments': '(Musique)', - 'boucherie': '(Boucherie)', - 'distinctions': '(Distinctions)', - 'documents': '(Média)', - 'doute': '(information à vérifier)', - 'vaudou': '(Vaudou)', - 'médicaments': '(Pharmacologie)', - 'drogue': '(Pharmacologie)', - 'drogues': '(Pharmacologie)', - 'mélioratif': '(Mélioratif)', - 'pharma': '(pharmacologie)', - 'surf': '(Surf)', - - - 'Québec': '(Québec)', - 'QC': '(Québec)', - 'québec': '(Québec)', - 'Canada': '(Canada)', - 'CA': '(Canada)', - 'BE': '(Belgique)', - 'France': '(France)', - 'Inde': '(Inde)', - 'Liban': '(Liban)', - 'Japon': '(Japon)', - 'jardi': '(Jardinage)', - 'jardinage': '(Jardinage)', - 'Franche-Compté': '(Franche-Compté)', - 'franc-maçonnerie': '(Franc-maçonnerie)', - 'Europe': '(Europe)', - 'Espagne': '(Espagne)', - 'Roumanie': '(Roumanie)', - 'Royaume-Uni': '(Royaume-Uni)', - 'Pays basque': '(Pays basque)', - 'pelote': '(Pelote Basque)', - 'Australie': '(Australie)', - 'Russie': '(Russie)', - 'Rwanda': '(Rwanda)', - 'Saint-Pierre-et-Miquelon': '(Saint-Pierre-et-Miquelon)', - 'Autriche': '(Autriche)', - 'Auvergne': '(Auvergne)', - 'Touraine': '(Touraine)', - 'Occitanie': '(Occitanie)', - 'Égypte': '(Égypte)', - 'USA': '(États-Unis)', - 'États-Unis': '(États-Unis)', - 'Normandie': '(Normandie)', - 'Congo-Kinshasa': '(Congo-Kinshasa)', - 'République Démocratique du Congo': '(Congo-Kinshasa)', - 'RDC': '(Congo-Kinshasa)', - 'RDCongo': '(Congo-Kinshasa)', - 'Congo-Brazzaville': '(Congo-Brazzaville)', - 'Bordelais': '(Bordelais)', - 'Lyon': '(Lyon)', - 'Mâconnais': '(Lyon)', - 'lyonnais': '(Lyon)', - 'Champagne': '(Champagne)', - 'Nice': '(Nice)', - 'Lille': '(Lille)', - 'Paris': '(Paris)', - 'Marseille': '(Marseille)', - 'Midi toulousain': '(Midi)', - 'Midi': '(Midi)', - 'champignon': '(Mycologie)', - 'champignons': '(Mycologie)', - 'Beaujolais': '(Beaujolais)', - 'Bourdonnais': '(Bourdonnais)', - 'Boureau-Louvet': '(Boureau-Louvet)', - 'Bourgogne': '(Bourgogne)', - 'reptiles': '(Zoologie)', - 'requins': '(Zoologie)', - 'mollusques': '(Zoologie)', - 'échinodermes': '(Zoologie)', - 'marsupial': '(Zoologie)', - 'marsupiaux': '(Zoologie)', - 'bovins': '(Zoologie)', - 'crustacés': '(Zoologie)', - 'boxe': '(Boxe)', - 'b-pl-cour': '(Courant)', - 'cour': '(Courant)', - 'courant': '(Courant)', - 'crypto': '(Cryptologie)', - 'cryptologie': '(Cryptologie)', - 'cryptographie': '(Cryptologie)', - 'cryptomonnaie': '(Cryptologie)', - 'cryptomonnaies': '(Cryptologie)', - 'bridge': '(Bridge)', - 'Mâconnais': '(Mâconnais)', - 'Nantes': '(Nantes)', - 'Vendée': '(Vendée)', - 'Velay': '(Velay)', - 'Picardie': '(Picardie)', - 'Poitou': '(Poitou)', - 'Vosges': '(Vosges)', - 'Provence': '(Provence)', - 'Rhône-Alpes': '(Rhône-Alpes)', - 'rire': '(😄)', - 'sourire': '(😄)', - 'Niger': '(Niger)', - 'Nicaragua': '(Nicaragua)', - 'natation': '(Natation)', - 'navigation': '(Navigation)', - 'Écosse': '(Écosse)', - 'Lyonnais': '(Lyon)', - 'Savoie': '(Savoie)', - 'Guadeloupe': '(Guadeloupe)', - 'Martinique': '(Martinique)', - 'Réunion': '(Réunion)', - 'Guyane': '(Guyane)', - 'Maurice': '(Guyane)', - 'Mayotte': '(Mayotte)', - 'Haïti': '(Haïti)', - 'herpétologie': '(Herpétologie)', - 'Bretagne': '(Bretagne)', - 'Madagascar': '(Madagascar)', - 'magnétisme': '(Magnétisme)', - 'maintenance': '(Maintenance)', - 'Maghreb': '(Maghreb)', - 'france': '(France)', - 'FR': '(France)', - 'fr': '(France)', - 'Belgique': '(Belgique)', - 'Suisse': '(Suisse)', - 'CH': '(Suisse)', - 'suisse': '(Suisse)', - 'Acadie': '(Acadie)', - 'Louisiane': '(Louisiane)', - 'Languedoc-Roussillon': '(Languedoc-Roussillon)', - 'Languedoc': '(Languedoc)', - 'Limousin': '(Limousin)', - 'Vietnam': '(Viêt Nam)', - 'Viêt Nam': '(Viêt Nam)', - 'Afrique': '(Agrique)', - 'Mali': '(Mali)', - 'Burkina Faso': '(Burkina Faso)', - 'Sénégal': '(Sénégal)', - 'Bénin': '(Bénin)', - 'Togo': '(Togo)', - 'Gabon': '(Gabon)', - 'Tchad': '(Tchad)', - 'Gascogne': '(Gascogne)', - 'Gaspésie': '(Gaspésie)', - 'Géliot': '(Héraldique)', - 'généalogie': '(Généalogie)', - 'généralement': '(Généralement)', - 'généralement singulier': '(Généralement au singulier)', - 'Cameroun': '(Cameroun)', - 'Centrafrique': '(Centrafrique)', - 'Mauritanie': '(Mauritanie)', - 'Berry': '(Berry)', - 'Afrique du Sud': '(Afrique du Sud)', - 'Algérie': '(Algérie)', - 'Maroc': '(Maroc)', - 'Tunisie': '(Tunisie)', - 'Orient': '(Orient)', - 'ornement': '(Ornement)', - 'maroquinerie': '(Maroquinerie)', - 'marque': '(Marque)', - 'Allemagne': '(Allemagne)', - 'Alsace': '(Alsace)', - 'Amérique du Nord': '(Amérique du Nord)', - 'Amérique du Sud': '(Amérique du Sud)', - 'Nord-Pas-de-Calais': '(Nord-Pas-de-Calais)', - 'Nouvelle-Calédonie': '(Nouvelle-Calédonie)', - 'Terre-Neuve': '(Terre-Neuve)', - 'nucléaire': '(Nucléaire)', - 'nucl': '(Nucléaire)', - 'numismatique': '(Numismatique)', - 'numis': '(Numismatique)', - 'nutrition': '(Nutrition)', - 'Anjou': '(Anjou)', - 'Antilles': '(Antilles)', - 'Aquitaine': '(Aquitaine)', - 'Asie centrale': '(Asie centrale)', - 'Kirghizistan': '(Asie centrale)', - 'Chine': '(Chine)', - 'saliculture': '(Saliculture)', - 'satellites': '(Astonomie)', - 'saut en hauteur': '(Saut en hauteur)', - 'sciences': '(Sciences)', - 'scientifiques': '(Scientifiques)', - 'scol': '(Scolaire)', - 'scolaire': '(Scolaire)', - 'sculpture': '(Sculpture)', - 'secourisme': '(Secourisme)', - 'seigneuries': '(Histoire)', - - - 'CB': '(Citizen-band)', - 'bibli': '(Bibliothéconomie)', - 'bibliothéconomie': '(Bibliothéconomie)', - 'assurance': '(Assurance)', - 'arboriculture': '(Arboriculture)', - 'anthropologie': '(Anthropologie)', - 'peupliers': '(Botanique)', - 'agrumes': '(Botanique)', - 'algues': '(Botanique)', - 'fleurs': '(Botanique)', - 'aïkido': '(Aïkido)', - 'éléments': '(Chimie)', - 'alcaloïdes': '(Chimie)', - 'alliage': '(Chimie)', - 'alpinisme': '(Alpinisme)', - 'alchimie': '(Alchimie)', - 'alcools': '(Boisson)', - 'cocktails': '(Boisson)', - 'bières': '(Boisson)', - 'algèbre': '(Algèbre)', - 'orfèvrerie': '(Bijou)', - 'bijou': '(Bijou)', - 'bijouterie': '(Bijou)', - 'joaillerie': '(Bijou)', - 'jonglerie': '(Jonglerie)', - 'judaïsme': '(Judaïsme)', - 'judo': '(Judo)', - 'karaté': '(Karaté)', - 'kung-fu': '(Kung-fu)', - 'Jura': '(Jura)', - 'billard': '(Billard)', - 'coiffure': '(Coiffure)', - 'biogéographie': '(Biogéographie)', - 'biol': '(Biologie)', - 'biologie cellulaire': '(Biologie cellulaire)', - 'bivalves': '(Malacologie)', - 'b-m-cour': '(Rare)', - 'm-cour': '(Plus Rare)', - 'bonsaï': '(Bonsaï)', - - 'calendrier': '(Chronologie)', - 'agrohomardinenomie': '(Agronomie)', - 'dames:': '(Jeu de Dames)', - 'danse': '(Dance)', - 'danses': '(Dance)', - 'dauphinois': '', - 'pâtes': '(Cuisine)', - 'pâtes alimentaires': '(Cuisine)', - 'bâteaux': '(Cuisine)', - 'cuisine': '(Cuisine)', - 'cuis': '(Cuisine)', - 'aliments': '(Cuisine)', - 'préparations': '(Cuisine)', - 'canoë-kayak': '(Canoë-kayak)', - 'confiserie': '(Confiserie)', - 'confiseries': '(Confiserie)', - 'colorimétrie': '(Colorimétrie)', - 'couture': '(Couture)', - 'cout': '(Couture)', - 'textile': '(Textile)', - 'tissage': '(Textile)', - 'tissus': '(Textile)', - 'textiles': '(textile)', - 'couverture': '(Couvertures)', - 'broderie': '(Textile)', - 'vêtements': '(Vêtements)', - 'habil': '(Vêtements)', - 'vête': '(Vêtements)', - 'chaussures': '(Vêtements)', - 'couvre-chefs': '(Vêtements)', - 'coléoptères': '(Zoologie)', - 'mammifères': '(Zoologie)', - 'crabes': '(Zoologie)', - 'écureils': '(Zoologie)', - 'chauves-souris': '(Zoologie)', - 'carnivore': '(Zoologie)', - 'vétérinaire': '(Médecine vétérinaire)', - 'vexillologie': '(Vexillologie)', - 'cartes': '(Cartes à jouer)', - 'poker': '(Poker)', - 'jeux de cartes': '(Cartes à jouer)', - 'tonnellerie': '(Tonnellerie)', - 'topographie': '(Topographie)', - 'caprins': '(Zoologie)', - 'camélidés': '(Zoologie)', - 'antilopes': '(Zoologie)', - 'animaux': '(Zoologie)', - 'zool': '(Zoologie)', - 'zoologie': '(Zoologie)', - 'zootechnie': '(Zoologie)', - 'serpents': '(Zoologie)', - 'serrurerie': '(Serrurerie)', - 'fauconnerie': '(Fauconnerie)', - 'sentiments': '(Psychologie)', - 'yoga': '(Yoga)', - 'yogana': '(Yoga)', - 'virologie': '(Virologie)', - 'virus': '(Virologie)', - 'viticulture': '(viticulture)', - 'volcanologie': '(Géologie)', - 'mf': 'masculin et féminin identiques', - 'œnologie': '(Œnologie)', - 'vins': '(Œnologie)', - 'œnol': '(Œnologie)', - 'oenologie': '(Œnologie)', - 'cépages': '(Œnologie)', - 'oenol': '(Œnologie)', - 'papeterie': '(Papeterie)', - 'papèterie': '(Papeterie)', - 'ornithologie': '(Ornithologie)', - 'palmipèdes': '(Ornithologie)', - 'oiseaux': '(Ornithologie)', - 'ornithol': '(Ornithologie)', - 'entomol': '(Entomologie)', - 'papillons': '(Entomologie)', - 'entomologie': '(Entomologie)', - 'pharmacologie': '(Pharmacologie)', - 'pharmacie': '(Pharmacologie)', - 'épithète': '(Employé comme épithète)', - 'symboles unités': '(Métrologie)', - 'instruments de mesure': '(Métrologie)', - 'unités': '(Métrologie)', - 'unité': '(Métrologie)', - 'métro': '(Métrologie)', - 'métrol': '(Métrologie)', - 'métrologie': '(Métrologie)', - 'vents': '(Météorologie)', - 'verlan': '(Verlan)', - 'météorologie': '(Météorologie)', - 'météorol': '(Météorologie)', - 'météo': '(Météorologie)', - 'cordonnerie': '(Cordonnerie)', - 'Corée du Nord': '(Corée du Nord)', - 'cosmétique': '(Cosmétique)', - 'Côte d’Ivoire': '(Côte d’Ivoire)', - 'robotique': '(Robotique)', - 'science-fiction': '(SF)', - 'sci-fi': '(SF)', - 'pathologie': '(Nosologie)', - 'maladie': '(Nosologie)', - 'nosologie': '(Nosologie)', - 'maladies': '(Nosologie)', - 'réciproque': '(réciproque)', - 'populaire': '(Par abuus de langage)', - 'enfantin': '(Langage enfantin)', - 'parler gaga': '(Langage enfantin)', - 'Parler gaga': '(Langage enfantin)', - 'enfant': '(Langage enfantin)', - 'par métonymie': '(Linguistique)', - 'métonymie': '(Linguistique)', - 'langues': '(Linguistique)', - 'lang': '(Linguistique)', - 'langages': '(Linguistique)', - 'SMS': '(Langage SMS)', - 'langage SMS': '(Langage SMS)', - 'Lang': '(Linguistique)', - 'ling': '(Linguistique)', - 'langage Java': '(Informatique)', - 'protocoles': '(Réseaux)', - 'réseaux': '(Réseaux)', - 'POO': '(Programmation Orientée Objet)', - 'absolument': '(Absolument, Sans complément)', - 'OTAN': '(OTAN)', - 'absol': '(Absolument, Sans complément)', - 'VII': '(Antiquité)', - 'antiq': '(Antiquité)', - 'Antiquité': '(Antiquité)', - 'antiquité': '(Antiquité)', - 'topol': '(Topologie)', - 'topologie': '(Topologie)', - 'topon': '(Toponymie)', - 'toponymes': '(Toponymie)', - 'toponymes‎': '(Toponymie)', - 'territoires': '(Toponymie)', - 'toponymie': '(Toponymie)', - 'quartiers': '(Toponymie)', - 'ferroviaire': '(Chemin de fer)', - 'ferro': '(Chemin de fer)', - 'chemin de fer': '(Chemin de fer)', - 'typographie': '(Typographie)', - 'typo': '(Typographie)', - 'diacritiques': '(Grammaire)', - 'dialectes': '(Dialecte)', - 'langue': '(Linguistique)', - 'humour': '(Humour)', - 'management': '(Management)', - 'ufologie': '(Ufologie)', - 'marketing': '(Marketing)', - 'publicité': '(Marketing)', - 'plaisanterie': '(Humour)', - 'plais': '(Humour)', - 'plance à neige': '(Snowboard)', - 'snowboard': '(Snowboard)', - 'planche à roulettes': '(Plance à roulettes)', - 'skateboard': '(Plance à roulettes)', - 'plomberie': '(Plomberie)', - 'plongée': '(Plongée)', - 'Marne': '(Marne)', - 'ski alpin': '(Ski alpin)', - 'socialisme': '(Socialisme)', - 'sociologie': '(Sociologie)', - 'sylviculture': '(Sylviculture)', - 'sylv': '(Sylviculture)', - 'lacs': '(Géographie)', - 'pays': '(Géographie)', - 'océanographie': '(Océanographie)', - 'tourisme': '(Tourisme)', - 'tradit': '(Orthographe traditionnelle)', - 'détroits': '(Géographie)', - 'gentilés': '(Géographie)', - 'chaînes de montagnes': '(Géographie)', - 'géographie': '(Géographie)', - 'géog': '(Géographie)', - 'îles': '(Géographie)', - 'île': '(Géographie)', - 'provinces': '(Géographie)', - 'botanique': '(Botanique)', - 'fruits': '(Botanique)', - 'phyton': '(Botanique)', - 'botan': '(Botanique)', - 'arbres': '(Botanique)', - 'familles de plantes': '(Botanique)', - 'plantes': '(Botanique)', - 'dentisterie': '(Dentisterie)', - 'cyclisme': '(Cyclisme)', - 'vélo': '(Cyclisme)', - 'motocyclisme': '(Motocyclisme)', - 'moto': '(Motocyclisme)', - 'Moto': '(Motocyclisme)', - 'prog': '(Informatique)', - 'programmation': '(Informatique)', - 'programation': '(Informatique)', - 'anglicismes informatiques': '(Anglicisme informatique)', - 'anglicisme informatique': '(Anglicisme informatique)', - 'germanisme': '(Germanisme)', - 'italianisme': '(Italianisme)', - 'latinisme': '(Latinisme)', - 'latinisme droit': '(Latinisme du Droit)', - 'hispanisme': '(Hispanisme)', - 'hisp': '(Hispanisme)', - 'histoire de France': '(Histoire)', - 'monarchie': '(Histoire)', - 'histol': '(Histologie)', - 'horticulture': '(Horticulture)', - 'hydrobiologie': '(Hydrobiologie)', - 'hydrologie': '(Hydrologie)', - 'monnaies': '(Numismatique)', - - 'versification': '(Versification)', - 'giraffidés': '(Zoologie)', - 'vers': '(Zoologie)', - 'tortues': '(Zoologie)', - 'glaciologie': '(Glaciologie)', - 'gladiateurs': '(Antiquité)', - 'angl': '(Anglicisme)', - 'golf': '(Golf)', - 'gymnastique': '(Gym)', - 'gram': '(Grammaire)', - 'théologie': '(Théologie)', - 'théologie': '(Théol)', - 'semi-logarithmique': '(Informatique)', - 'thermodynamique': '(Thermodynamique)', - 'graph': '(Théorie des graphes)', - 'anglicisme': '(Anglicisme)', - 'faux anglicisme': '(Faux anglicisme)', - 'paume': '(Jeu de paume)', - 'Union européenne': '(Union européenne)', - 'abréviation': '(Abréviation)', - 'abréviation de': '(Abréviation)', - 'par ext': 'Par extension; ', - 'euphémisme': 'Par euphémisme; ', - 'exagération': 'Par hyperbole; ', - 'dérision': 'Par dérision; ', - 'par extension': 'Par extension; ', - 'analyse': '(Analyse)', - 'anal': 'Par analogie; ', - 'par analogie': 'Par analogie; ', - 'exploitation forestière': '(Exploitation forestière)', - 'expression': '(Expression)', - 'analogie': 'Par analogie; ', - 'part': 'En particulier; ', - 'en particulier': 'En particulier; ', - 'particulier': 'En particulier; ', - 'spécialement': 'En particulier; ', - 'spéc': 'En particulier; ', - 'spécifiquement': '(Spécifiquement)', - 'archaïque': '(Archaïque)', - 'arch': '(Archaïque)', - 'archéologie': '(Archéologie)', - 'Argadz': '(Argot des Gadz’Arts ?!)', - 'agriculture': '(Agriculture)', - 'élevage': '(Agriculture)', - 'éleva': '(Agriculture)', - 'embryologie': '(Embryologie)', - 'agri': '(Agriculture)', - 'sexualité': '(Sexualité)', - 'sexe': '(Sexualité)', - 'numéro': 'n°', - 'biologie': '(Biologie)', - 'parasitologie': '(Biologie)', - 'micro-biologie': '(Micro-biologie)', - 'grammaire': '(Grammaire)', - 'ellipse': '(Par ellipse)', - 'par ellipse': '(Par ellipse)', - 'écologie': '(Écologie)', - 'éco': '(Écologie)', - 'bateaux': '(Navigation)', - 'ethnologie': '(Ethnologie)', - 'ethnobiologie': '(Ethnologie)', - 'usage': 'Note d\'usage: ', - 'note': 'Note: ', - 'réfléchi': '(Réfléchi)', - 'cf': '', - 'réf ?': '', - 'RÉF': '', - 'référence nécessaire': '', - 'périodique': '', - 'article': '', - 'Article': '', - 'périodique ': '', - 'lire en ligne': '', - 'lien vidéo': '', - 'Lien web ': '', - 'Lien web': '', - 'lien web': '', - 'lien brisé': '', - 'Lien brisé': '', - 'ouvrage': '', - 'Ouvrage': '', - 'compo': '', - 'écouter': '', - 'voir': '', - 'pron': '', # Prononciation - 'réf': '', # Référence - 'cit_réf': '', # Référence - 'cit réf': '', # Référence - 'trad+': '', - 'p.': 'p.', - 'trad-': '', - 'source': '', # Source - '?': '', # Source - 'réf?': '', # Source - 'Wikipédia': '', - 'Wikisource': '', - 'wsp': '', - 'WSP': '', - - - 'vitrerie': '(Vitrerie)', - 'miroiterie': '(Miroiterie)', - 'menuiserie': '(Menuiserie)', - 'menu': '(Menuiserie)', - 'charpenterie': '(Charpenterie)', - 'charpente': '(Charpenterie)', - 'charronnerie': '(Charronerie)', - 'chasse': '(Chasse)', - 'hindouisme': '(Hindouisme)', - 'gravure': '(Gravue)', - 'tauromachie': '(Tauromachie)', - 'catch': '(Catch)', - 'cosmétologie': '(Cosmétologie)', - 'parfumerie': '(Cosmétologie)', - 'mycologie': '(Mycologie)', - 'mycol': '(Mycologie)', - 'aéro': '(Aéronautique)', - 'aéronautique': '(Aéronautique)', - 'avion': '(Aéronautique)', - 'avions': '(Aéronautique)', - 'paléontol': '(Paléontologie)', - 'occultisme': '(Occultisme)', - 'indénombrable': '(Indénombrable)', - 'indén': '(Indénombrable)', - 'dénombrable': '(Dénombrable)', - 'police': '(Police)', - 'Pologne': '(Pologne)', - 'Polynésie française': '(Polynésie française)', - 'sigle': '(Sigle)', - 'Seychelles': '(Seychelles)', - 'sidérurgie': '(Sidérurgie)', - 'affectueux': '(Affectueux)', - 'technologie': '(Technologie)', - 'technol': '(Technologie)', - 'machines': '(Technologie)', - 'boissons': '(Boisson)', - 'boisson': '(Boisson)', - 'construction': '(Construction)', - 'édifices': '(Construction)', - 'constr': '(Construction)', - 'titres': '(Noblesse)', - 'noblesse': '(Histoire)', - 'horlogerie': '(Horlogerie)', - 'numismatique': '(Numismatique)', - 'génétique': '(Génétique)', - 'génét': '(Génétique)', - 'génériquement': '(Génériquement)', - 'admin': '(Administration)', - 'administration': '(Administration)', - 'journalisme': '(Journalisme)', - 'édition': '(Édition)', - 'fromages': '(Fromage)', - 'fromage': '(Fromage)', - 'éducation': '(Éducation)', - 'éduc': '(Éducation)', - 'hapax': '(Hapax)', - 'handisport': '(Handisport)', - 'handball': '(Handball)', - 'football': '(Football)', - 'foot': '(Football)', - 'foresterie': '(Foresterie)', - 'metal': '(Métallurgie)', - 'métal': '(Métallurgie)', - 'métallurgie': '(Métallurgie)', - 'fonderie': '(Métallurgie)', - 'métaphore': '(Métaphore)', - 'acoustique': '(Acoustique)', - 'acoustique': '(Acoustique)', - 'acron': '(Acronyme)', - 'acronyme': '(Acronyme)', - - - } diff --git a/ui.py b/ui.py index e2a166a..c198cfd 100644 --- a/ui.py +++ b/ui.py @@ -5,21 +5,22 @@ tui_show_example = True def show_terminal(word): - """Display the definition to the terminal - - @word Format: - { - mot: '' - cat-gram: '' - def: [{ - def: '' - ex: ['', ''] - }] - API: '' - infos: ['', ''] - genre: '' - accord: '' - } + """ + Display the definition to the terminal + + @word Format: + { + mot: '' + cat-gram: '' + def: [{ + def: '' + ex: ['', ''] + }] + API: '' + infos: ['', ''] + genre: '' + accord: '' + } """ indent = tui_indent * ' ' print(indent + word['mot']) @@ -45,7 +46,3 @@ def show_terminal(word): print(indent + '\t\t * ' + ex) print('') - -def show_web(word): - """Display the definition in HTML format""" - pass diff --git a/web.py b/web.py index c5e0b1c..82ad696 100644 --- a/web.py +++ b/web.py @@ -1,3 +1,7 @@ +""" +A simple Web application to serve dicofr +""" + from flask import Flask, request, Response, send_file import msgpack # from flask_cors import CORS @@ -20,17 +24,26 @@ app.config.from_object(__name__) @app.route('/', methods=['GET']) def index_client(): + """ + Send the single file + """ return send_file("index.html", mimetype='text/html') def get_def_reg(w): + """ + Search a word, can deal with regex and casse problem. + """ if res := dicofr.get_def_sql_reg(w): return msgpack.packb(res) + # Recherche du mot en minuscule elif res := dicofr.get_def_sql_reg(w.lower()): return msgpack.packb(res) + # Recherche du mot en nom propre elif res := dicofr.get_def_sql_reg(w.title()): return msgpack.packb(res) + else: return Response("", status=404) @@ -38,6 +51,9 @@ def get_def_reg(w): @app.route('/def', methods=['GET']) def get_def(): + """ + Retrieve a definition + """ w = request.args.get('w') if '_' in w: -- cgit v1.2.3