Skip to content

Commit

Permalink
Merge pull request #17 from zhugeyicixin/master
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
zhugeyicixin authored Feb 27, 2020
2 parents 79100f2 + 87a5c23 commit e8540d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions materials_entity_recognition/scripts/mat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def mat_recognize(self, input_para, materials=None, pre_tokens=None):
elif tag_started:
NER_label = 'I-Mat'
if NER_label == 'O':
input_SL_sent.append(tmp_token)
input_SL_sent.append(tmp_token.copy())
elif NER_label == 'B-Mat':
input_SL_sent.append({
'text': '<MAT>',
Expand Down Expand Up @@ -525,7 +525,7 @@ def mat_recognize(self, input_para, materials=None, pre_tokens=None):
elif tag_started:
NER_label = 'I-Mat'
if NER_label == 'O':
input_SL_sent.append(tmp_token)
input_SL_sent.append(tmp_token.copy())
elif NER_label == 'B-Mat':
input_SL_sent.append({
'text': '<MAT>',
Expand Down
20 changes: 10 additions & 10 deletions materials_entity_recognition/test/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
with open('../data/test_paras.json', 'r') as fr:
paras = json.load(fr)

# find materials
model_new = MatIdentification()
for tmp_para in paras[-1:]:
result = model_new.mat_identify(tmp_para)
pprint(result)

# # find targets/precursors
# model_new = MatRecognition()
# for tmp_para in paras:
# result = model_new.mat_recognize(tmp_para)
# # find materials
# model_new = MatIdentification()
# for tmp_para in paras[-1:]:
# result = model_new.mat_identify(tmp_para)
# pprint(result)

# find targets/precursors
model_new = MatRecognition()
for tmp_para in paras:
result = model_new.mat_recognize(tmp_para)
pprint(result)

0 comments on commit e8540d8

Please sign in to comment.