Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'lower' #6

Open
ciaochiaociao opened this issue Mar 13, 2020 · 0 comments
Open

AttributeError: 'NoneType' object has no attribute 'lower' #6

ciaochiaociao opened this issue Mar 13, 2020 · 0 comments

Comments

@ciaochiaociao
Copy link
Owner

cols_format = [{'type': 'predict', 'col_num': 4, 'tagger': 'ner'},
                 {'type': 'gold', 'col_num': 3, 'tagger': 'ner'},
			    {'type': 'predict', 'col_num': 2, 'tagger': 'chunk'},
			   {'type': 'predict', 'col_num': 1, 'tagger': 'pos'},]
parser = ConllParser('conll.bert.test.gold.pred.iob2', cols_format, tag_scheme='iob2')
parser.set_entity_mentions(tag_policy='conll')
parser.obtain_statistics(entity_stat=True, source='predict', tag_policy='conll')
#conll.bert.test.gold.pred.iob2
-DOCSTART- -X- -X- O O
 
SOCCER NN B-NP O O
- : O O O
JAPAN NNP B-NP B-LOC B-LOC

Output:

doc_separator: -DOCSTART-
---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-8-ed175d9106e6> in <module>
      4 			   {'type': 'predict', 'col_num': 1, 'tagger': 'pos'},]
      5 parser = ConllParser('conll.bert.test.gold.pred.iob2', cols_format, tag_scheme='iob2')
----> 6 parser.set_entity_mentions(tag_policy='conll')
      7 parser.obtain_statistics(source='predict', tag_policy='conll')
      8 

/d/ner_error_analysis/nlu/parser.py in set_entity_mentions(self, tag_policy)
    234                     try:
    235                         for entity_mention in sentence.entity_mentions_dict[source]:
--> 236                             attr_name = preffix + '_' + entity_mention.type.lower() + 's'
    237                             self.__getattribute__(attr_name).append(entity_mention)  # set self.pred_pers/self.gold_miscs/...
    238                     except KeyError:

AttributeError: 'NoneType' object has no attribute 'lower'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant