Iker commited on
Commit
85b17c6
1 Parent(s): 05bf8c4

Upload Multilingual-Opinion-Target-Extraction.py

Browse files
Multilingual-Opinion-Target-Extraction.py CHANGED
@@ -62,11 +62,31 @@ class MOTE(datasets.GeneratorBasedBuilder):
62
  """MOTE dataset."""
63
 
64
  BUILDER_CONFIGS = [
65
- MOTEConfig(name="en", version=datasets.Version("1.0.0"), description="MOTEConfig English dataset"),
66
- MOTEConfig(name="es", version=datasets.Version("1.0.0"), description="MOTEConfig Spanish dataset"),
67
- MOTEConfig(name="fr", version=datasets.Version("1.0.0"), description="MOTEConfig French dataset"),
68
- MOTEConfig(name="ru", version=datasets.Version("1.0.0"), description="MOTEConfig Russian dataset"),
69
- MOTEConfig(name="tr", version=datasets.Version("1.0.0"), description="MOTEConfig Turkish dataset"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  ]
71
 
72
  def _info(self):
@@ -108,8 +128,14 @@ class MOTE(datasets.GeneratorBasedBuilder):
108
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
109
 
110
  return [
111
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
112
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
 
 
 
 
 
 
113
  ]
114
 
115
  def _generate_examples(self, filepath):
@@ -119,6 +145,7 @@ class MOTE(datasets.GeneratorBasedBuilder):
119
  tokens = []
120
  ner_tags = []
121
  for line in f:
 
122
  if line == "" or line == "\n":
123
  if tokens:
124
  yield guid, {
@@ -130,10 +157,9 @@ class MOTE(datasets.GeneratorBasedBuilder):
130
  tokens = []
131
  ner_tags = []
132
  else:
133
-
134
  splits = line.split()
135
- tokens.append(splits[0])
136
- ner_tags.append(splits[1].rstrip())
137
  # last example
138
  if tokens:
139
  yield guid, {
 
62
  """MOTE dataset."""
63
 
64
  BUILDER_CONFIGS = [
65
+ MOTEConfig(
66
+ name="en",
67
+ version=datasets.Version("1.0.0"),
68
+ description="MOTEConfig English dataset",
69
+ ),
70
+ MOTEConfig(
71
+ name="es",
72
+ version=datasets.Version("1.0.0"),
73
+ description="MOTEConfig Spanish dataset",
74
+ ),
75
+ MOTEConfig(
76
+ name="fr",
77
+ version=datasets.Version("1.0.0"),
78
+ description="MOTEConfig French dataset",
79
+ ),
80
+ MOTEConfig(
81
+ name="ru",
82
+ version=datasets.Version("1.0.0"),
83
+ description="MOTEConfig Russian dataset",
84
+ ),
85
+ MOTEConfig(
86
+ name="tr",
87
+ version=datasets.Version("1.0.0"),
88
+ description="MOTEConfig Turkish dataset",
89
+ ),
90
  ]
91
 
92
  def _info(self):
 
128
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
129
 
130
  return [
131
+ datasets.SplitGenerator(
132
+ name=datasets.Split.TRAIN,
133
+ gen_kwargs={"filepath": downloaded_files["train"]},
134
+ ),
135
+ datasets.SplitGenerator(
136
+ name=datasets.Split.TEST,
137
+ gen_kwargs={"filepath": downloaded_files["test"]},
138
+ ),
139
  ]
140
 
141
  def _generate_examples(self, filepath):
 
145
  tokens = []
146
  ner_tags = []
147
  for line in f:
148
+ line = line.strip()
149
  if line == "" or line == "\n":
150
  if tokens:
151
  yield guid, {
 
157
  tokens = []
158
  ner_tags = []
159
  else:
 
160
  splits = line.split()
161
+ tokens.append(splits[0].strip())
162
+ ner_tags.append(splits[1].strip())
163
  # last example
164
  if tokens:
165
  yield guid, {