Skip to content

Commit

Permalink
fixed problem with '-'
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Harnisch committed Nov 25, 2020
1 parent 39a242c commit 62d431d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flair/datasets/sequence_labeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ def _parse_token(self, line: str) -> Token:
tagging_format_prefix = split_at_first_hyphen[0]
tag_without_tagging_format = split_at_first_hyphen[1]
if self.label_name_map and tag_without_tagging_format in self.label_name_map.keys():
tag = tagging_format_prefix + "-" + self.label_name_map[tag_without_tagging_format] # for example, transforming 'B-OBJ' to 'B-part of speech object'
tag = tagging_format_prefix + "-" + self.label_name_map[tag_without_tagging_format].replace("-", " ") # for example, transforming 'B-OBJ' to 'B-part-of-speech-object'
else: # tag without prefix, for example tag='PPER'
if self.label_name_map and tag in self.label_name_map.keys():
tag = self.label_name_map[tag] # for example, transforming 'PPER' to 'person'
tag = self.label_name_map[tag].replace("-", " ") # for example, transforming 'PPER' to 'person'
token.add_label(task, tag)
if self.column_name_map[column] == self.SPACE_AFTER_KEY and fields[column] == '-':
token.whitespace_after = False
Expand Down

0 comments on commit 62d431d

Please sign in to comment.