Index: gc_lang/fr/build_data.py ================================================================== --- gc_lang/fr/build_data.py +++ gc_lang/fr/build_data.py @@ -304,10 +304,32 @@ ' "dWord": ' + json.dumps(dWord, ensure_ascii=False) + ",\n" + \ ' "lSet": ' + json.dumps(lSet, ensure_ascii=False) + ",\n" + \ ' "dMorph": ' + json.dumps(dMorph, ensure_ascii=False) + "\n}" open(sp+"/modules-js/phonet_data.json", "w", encoding="utf-8", newline="\n").write(sCode) + +def makeLocutions (sp, bJS=False): + "compile list of locutions in JSON" + print("> Locutions ", end="") + print("(Python et JavaScript)" if bJS else "(Python seulement)") + with open(sp+"/data/locutions.txt", 'r', encoding='utf-8') as hSrc: + dLocutions = {} + for sLine in hSrc.readlines(): + if not sLine.startswith("#") and sLine.strip(): + lElem = sLine.strip().split() + dCur = dLocutions + for sWord in lElem: + if sWord not in dCur: + dCur[sWord] = {} + dCur = dCur[sWord] + + sCode = "# generated data (do not edit)\n\n" + \ + "dLocutions = " + str(dLocutions) + "\n" + open(sp+"/modules/locutions.py", "w", encoding="utf-8", newline="\n").write(sCode) + if bJS: + open(sp+"/modules-js/locutions.json", "w", encoding="utf-8", newline="\n").write(json.dumps(dLocutions, ensure_ascii=False)) + def before (spLaunch, dVars, bJS=False): print("========== Build Hunspell dictionaries ==========") makeDictionaries(spLaunch, dVars['oxt_version']) @@ -315,5 +337,6 @@ def after (spLaunch, dVars, bJS=False): print("========== Build French data ==========") makeMfsp(spLaunch, bJS) makeConj(spLaunch, bJS) makePhonetTable(spLaunch, bJS) + makeLocutions(spLaunch, bJS) ADDED gc_lang/fr/data/locutions.txt Index: gc_lang/fr/data/locutions.txt ================================================================== --- gc_lang/fr/data/locutions.txt +++ gc_lang/fr/data/locutions.txt @@ -0,0 +1,8 @@ +à califourchon +à cœur joie +à cœur ouvert +à corps perdu +à perte de vue +à visage découvert +par ailleurs +par acquit de conscience ADDED gc_lang/fr/modules-js/locutions.json Index: gc_lang/fr/modules-js/locutions.json ================================================================== --- gc_lang/fr/modules-js/locutions.json +++ gc_lang/fr/modules-js/locutions.json @@ -0,0 +1,1 @@ +{"à": {"califourchon": {}, "cœur": {"joie": {}, "ouvert": {}}, "corps": {"perdu": {}}, "perte": {"de": {"vue": {}}}, "visage": {"découvert": {}}}, "par": {"ailleurs": {}, "acquit": {"de": {"conscience": {}}}}} Index: gc_lang/fr/modules-js/phonet_data.json ================================================================== --- gc_lang/fr/modules-js/phonet_data.json +++ gc_lang/fr/modules-js/phonet_data.json cannot compute difference between binary files ADDED gc_lang/fr/modules/locutions.py Index: gc_lang/fr/modules/locutions.py ================================================================== --- gc_lang/fr/modules/locutions.py +++ gc_lang/fr/modules/locutions.py @@ -0,0 +1,3 @@ +# generated data (do not edit) + +dLocutions = {'à': {'califourchon': {}, 'cœur': {'joie': {}, 'ouvert': {}}, 'corps': {'perdu': {}}, 'perte': {'de': {'vue': {}}}, 'visage': {'découvert': {}}}, 'par': {'ailleurs': {}, 'acquit': {'de': {'conscience': {}}}}} Index: gc_lang/fr/modules/phonet_data.py ================================================================== --- gc_lang/fr/modules/phonet_data.py +++ gc_lang/fr/modules/phonet_data.py cannot compute difference between binary files