asahi417 commited on
Commit
cccf8d7
1 Parent(s): b184add
Files changed (2) hide show
  1. download_audio.py +8 -12
  2. main.sh +11 -10
download_audio.py CHANGED
@@ -61,14 +61,11 @@ def get_metadata():
61
  meta_data_path = p_join("download", "meta", meta_data_filename)
62
  if not os.path.exists(meta_data_path.replace(".gz", "")):
63
  assert wget(url_metadata, output_file=meta_data_path)
64
- if direction == "enA-jaA":
65
- df = pd.read_csv(meta_data_path.replace(".gz", ""), sep=r'[\t\s]', header=None)
66
- df = df[[0, 2, 3, 4, 9, 10, 11, 12]]
67
- df.columns = ["id", "url", "duration_start", "duration_end", "laser_score", "direction", "side", "line_no"]
68
- else:
69
- raise NotImplementedError("")
70
- # df = pd.read_csv(meta_data_path.replace(".gz", ""), sep='\t', header=None)[[0, 2, 4, 6, 9, 10, 11, 10]]
71
- # df.columns = ["id", "url", "duration", "text_lid_score", "laser_score", "direction", "side", "line_no"]
72
  assert len(df["direction"].unique()) == 1
73
  df.pop("direction")
74
  return df.sort_values(by=["line_no", "side"])
@@ -101,10 +98,9 @@ def process_dataset():
101
  print(f"metadata: {len(df_metadata)}, {line_no_start} --> {line_no_end}")
102
  inputs = [g for line_no, g in df_metadata.groupby("line_no") if line_no_start <= line_no < line_no_end]
103
  print(f"filtered unique lines: {len(inputs)}")
104
- inputs = [g for g in inputs if len(g) == 2]
105
- print(f"removed != 2: {len(inputs)}")
106
- inputs = [g for g in inputs if len(g["side"].unique()) == 2 and set(g["side"].unique()) == sides]
107
- print(f"removed side != 2: {len(inputs)}")
108
  if n_pool == 1:
109
  for g in tqdm(inputs, total=len(inputs)):
110
  if not get_audio(g):
 
61
  meta_data_path = p_join("download", "meta", meta_data_filename)
62
  if not os.path.exists(meta_data_path.replace(".gz", "")):
63
  assert wget(url_metadata, output_file=meta_data_path)
64
+ df = pd.read_csv(meta_data_path.replace(".gz", ""), sep=r'[\t\s]', header=None)
65
+ df = df[[0, 2, 3, 4, 9, 10, 11, 12]]
66
+ df.columns = ["id", "url", "duration_start", "duration_end", "laser_score", "direction", "side", "line_no"]
67
+ if direction == "enA-jpn":
68
+ df = df[df["side"] == "enA"]
 
 
 
69
  assert len(df["direction"].unique()) == 1
70
  df.pop("direction")
71
  return df.sort_values(by=["line_no", "side"])
 
98
  print(f"metadata: {len(df_metadata)}, {line_no_start} --> {line_no_end}")
99
  inputs = [g for line_no, g in df_metadata.groupby("line_no") if line_no_start <= line_no < line_no_end]
100
  print(f"filtered unique lines: {len(inputs)}")
101
+ if direction == "enA-jaA":
102
+ inputs = [g for g in inputs if len(g["side"].unique()) == 2 and set(g["side"].unique()) == sides]
103
+ print(f"removed side != 2: {len(inputs)}")
 
104
  if n_pool == 1:
105
  for g in tqdm(inputs, total=len(inputs)):
106
  if not get_audio(g):
main.sh CHANGED
@@ -3,27 +3,28 @@
3
  ####################
4
  export DIRECTION="enA-jaA"
5
 
6
- # server 1
7
  export LINE_NO_START=0
8
- export LINE_NO_END=30000
9
  python download_audio.py
10
 
11
- export LINE_NO_START=30000
12
- export LINE_NO_END=60000
13
  python download_audio.py
14
 
15
- export LINE_NO_START=60000
16
- export LINE_NO_END=90000
17
  python download_audio.py
18
 
19
- export LINE_NO_START=90000
20
- export LINE_NO_END=120000
21
  python download_audio.py
22
 
23
- export LINE_NO_START=120000
24
- export LINE_NO_END=150000
25
  python download_audio.py
26
 
 
 
27
  # server 2
28
  export LINE_NO_START=150000
29
  export LINE_NO_END=180000
 
3
  ####################
4
  export DIRECTION="enA-jaA"
5
 
 
6
  export LINE_NO_START=0
7
+ export LINE_NO_END=50000
8
  python download_audio.py
9
 
10
+ export LINE_NO_START=50000
11
+ export LINE_NO_END=100000
12
  python download_audio.py
13
 
14
+ export LINE_NO_START=100000
15
+ export LINE_NO_END=150000
16
  python download_audio.py
17
 
18
+ export LINE_NO_START=150000
19
+ export LINE_NO_END=300000
20
  python download_audio.py
21
 
22
+ export LINE_NO_START=300000
23
+ export LINE_NO_END=360000
24
  python download_audio.py
25
 
26
+
27
+
28
  # server 2
29
  export LINE_NO_START=150000
30
  export LINE_NO_END=180000