ashraq commited on
Commit
26aa8bd
1 Parent(s): 01b858a

load dataset in streaming mode

Browse files
Files changed (1) hide show
  1. dhivehi-corpus.py +4 -3
dhivehi-corpus.py CHANGED
@@ -49,7 +49,8 @@ class DhivehiCorpus(datasets.GeneratorBasedBuilder):
49
 
50
  def _generate_examples(self, filepath, split):
51
  with open(filepath, encoding="utf8") as f:
52
- data = f.readlines()
53
- for id_, row in enumerate(data):
54
- yield id_, {"text": row.strip()}
 
55
 
49
 
50
  def _generate_examples(self, filepath, split):
51
  with open(filepath, encoding="utf8") as f:
52
+ id_ = 0
53
+ for line in f:
54
+ yield id_, {"text": line.strip()}
55
+ id_ += 1
56