Skip to main content

use MER inside python

Project description

Use MER scripts inside python.

(from the MER repository)

MER is a Named-Entity Recognition tool which given any lexicon and any input text returns the list of terms recognized in the text, including their exact location (annotations).

Given an ontology (owl file) MER is also able to link the entities to their classes.

More information about MER can be found in:

  • MER: a Shell Script and Annotation Server for Minimal Named Entity Recognition and Linking, F. Couto and A. Lamurias, Journal of Cheminformatics, 10:58, 2018 []
  • MER: a Minimal Named-Entity Recognition Tagger and Annotation Server, F. Couto, L. Campos, and A. Lamurias, in BioCreative V.5 Challenge Evaluation, 2017 []



MER was developed and tested using the GNU awk (gawk) and grep. If you have another awk interpreter in your machine, there's no assurance that the program will work.

For example, to install GNU awk on Ubuntu:

sudo apt-get install gawk


pip install merpy


python install

Basic Usage

>>> import merpy
>>> merpy.generate_lexicon("hp")
>>> document = 'Influenza, commonly known as "the flu", is an infectious disease caused by an influenza virus. Symptoms can be mild to severe. The most common symptoms include: a high fever, runny nose, sore throat, muscle pains, headache, coughing, and feeling tired'
>>> entities = merpy.get_entities(document, "hp")
>>> print(entities)
[['111', '115', 'mild', ''], ['119', '125', 'severe', ''], ['168', '173', 'fever', ''], ['214', '222', 'headache', ''], ['224', '232', 'coughing', ''], ['246', '251', 'tired', ''], ['175', '185', 'runny nose', '']]
>>> lexicons = merpy.get_lexicons()
>>> merpy.show_lexicons()
lexicons preloaded:
['lexicon', 'go', 'cell_line_and_cell_type', 'chebi_lite', 'chemical', 'hp', 'disease', 'wordnet_nouns', 'hpo', 'radlex', 'doid', 'protein', 'hpomultilang', 'tissue_and_organ', 'mirna', 'subcellular_structure']

lexicons loaded ready to use:
['lexicon', 'doid', 'hp']

lexicons with linked concepts:
['doid', 'hp', 'go', 'chebi_lite', 'lexicon']

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for merpy, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size merpy-0.2.0-py3-none-any.whl (53.0 MB) File type Wheel Python version py3 Upload date Hashes View
Filename, size merpy-0.2.0.tar.gz (27.6 MB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page