modified data script
Browse files- data/create_data.py +12 -11
- requirements.txt +2 -1
data/create_data.py
CHANGED
@@ -7,28 +7,29 @@ def main():
|
|
7 |
# Create JSON data
|
8 |
|
9 |
WordList = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q']
|
10 |
-
ValidWordList = ['
|
11 |
file = open('data.json', 'w')
|
12 |
file2 = open('validData.json', 'w')
|
13 |
for k in range(10000):
|
14 |
-
file.write('{"translation":{"
|
15 |
if k <= 1000:
|
16 |
-
file2.write('{"translation":{"
|
17 |
-
randomNum = random.randint(1,
|
|
|
18 |
word = []
|
19 |
word2 = []
|
20 |
for i in random.sample(range(1, 100), randomNum):
|
21 |
-
word.append(WordList[i%
|
22 |
-
if k <=
|
23 |
-
word2.append(ValidWordList[i%
|
24 |
-
wordStr = ''.join(word)
|
25 |
wordRev = wordStr[::-1]
|
26 |
if k <= 1000:
|
27 |
-
wordStr2 = ''.join(word2)
|
28 |
wordRev2 = wordStr2[::-1]
|
29 |
-
file2.write(f'"{wordStr2}", "rev" :"{wordRev2}"')
|
30 |
file2.write('}}\n')
|
31 |
-
file.write(f'"{wordStr}", "rev" :"{wordRev}"')
|
32 |
file.write('}}\n')
|
33 |
|
34 |
|
|
|
7 |
# Create JSON data
|
8 |
|
9 |
WordList = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q']
|
10 |
+
ValidWordList = ['l','m', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
|
11 |
file = open('data.json', 'w')
|
12 |
file2 = open('validData.json', 'w')
|
13 |
for k in range(10000):
|
14 |
+
file.write('{"translation":{"le":')
|
15 |
if k <= 1000:
|
16 |
+
file2.write('{"translation":{"le":')
|
17 |
+
#randomNum = random.randint(1, 10)
|
18 |
+
randomNum = 10
|
19 |
word = []
|
20 |
word2 = []
|
21 |
for i in random.sample(range(1, 100), randomNum):
|
22 |
+
word.append(WordList[i%9])
|
23 |
+
if k <= 1000:
|
24 |
+
word2.append(ValidWordList[i%11])
|
25 |
+
wordStr = ' '.join(word)
|
26 |
wordRev = wordStr[::-1]
|
27 |
if k <= 1000:
|
28 |
+
wordStr2 = ' '.join(word2)
|
29 |
wordRev2 = wordStr2[::-1]
|
30 |
+
file2.write(f'"{wordStr2}.", "rev" :"{wordRev2}."')
|
31 |
file2.write('}}\n')
|
32 |
+
file.write(f'"{wordStr}.", "rev" :"{wordRev}."')
|
33 |
file.write('}}\n')
|
34 |
|
35 |
|
requirements.txt
CHANGED
@@ -6,4 +6,5 @@ sacrebleu >= 1.4.12
|
|
6 |
py7zr
|
7 |
torch >= 1.3
|
8 |
evaluate
|
9 |
-
transformers
|
|
|
|
6 |
py7zr
|
7 |
torch >= 1.3
|
8 |
evaluate
|
9 |
+
transformers
|
10 |
+
wandb
|