forked from aarish407/Style-Change-Detection-Using-BERT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinal.py
34 lines (26 loc) · 907 Bytes
/
final.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
import sys
import pickle
import os
import glob
import time
from GenerateEmbeddings import generate_embeddings_narrow, generate_embeddings_wide
# Initialize two directories
input_dir= sys.argv[1]
output_dir= sys.argv[2]
# Read the two datasets
input_path_narrow= input_dir + '/dataset-narrow'
input_path_wide= input_dir + '/dataset-wide'
# Create two subfolders within output dir, dataset-narrow and dataset-wide
output_path_narrow= output_dir + '/dataset-narrow'
output_path_wide= output_dir + '/dataset-wide'
os.mkdir(output_path_narrow)
os.mkdir(output_path_wide)
dataset_narrow= glob.glob(input_path_narrow+'/*.txt')
dataset_wide= glob.glob(input_path_wide+'/*.txt')
try:
generate_embeddings_narrow(dataset_narrow, input_path_narrow, output_path_narrow)
del dataset_narrow
generate_embeddings_wide(dataset_wide, input_path_wide, output_path_wide)
del dataset_wide
except:
pass