123456789101112131415161718192021222324252627282930313233343536 |
- import argparse
- import math
- import numpy as np
- parser = argparse.ArgumentParser()
- parser.add_argument('--start', type=int, default=1)
- parser.add_argument('--end', type=int, default=12)
- parser.add_argument('--step', type=int, default=1)
- args = parser.parse_args()
- words_8763 = ''
- with open('dict_eng_8763.txt', 'r', encoding='utf-8') as fp:
- words_8763 = fp.readlines()
- fp.close()
- eng_list = []
- for word in words_8763:
- eng_list.append(word.rstrip('\n'))
- wp = open('eng_text.txt', 'w')
- for i in range(args.start, args.end+1, args.step):
- for j in range(0, 360):
- arr1 = np.random.rand(i)*len(eng_list)
- text = ''
- k = 1
- for num in arr1:
- if k == len(arr1):
- text += eng_list[math.floor(num)] + '\n'
- else:
- text += eng_list[math.floor(num)] + ' '
- k += 1
- wp.write(text)
- wp.close()
|