Exemplo n.º 1
0
    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)

# Release created objects
del lexical_resource
Exemplo n.º 2
0
# 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,
                   user_path + "na/result/dictionary_eng.tex",
                   preamble=user_path + "na/preamble.tex",
                   introduction=user_path + "na/introduction_eng.tex",
                   lmf2tex=tex_eng,
Exemplo n.º 3
0
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