=========
Python wrapper around `MetaMap <http://metamap.nlm.nih.gov/>`_.
This will take a list of sentences and extract concepts using MetaMap
then return them in the form of a list of Concept objects.
**Note:** This code does **not** work with Windows because of my use of NamedTemporaryFile in SubprocessBackend.py.
How to Install
--------------
First, install MetaMap by using the following instructions: https://metamap.nlm.nih.gov/Installation.shtml
Next, pymetamap can be installed using the following command:
>>> python setup.py install
Example Usage
-------------
To start you must create a MetaMap instance from the pymetamap package.
::
>>> from pymetamap import MetaMap
>>> mm = MetaMap.get_instance('/opt/public_mm/bin/metamap12')
You must supply the metamap binary to ``get_instance()`` in order to
extract concepts. Depending on where you installed MetaMap and depending on the version you are using, you will need to change the ``/opt/public_mm/bin/metamap12`` to the correct location. For example, if you installed the 2016 version of MetaMap, then the binary will be called ``metamap16``.
To extract concepts from a sentence use the ``extract_concepts()``
method. This method taks a list of sentences as input and will return
a list of Concept objects.
::
>>> sents = ['Heart Attack', 'John had a huge heart attack']
>>> concepts,error = mm.extract_concepts(sents,[1,2])
>>> for concept in concepts:
... print concept
Concept(index='1', mm='MM', score='14.64', preferred_name='Myocardial Infarction', cui='C0027051', semtypes='[dsyn]', trigger='["Heart attack"-tx-1-"Heart Attack"]', location='TX', pos_info='1:12', tree_codes='C14.280.647.500;C14.907.585.500')
Concept(index='2', mm='MM', score='13.22', preferred_name='Myocardial Infarction', cui='C0027051', semtypes='[dsyn]', trigger='["Heart attack"-tx-1-"heart attack"]', location='TX', pos_info='17:12', tree_codes='C14.280.647.500;C14.907.585.500')
This example shows two seperate concepts extracted via MetaMap from two
different sentences (sentence 1 and sentence 2).
More Information
----------------
Licensed under `Apache 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`_.
Written by Anthony Rios
Special thanks to `joaopalotti <https://github.com/joaopalotti>`_ and others for their contributions.
webpage: `https://github.com/AnthonyMRios/pymetamap <https://github.com/AnthonyMRios/pymetamap>`_
Metadata
Release files for pymetamap 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pymetamap-0.1.tar.gz | 4.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymetamap-0.1-py2.7.egg | Legacy Egg format | - | - | Details |
Total release size: 16.7 kB
Release files / pymetamap-0.1.tar.gz
| Download URL | pymetamap-0.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7a060651865ad2f10b245d931935c1bfe8f07ea3f9988aedbb36e14e5e15c94
|
|
BLAKE2b-256 checksum How to use checksums |
374f495dbe34bb7cd5ce06d24360e3634a15ec8561133f7c142aec549cb2a59d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pymetamap-0.1-py2.7.egg
| Download URL | pymetamap-0.1-py2.7.egg |
|---|---|
| Size | 11.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
a39e284bb6dd26a29e3be46c92bede347be983c2cb75bccec28618059d92a209
|
|
BLAKE2b-256 checksum How to use checksums |
63dabb1f3674699814df45f086b3e332978cd5c3dbace74e9e8f5b51dc931749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pymetamap 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.