-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuildData.py
71 lines (64 loc) · 2.5 KB
/
buildData.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import argparse
from DataProcessing.DataProcessor import DataProcessor
POSITIVE_REVIEW_STARS_LIMIT = 5
NEGATIVE_REVIEW_STARS_LIMIT = 1
NUM_OF_SENTENCES_LIMIT = 10
MIN_NUM_OF_WORDS_LIMIT = 2
MAX_NUM_OF_WORDS_LIMIT = 15
TEST_SIZE = 0.2
VALIDATION_SIZE = 0.2
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--positive_review_stars_limit",
type=int,
default=POSITIVE_REVIEW_STARS_LIMIT,
help="limit for positive reviews"
)
parser.add_argument("--negative_review_stars_limit",
type=int,
default=NEGATIVE_REVIEW_STARS_LIMIT,
help="limit for negative reviews"
)
parser.add_argument("--num_of_sentences_limit",
type=int,
default=NUM_OF_SENTENCES_LIMIT,
help="limit for the number of sentences in the review"
)
parser.add_argument("--min_num_of_words_limit",
type=int,
default=MIN_NUM_OF_WORDS_LIMIT,
help="limit for the minimum number of word in the review"
)
parser.add_argument("--max_num_of_words_limit",
type=int,
default=MAX_NUM_OF_WORDS_LIMIT,
help="limit for the maximum number of word in the review"
)
parser.add_argument("--test_size",
type=float,
default=TEST_SIZE,
help="test set size"
)
parser.add_argument("--validation_size",
type=float,
default=VALIDATION_SIZE,
help="validation set size"
)
parser.add_argument("--dataset_path",
type=str,
default=".data/yelp_academic_dataset_review.json",
help="path of the dataset"
)
opt = parser.parse_args()
data_processor = DataProcessor(
opt.positive_review_stars_limit,
opt.negative_review_stars_limit,
opt.num_of_sentences_limit,
opt.min_num_of_words_limit,
opt.max_num_of_words_limit,
opt.test_size,
opt.validation_size,
)
data_processor.process_data(opt.dataset_path)
if __name__ == "__main__":
main()