eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

create_dict_corpus_file.py 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/python3
  2. # /*
  3. # * Copyright (C) 2022 Anna Stan , Mamaodou Dramé Kalilou , Nicolas Morel
  4. # *
  5. # * This program is free software; you can redistribute it and/or modify
  6. # * it under the terms of the GNU General Public License as published by
  7. # * the Free Software Foundation; either version 3 of the License, or
  8. # * (at your option) any later version.
  9. # *
  10. # * This program is distributed in the hope that it will be useful,
  11. # * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # * GNU General Public License for more details.
  14. # *
  15. # * You should have received a copy of the GNU General Public License
  16. # * along with this program; if not, see: <http://www.gnu.org/licenses/>.
  17. # */
  18. import sys
  19. import mmap
  20. import argparse
  21. import shutil
  22. import os
  23. from os import O_RDONLY, O_RDWR, O_WRONLY, O_TRUNC, O_CREAT, SEEK_END, SEEK_CUR, SEEK_SET
  24. def main(argc, argv):
  25. if argc < 2:
  26. print('Summary: add file to the corpus ', file=sys.stderr)
  27. print(f'Usage: {argv[0]} -c <corpus_dir>', file=sys.stderr)
  28. exit(1)
  29. ap = argparse.ArgumentParser()
  30. # Add the arguments to the parser
  31. ap.add_argument("-c", "--corpus_dir", required=True,
  32. help="corpus directory where to add the file")
  33. args = vars(ap.parse_args())
  34. lang_list=os.getenv("FUZZ_VOICE")
  35. if(lang_list):
  36. list=lang_list+"_list"
  37. else:
  38. list="en_list"
  39. output_name = list+"_dict_corpus.txt"
  40. output_path=args['corpus_dir']+output_name
  41. output= open(output_path, "w")
  42. path="../../dictsource/"+list
  43. file = open( path, "r")
  44. lines=file.readlines()
  45. index=1
  46. for line in lines:
  47. if line[0]=='/' and line[1]=='/':
  48. continue
  49. res = line.split()
  50. if len(res):
  51. output.write("kw")
  52. output.write(str(index))
  53. index=index+1
  54. output.write("=")
  55. output.write(res[0])
  56. output.write('\n')
  57. file.close()
  58. output.close()
  59. if __name__ == "__main__":
  60. main(len(sys.argv), sys.argv)