-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheda.py
38 lines (27 loc) · 1.18 KB
/
eda.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from os.path import join
from underthesea_flow.reader.tagged_corpus import TaggedCorpus
def eda_vlsp_chunk():
total_corpus = TaggedCorpus()
for file in ["train", "test", "dev"]:
input_file = join("corpus", "vlsp_chunk", file + ".txt")
output_folder = join("eda", "vlsp_chunk", file)
corpus = TaggedCorpus()
corpus.load(input_file)
total_corpus.sentences += corpus.sentences
corpus.analyze(output_folder=output_folder, auto_remove=True)
total_corpus.analyze(output_folder=join("eda", "vlsp_chunk", "total"),
auto_remove=True)
def eda_vlsp2016():
total_corpus = TaggedCorpus()
for file in ["train", "test", "dev"]:
input_file = join("corpus", "vlsp2016", file + ".txt")
output_folder = join("eda", "vlsp2016", file)
corpus = TaggedCorpus()
corpus.load(input_file)
total_corpus.sentences += corpus.sentences
corpus.analyze(output_folder=output_folder, auto_remove=True)
total_corpus.analyze(output_folder=join("eda", "vlsp2016", "total"),
auto_remove=True)
if __name__ == '__main__':
# eda_vlsp_chunk()
eda_vlsp2016()