Skip to content

Commit

Permalink
Merge pull request #18 from zhugeyicixin/master
Browse files Browse the repository at this point in the history
Code cleaning
  • Loading branch information
zhugeyicixin authored Nov 3, 2020
2 parents e8540d8 + fef3211 commit 5690b04
Show file tree
Hide file tree
Showing 9 changed files with 451 additions and 59 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Use:

from materials_entity_recognition import MatRecognition
model = MatRecognition()
all_materials, precursors, targets, other_materials = model.mat_recognize(input_para_text)
result = model.mat_recognize(input_para_text)

Parameters:

Input: plain text of a paragraph
Output: 4 list objects, which are all materials, precursors, targets, other materials, respectively.
Output: a list of dict objects, containing all materials, precursors, targets, and other materials for each sentence in the input paragraph.

3 changes: 3 additions & 0 deletions materials_entity_recognition/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from .scripts import MatIdentification
from .scripts import MatRecognition
from .scripts import MatTPIdentification
from .scripts import MatIdentificationBagging
from .scripts import MatRecognitionBagging
from .scripts import MatTPIdentificationBagging

__author__ = 'Tanjin He'
__maintainer__ = 'Tanjin He'
Expand Down
27 changes: 26 additions & 1 deletion materials_entity_recognition/data/test_paras.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions materials_entity_recognition/scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from .mat_models import MatIdentification
from .mat_models import MatRecognition
from .mat_models import MatTPIdentification
from .mat_models import MatIdentificationBagging
from .mat_models import MatRecognitionBagging
from .mat_models import MatTPIdentificationBagging

__author__ = 'Tanjin He'
__maintainer__ = 'Tanjin He'
Expand Down
13 changes: 9 additions & 4 deletions materials_entity_recognition/scripts/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,15 @@ def cap_feature(s):
return 3


def prepare_sentence(str_words, word_to_id, char_to_id, lower=False,
use_key_word=False, use_topic=False,
use_CHO=False, use_eleNum=False, input_tokens=[],
original_para_text=''):
def prepare_sentence(str_words,
word_to_id,
char_to_id,
lower=False,
use_CHO=False,
use_eleNum=False,
input_tokens=[],
original_para_text='',
):
"""
Prepare a sentence for evaluation.
Expand Down
Loading

0 comments on commit 5690b04

Please sign in to comment.