jkot commited on
Commit
db42f9b
1 Parent(s): d448a85

Update czech_parliament_plenary_hearings.py

Browse files
czech_parliament_plenary_hearings.py CHANGED
@@ -3,6 +3,7 @@ import os
3
  import tarfile
4
  import librosa
5
  import datasets
 
6
  _LICENSE = "https://creativecommons.org/licenses/by/4.0/"
7
  _HOMEPAGE = "https://lindat.mff.cuni.cz/repository/xmlui/handle/11234/1-3126"
8
  _DATASET_URL = "https://lindat.mff.cuni.cz/repository/xmlui/bitstream/handle/11234/1-3126/snemovna.tar.xz"
@@ -40,7 +41,7 @@ class CzechParliamentPlenaryHearings(GeneratorBasedBuilder):
40
  citation=_CITATION,
41
  license=_LICENSE
42
  )
43
-
44
  def _split_generators(self, dl_manager):
45
  data_dir = dl_manager.download_and_extract(_DATASET_URL)
46
  data_dir = os.path.join(data_dir, 'ASR_DATA')
@@ -69,8 +70,10 @@ class CzechParliamentPlenaryHearings(GeneratorBasedBuilder):
69
  for audio_file in os.listdir(folder_path):
70
  if audio_file.endswith('.wav'):
71
  audio_path = os.path.join(folder_path, audio_file)
72
- transcription_path = os.path.join(
73
- folder_path, audio_file + '.trn')
 
 
74
  transcription = open(transcription_path).read().strip()
75
 
76
  audio, sr = librosa.load(audio_path, sr=16000)
 
3
  import tarfile
4
  import librosa
5
  import datasets
6
+ import spacy
7
  _LICENSE = "https://creativecommons.org/licenses/by/4.0/"
8
  _HOMEPAGE = "https://lindat.mff.cuni.cz/repository/xmlui/handle/11234/1-3126"
9
  _DATASET_URL = "https://lindat.mff.cuni.cz/repository/xmlui/bitstream/handle/11234/1-3126/snemovna.tar.xz"
 
41
  citation=_CITATION,
42
  license=_LICENSE
43
  )
44
+
45
  def _split_generators(self, dl_manager):
46
  data_dir = dl_manager.download_and_extract(_DATASET_URL)
47
  data_dir = os.path.join(data_dir, 'ASR_DATA')
 
70
  for audio_file in os.listdir(folder_path):
71
  if audio_file.endswith('.wav'):
72
  audio_path = os.path.join(folder_path, audio_file)
73
+ if split == "dev":
74
+ transcription_path = os.path.join(folder_path, audio_file[:-4] + '.txt')
75
+ else:
76
+ transcription_path = os.path.join(folder_path, audio_file + '.trn')
77
  transcription = open(transcription_path).read().strip()
78
 
79
  audio, sr = librosa.load(audio_path, sr=16000)