Skip to content

Commit

Permalink
try xmlr
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccorl committed Oct 14, 2020
1 parent e61bcb6 commit 7fc2714
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 139 deletions.
11 changes: 5 additions & 6 deletions transformer_srl/dataset_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ def _read(self, file_path: str):
"Filtering to only include file paths containing the %s domain",
self._domain_identifier,
)

for sentence in self._ontonotes_subset(
ontonotes_reader, file_path, self._domain_identifier
):
Expand All @@ -270,7 +269,9 @@ def _read(self, file_path: str):
f for f, v in zip(sentence.predicate_lemmas, verb_indicator) if v == 1
]
if not all(v == 0 for v in verb_indicator):
yield self.text_to_instance(tokens, verb_indicator, frames, lemmas, tags, sentence_id)
yield self.text_to_instance(
tokens, verb_indicator, frames, lemmas, tags, sentence_id
)

def text_to_instance( # type: ignore
self,
Expand All @@ -279,7 +280,7 @@ def text_to_instance( # type: ignore
frames: List[str] = None,
lemmas: List[str] = None,
tags: List[str] = None,
sentence_id = None
sentence_id=None,
) -> Instance:
"""
We take `pre-tokenized` input here, along with a verb label. The verb label should be a
Expand Down Expand Up @@ -384,9 +385,7 @@ def _get_predicate_labels(self, sentence, verb_indicator):
for i, v in enumerate(verb_indicator):
if v == 1:
label = (
"{}.{}".format(
sentence.predicate_lemmas[i], sentence.predicate_framenet_ids[i]
)
"{}.{}".format(sentence.predicate_lemmas[i], sentence.predicate_framenet_ids[i])
if sentence.predicate_framenet_ids[i].isdigit()
else sentence.predicate_framenet_ids[i]
)
Expand Down
Loading

0 comments on commit 7fc2714

Please sign in to comment.