MetaMap is a tool developed by the National Library of Medicine for analyzing biomedical texts. Follow these steps to install and set up MetaMap on a Linux system.
-
Java Installation:
-
Ensure Java is installed:
which java java -version
The expected output should confirm an OpenJDK version, such as:
openjdk version "1.8.0_275" OpenJDK Runtime Environment (build 1.8.0_275-b01) OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
-
If Java is not installed, install OpenJDK:
sudo apt update sudo apt install openjdk-8-jdk
-
-
Set the
JAVA_HOME
Environment Variable:- Find the Java path (if not already done):
which java
- Export the
JAVA_HOME
variable:export JAVA_HOME=/usr/bin/java
- Verify:
echo $JAVA_HOME
- Find the Java path (if not already done):
- Download the following files from the official MetaMap repository:
public_mm_data_lite_usabase_2022aa.zip
(data file)public_mm_linux_main_2020.tar.bz2
(main installation)public_mm_lite_3.6.2rc8_binaryonly.zip
(optional MetaMap Lite)
Place the downloaded files in a directory of your choice, e.g., ~/metamap
.
-
Extract Main Installation:
bunzip2 -c public_mm_linux_main_2020.tar.bz2 | tar xvf -
-
Extract Data Files: If needed, unzip the data files:
unzip public_mm_data_lite_usabase_2022aa.zip
- Navigate to the
bin
directory of the extracted MetaMap files:cd ./bin
- Run the installation script:
./install.sh
MetaMap requires the following servers to run in the background:
-
Start SKR/MedPost Part-of-Speech Tagger Server:
./bin/skrmedpostctl start
Expected output:
Starting skrmedpostctl: started.
-
(Optional) Start the Word Sense Disambiguation (WSD) Server: If you plan to use the WSD feature (
-y
flag):./bin/wsdserverctl start
- Run the following command to check if MetaMap is working:
You should see the version details of MetaMap.
./bin/metamap -V
MetaMap can now be used for text processing. For example:
./bin/metamap input.txt output.txt
- Replace
input.txt
with your input file. - The results will be saved in
output.txt
.
To stop the servers when done:
- Stop the SKR/MedPost Part-of-Speech Tagger Server:
./bin/skrmedpostctl stop
- Stop the WSD Server (if started):
./bin/wsdserverctl stop
For Python integration, you can follow this guide to interact with MetaMap through Python.