davidstap commited on
Commit
78f21ac
·
1 Parent(s): 0064d3a

fix issue such that both l1_l2 and l2_l1 work

Browse files
Files changed (2) hide show
  1. README.md +0 -0
  2. ted_talks.py +5 -6
README.md CHANGED
The diff for this file is too large to render. See raw diff
 
ted_talks.py CHANGED
@@ -23,8 +23,7 @@ class TedTalksConfig(datasets.BuilderConfig):
23
  """BuilderConfig for TED talk dataset."""
24
 
25
  def __init__(self, language_pair=(None, None), **kwargs):
26
- # sort such that az_ar is same as ar_az
27
- self.language_pair = sorted(language_pair)
28
  self.source, self.target = self.language_pair[0], self.language_pair[1]
29
 
30
  name = f"{self.source}_{self.target}"
@@ -35,12 +34,12 @@ class TedTalksConfig(datasets.BuilderConfig):
35
  class TedTalks(datasets.GeneratorBasedBuilder):
36
  """TED talk data from http://phontron.com/data/ted_talks.tar.gz."""
37
 
38
- unique_pairs = sorted(set([
39
- "_".join(sorted([l1, l2]))
40
  for l1 in _LANGUAGES
41
  for l2 in _LANGUAGES
42
  if l1 != l2
43
- ]))
44
 
45
  BUILDER_CONFIGS = [
46
  TedTalksConfig(
@@ -150,4 +149,4 @@ class TedTalks(datasets.GeneratorBasedBuilder):
150
  source_sentences, target_sentences = zip(*source_target_pairs)
151
 
152
  for idx, (l1, l2) in enumerate(zip(source_sentences, target_sentences)):
153
- yield idx, {"translation": {self.config.source: l1, self.config.target: l2}}
 
23
  """BuilderConfig for TED talk dataset."""
24
 
25
  def __init__(self, language_pair=(None, None), **kwargs):
26
+ self.language_pair = language_pair
 
27
  self.source, self.target = self.language_pair[0], self.language_pair[1]
28
 
29
  name = f"{self.source}_{self.target}"
 
34
  class TedTalks(datasets.GeneratorBasedBuilder):
35
  """TED talk data from http://phontron.com/data/ted_talks.tar.gz."""
36
 
37
+ unique_pairs = [
38
+ "_".join([l1, l2])
39
  for l1 in _LANGUAGES
40
  for l2 in _LANGUAGES
41
  if l1 != l2
42
+ ]
43
 
44
  BUILDER_CONFIGS = [
45
  TedTalksConfig(
 
149
  source_sentences, target_sentences = zip(*source_target_pairs)
150
 
151
  for idx, (l1, l2) in enumerate(zip(source_sentences, target_sentences)):
152
+ yield idx, {"translation": {self.config.source: l1, self.config.target: l2}}