BuildLangModel: fix hardcoded file names.

This commit is contained in:
Jehan 2015-11-30 19:18:25 +01:00
parent 3e5d37a6b5
commit dc5caa46bc

View File

@ -215,7 +215,8 @@ def visit_pages(titles, depth, lang, logfd):
visit_pages (next_titles, depth + 1, lang, logfd)
build_log = current_dir + '/BuildLangModelLogs/LangFrenchModel.log'
language_c = lang.name.replace('-', '_').title()
build_log = current_dir + '/BuildLangModelLogs/Lang{}Model.log'.format(language_c)
logfd = open(build_log, 'w')
logfd.write('= Logs of language model for {} ({}) =\n'.format(lang.name, lang.code))
logfd.write('\n- Generated by {}'.format(os.path.basename(__file__)))
@ -385,7 +386,6 @@ logfd.write("\nRest: {}".format(1 - ratio_512 - ratio_1024))
c_code += "\n */\n"
language_c = lang.name.replace('-', '_').title()
LM_str = 'static const PRUint8 {}LangModel[]'.format(language_c)
LM_str += ' =\n{'
for line in range(0, freq_count):
@ -434,7 +434,7 @@ for charset in charsets:
c_code += SM_str
lang_model_file = current_dir + '/../src/LangModels/LangFrenchModel.cpp'
lang_model_file = current_dir + '/../src/LangModels/Lang{}Model.cpp'.format(language_c)
with open(lang_model_file, 'w') as cpp_fd:
cpp_fd.write(c_code)