rain1024 commited on
Commit
893eb0a
·
1 Parent(s): 7abf816
Files changed (4) hide show
  1. data/dev.txt +0 -0
  2. data/test.txt +0 -0
  3. data/train.txt +0 -0
  4. generate_dataset.py +9 -19
data/dev.txt CHANGED
The diff for this file is too large to render. See raw diff
 
data/test.txt CHANGED
The diff for this file is too large to render. See raw diff
 
data/train.txt CHANGED
The diff for this file is too large to render. See raw diff
 
generate_dataset.py CHANGED
@@ -16,19 +16,16 @@ for file in [train_file, dev_file, test_file]:
16
  with open(file, "w") as f:
17
  f.write("")
18
 
19
-
20
- f1 = open(train_file, "a")
21
- f2 = open(dev_file, "a")
22
- f3 = open(test_file, "a")
23
-
24
- f = f1
25
  content = ""
26
  for j, s in enumerate(sentences):
27
- if j % 100 == 0 and j > 0:
28
- if j >= 8000 and j < 9000:
29
- f = f2
30
- else:
31
- f = f3
 
 
32
  f.write(content)
33
  content = ""
34
  logger.info(j)
@@ -42,11 +39,4 @@ for j, s in enumerate(sentences):
42
  tag = "I-W"
43
  content += token + "\t" + tag + "\n"
44
  content += "\n"
45
- # write end
46
- f.write(content)
47
- content = ""
48
- logger.info(j)
49
-
50
- f1.close()
51
- f2.close()
52
- f3.close()
 
16
  with open(file, "w") as f:
17
  f.write("")
18
 
19
+ f = open(train_file, "a")
 
 
 
 
 
20
  content = ""
21
  for j, s in enumerate(sentences):
22
+ if j == 8000:
23
+ f.close()
24
+ f = open(dev_file, "a")
25
+ if j == 9000:
26
+ f.close()
27
+ f = open(test_file, "a")
28
+ if j % 1000 == 999:
29
  f.write(content)
30
  content = ""
31
  logger.info(j)
 
39
  tag = "I-W"
40
  content += token + "\t" + tag + "\n"
41
  content += "\n"
42
+ f.close()