1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- import sys
- import mmap
- import argparse
- import shutil
- import os
- from os import O_RDONLY, O_RDWR, O_WRONLY, O_TRUNC, O_CREAT, SEEK_END, SEEK_CUR, SEEK_SET
-
- def main(argc, argv):
- if argc < 2:
- print('Summary: add file to the corpus ', file=sys.stderr)
- print(f'Usage: {argv[0]} -c <corpus_dir>', file=sys.stderr)
- exit(1)
-
- ap = argparse.ArgumentParser()
-
-
- ap.add_argument("-c", "--corpus_dir", required=True,
- help="corpus directory where to add the file")
- args = vars(ap.parse_args())
-
-
- lang_list=os.getenv("FUZZ_VOICE")
- if(lang_list):
- list=lang_list+"_list"
- else:
- list="en_list"
- output_name = list+"_dict_corpus.txt"
- output_path=args['corpus_dir']+output_name
- output= open(output_path, "w")
-
- path="../../dictsource/"+list
-
-
- file = open( path, "r")
- lines=file.readlines()
- index=1
- for line in lines:
- if line[0]=='/' and line[1]=='/':
- continue
- res = line.split()
- if len(res):
- output.write("kw")
- output.write(str(index))
- index=index+1
- output.write("=")
- output.write(res[0])
- output.write('\n')
- file.close()
- output.close()
- if __name__ == "__main__":
- main(len(sys.argv), sys.argv)
|