# Import user customized configuration # Les variables de type pylmflib.config.xml.TRUC correspondent à un attribut TRUC sous <Config><Language><lang> dans le fichier config.xml local ! from setting import tex_eng, tex_fra, tex_cmn, items, classify_lexicon # Read user configuration lexical_resource = pylmflib.read_config(user_path + "na/config.xml") # Read MDF file, generate UID and set lexicon identifier os.system("python2 " + user_path + "../pylmflib/utils/eol/eol.py -i " + user_path + "na/Dictionary.txt -o " + user_path + "na/result/dictionary-eol.txt") os.system("python2 " + user_path + "../pylmflib/utils/uid/uid.py -i " + user_path + "na/result/dictionary-eol.txt -o " + user_path + "na/result/dictionary-uid.txt") lexical_resource = pylmflib.read_mdf(id="na") # Classify lexicon (xml_order, xml_type) = pylmflib.read_sort_order(user_path + "na/sort_order.xml") classify_lexicon(lexical_resource.get_lexicon("na"), xml_order, xml_type) # Generate tables os.system("python2 " + user_path + "../pylmflib/utils/tables/tables.py -i " + user_path + "na/Dictionary.txt -e " + user_path + "na/result/table_eng.tex -f " + user_path + "na/result/table_fra.tex -c" + user_path + "na/result/table_cmn.tex") # Write LaTeX files: # anglais, français puis chinois pylmflib.write_tex(lexical_resource,
import pylmflib # Import user customized configuration from setting import lmf2tex, items # Read user configuration lexical_resource = pylmflib.read_config(user_path + "khaling/config.xml") # Run Perl script os.system("perl " + user_path + "../pylmflib/utils/ipa2devanagari/ipa2devanagari.pl " + user_path + "khaling/Dictionary.txt " + user_path + "khaling/result/dictionary-dev.txt") # Read MDF file and set lexicon identifier lexical_resource = pylmflib.read_mdf(id="khaling") # Classify lexicon sort_order = lambda character: ord(character.encode('utf-8').decode('utf-8')) lexical_resource.get_lexicon("khaling").sort_lexical_entries( items=items, sort_order=sort_order) # Generate paradigms os.system("perl " + user_path + "../pylmflib/utils/paradigms/paradigms.pl " + user_path + "khaling/verbs.txt " + user_path + "khaling/result/paradigms.tex") os.system("perl " + user_path + "../pylmflib/utils/paradigms/paradigms_eng.pl " + user_path + "khaling/verbs_eng.txt " + user_path + "khaling/result/paradigms_eng.tex") os.system("perl " + user_path +
if not os.path.exists(user_path + "na/result"): os.mkdir(user_path + "na/result") # Import LMF library import pylmflib # Import user customized configuration from setting import tex_eng, tex_fra, items, classify_lexicon # Read user configuration lexical_resource = pylmflib.read_config(user_path + "na/config.xml") # Read MDF file, generate UID and set lexicon identifier os.system("python " + user_path + "../pylmflib/utils/eol/eol.py -i " + user_path + "na/Dictionary.txt -o " + user_path + "na/result/dictionary-eol.txt") os.system("python " + user_path + "../pylmflib/utils/uid/uid.py -i " + user_path + "na/result/dictionary-eol.txt -o " + user_path + "na/result/dictionary-uid.txt") lexical_resource = pylmflib.read_mdf(id="na") # Classify lexicon (xml_order, xml_type) = pylmflib.read_sort_order(user_path + "na/sort_order.xml") classify_lexicon(lexical_resource.get_lexicon("na"), xml_order, xml_type) # Generate tables os.system("python " + user_path + "../pylmflib/utils/tables/tables.py -i " + user_path + "na/Dictionary.txt -e " + user_path + "na/result/table_eng.tex -f " + user_path + "na/result/table_fra.tex") # Write LaTeX files pylmflib.write_tex(lexical_resource, user_path + "na/result/dictionary_eng.tex", preamble=user_path + "na/preamble.tex", introduction=user_path + "na/introduction_eng.tex", lmf2tex=tex_eng, items=items, sort_order=xml_order, tables=[user_path + "na/result/table_eng.tex"], title="Online Na-English-Chinese-French Dictionary (version 1.0)") pylmflib.write_tex(lexical_resource, user_path + "na/result/dictionary_fra.tex", preamble=user_path + "na/preamble.tex", introduction=user_path + "na/introduction_fra.tex", lmf2tex=tex_fra, items=items, sort_order=xml_order, tables=[user_path + "na/result/table_fra.tex"], title=u"Dictionnaire na-chinois-français en ligne (version 1.0)", tex_language="french") # Release created objects del lexical_resource
# Create result folder if not os.path.exists(user_path + "japhug/result"): os.mkdir(user_path + "japhug/result") # Import LMF library import pylmflib # Import user customized configuration from setting import lmf2tex, items # Read user configuration lexical_resource = pylmflib.read_config(user_path + "japhug/config.xml") # Read MDF file and set lexicon identifier lexical_resource = pylmflib.read_mdf(id="japhug") # Classify lexicon xml_order = pylmflib.read_sort_order(user_path + "japhug/sort_order.xml") lexical_resource.get_lexicon("japhug").sort_lexical_entries( items=items, sort_order=xml_order) # Write LaTeX file pylmflib.write_tex(lexical_resource, user_path + "japhug/result/dictionary.tex", preamble=user_path + "japhug/preamble.tex", introduction=user_path + "japhug/introduction.tex", lmf2tex=lmf2tex, items=items, sort_order=xml_order)
os.mkdir(user_path + "khaling/result") # Import LMF library import pylmflib # Import user customized configuration from setting import lmf2tex, items # Read user configuration lexical_resource = pylmflib.read_config(user_path + "khaling/config.xml") # Run Perl script os.system("perl " + user_path + "../pylmflib/utils/ipa2devanagari/ipa2devanagari.pl " + user_path + "khaling/Dictionary.txt " + user_path + "khaling/result/dictionary-dev.txt") # Read MDF file and set lexicon identifier lexical_resource = pylmflib.read_mdf(id="khaling") # Classify lexicon sort_order = lambda character: ord(character.encode('utf-8').decode('utf-8')) lexical_resource.get_lexicon("khaling").sort_lexical_entries(items=items, sort_order=sort_order) # Generate paradigms os.system("perl " + user_path + "../pylmflib/utils/paradigms/paradigms.pl " + user_path + "khaling/verbs.txt " + user_path + "khaling/result/paradigms.tex") os.system("perl " + user_path + "../pylmflib/utils/paradigms/paradigms_eng.pl " + user_path + "khaling/verbs_eng.txt " + user_path + "khaling/result/paradigms_eng.tex") os.system("perl " + user_path + "../pylmflib/utils/paradigms/reflexive_paradigms.pl " + user_path + "khaling/reflexive_verbs.txt " + user_path + "khaling/result/reflexive_paradigms.tex") os.system("perl " + user_path + "../pylmflib/utils/paradigms/reflexive_paradigms_eng.pl " + user_path + "khaling/reflexive_verbs.txt " + user_path + "khaling/result/reflexive_paradigms_eng.tex") # Write LaTeX file pylmflib.write_tex(lexical_resource, user_path + "khaling/result/dictionary.tex", preamble=user_path + "khaling/preamble.tex", introduction=user_path + "khaling/introduction.tex", lmf2tex=lmf2tex, items=items, sort_order=sort_order, paradigms=[user_path + "khaling/result/paradigms.tex", user_path + "khaling/result/paradigms_eng.tex", user_path + "khaling/result/reflexive_paradigms.tex", user_path + "khaling/result/reflexive_paradigms_eng.tex"]) # Release created objects