Beehzod commited on
Commit
d06cbbf
1 Parent(s): b307731

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md CHANGED
@@ -42,4 +42,35 @@ Example data instance:
42
  "transcription": "Bugun ertalab Gyotenikiga taklifnoma oldim."
43
  }
44
 
 
 
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  "transcription": "Bugun ertalab Gyotenikiga taklifnoma oldim."
43
  }
44
 
45
+ Data Preprocessing Recommended by Hugging Face
46
+ The following are data preprocessing steps advised by the Hugging Face team. They are accompanied by an example code snippet that shows how to put them to practice.
47
 
48
+ Many examples in this dataset have trailing quotations marks, e.g "Musibat yomonlarning zulmida emas, yaxshilarning jim turishida.". These trailing quotation marks do not change the actual meaning of the sentence, and it is near impossible to infer whether a sentence is a quotation or not a quotation from audio data alone. In these cases, it is advised to strip the quotation marks, leaving: the cat sat on the mat.
49
+
50
+ In addition, the majority of training sentences end in punctuation ( . or ? or ! ), whereas just a small proportion do not. In the dev set, almost all sentences end in punctuation. Thus, it is recommended to append a full-stop ( . ) to the end of the small number of training examples that do not end in punctuation.
51
+
52
+ ---
53
+
54
+ from datasets import load_dataset
55
+
56
+ ds = load_dataset("mozilla-foundation/common_voice_17", "en", use_auth_token=True)
57
+
58
+ def prepare_dataset(batch):
59
+ """Function to preprocess the dataset with the .map method"""
60
+ transcription = batch["sentence"]
61
+
62
+ if transcription.startswith('"') and transcription.endswith('"'):
63
+ # we can remove trailing quotation marks as they do not affect the transcription
64
+ transcription = transcription[1:-1]
65
+
66
+ if transcription[-1] not in [".", "?", "!"]:
67
+ # append a full-stop to sentences that do not end in punctuation
68
+ transcription = transcription + "."
69
+
70
+ batch["sentence"] = transcription
71
+
72
+ return batch
73
+
74
+ ds = ds.map(prepare_dataset, desc="preprocess dataset")
75
+
76
+ ---