AnthonyMRios / pymetamap

Python wraper for MetaMap
170 stars 61 forks source link

Output one result with highest score #40

Open wclin2 opened 5 years ago

wclin2 commented 5 years ago

Hi,

I wonder is there a way to output only one result with the highest score for each detected entity? For example,

sents = ['metastatic disease']
concepts,error = mm.extract_concepts(sents)

concepts
[ConceptMMI(index='00000000', mm='MMI', score='14.64', preferred_name='Neoplasm Metastasis', cui='C0027627', semtypes='[neop]', trigger='["metastatic disease"-tx-1-"metastatic disease"-noun-0]', location='TX', pos_info='1/18', tree_codes='C04.697.650;C23.550.727.650'),

 ConceptMMI(index='00000000', mm='MMI', score='5.18', preferred_name='Metastatic Neoplasm', cui='C2939420', semtypes='[neop]', trigger='["Metastatic Disease"-tx-1-"metastatic disease"-noun-0]', location='TX', pos_info='1/18', tree_codes=''),

ConceptMMI(index='00000000', mm='MMI', score='5.18', preferred_name='Secondary Neoplasm', cui='C2939419', semtypes='[neop]', trigger='["Metastatic disease"-tx-1-"metastatic disease"-noun-0]', location='TX', pos_info='1/18', tree_codes='')]

only output the first one - 'Neoplasm Metastasis'.

Thanks, Wei

AnthonyMRios commented 5 years ago

Let me take a look and get back to you. Using the term processing (-z) or word sense disambiguation (-y) may help.