AnthonyMRios / pymetamap

Python wraper for MetaMap
170 stars 61 forks source link

Support negated concepts #50

Closed schiegl closed 4 years ago

schiegl commented 4 years ago

MetaMap allows detection of negated concepts via the --negex option.

Command

echo "Fever, but no headache" | metamap --negex

Output

Phrase: Fever,
Meta Mapping (1000):
  1000   FEVER (Fever) [Sign or Symptom]

Phrase: but

Phrase: no headache.
Meta Mapping (1000):
  1000 N HEADACHE (Headache) [Sign or Symptom]

Can you add this option to the extract_concepts function?

schiegl commented 4 years ago

While trying to implement the --negex option I got the warning "The negex option has no effect on fielded_mmi_output output.". It appears as if negation is already included in the trigger field of ConceptMMI. Concepts which are negated contain a 1 at the end of the string according to MMI Output 2016

Output for the the sentence from top post

ConceptMMI(index='0', mm='MMI', score='5.18', preferred_name='Fever symptoms (finding)', cui='C0424755', semtypes='[fndg]', trigger='["Fever"-tx-1-"Fever"-noun-0]', location='TX', pos_info='1/5', tree_codes='')
ConceptMMI(index='0', mm='MMI', score='5.18', preferred_name='Headache', cui='C0018681', semtypes='[sosy]', trigger='["HEADACHE"-tx-1-"headache"-noun-1]', location='TX', pos_info='15/8', tree_codes='')

Maybe this helps anyone else!