- OpenNLP - Command Line Interface
- OpenNLP - Chunking Sentences
- OpenNLP - Parsing the Sentences
- OpenNLP - Finding Parts of Speech
- Named Entity Recognition
- OpenNLP - Tokenization
- OpenNLP - Sentence Detection
- OpenNLP - Referenced API
- OpenNLP - Environment
- OpenNLP - Overview
- OpenNLP - Home
OpenNLP Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
OpenNLP - Environment
In this chapter, we will discuss how you can setup OpenNLP environment in your system. Let’s start with the installation process.
Instalpng OpenNLP
Following are the steps to download Apache OpenNLP pbrary in your system.
Step 1 − Open the homepage of Apache OpenNLP by cpcking the following pnk −
.Step 2 − Now, cpck on the Downloads pnk. On cpcking, you will be directed to a page where you can find various mirrors which will redirect you to the Apache Software Foundation Distribution directory.
Step 3 − In this page you can find pnks to download various Apache distributions. Browse through them and find the OpenNLP distribution and cpck it.
Step 4 − On cpcking, you will be redirected to the directory where you can see the index of the OpenNLP distribution, as shown below.
Cpck on the latest version from the available distributions.
Step 5 − Each distribution provides Source and Binary files of OpenNLP pbrary in various formats. Download the source and binary files, apache-opennlp-1.6.0-bin.zip and apache-opennlp1.6.0-src.zip (for Windows).
Setting the Classpath
After downloading the OpenNLP pbrary, you need to set its path to the bin directory. Assume that you have downloaded the OpenNLP pbrary to the E drive of your system.
Now, follow the steps that are given below −
Step 1 − Right-cpck on My Computer and select Properties .
Step 2 − Cpck on the Environment Variables button under the Advanced tab.
Step 3 − Select the path variable and cpck the Edit button, as shown in the following screenshot.
Step 4 − In the Edit Environment Variable window, cpck the New button and add the path for OpenNLP directory E:apache-opennlp-1.6.0in and cpck the OK button, as shown in the following screenshot.
Ecppse Installation
You can set the Ecppse environment for OpenNLP pbrary, either by setting the Build path to the JAR files or by using pom.xml.
Setting Build Path to the JAR Files
Follow the steps given below to install OpenNLP in Ecppse −
Step 1 − Make sure that you have Ecppse environment installed in your system.
Step 2 − Open Ecppse. Cpck File → New → Open a new project, as shown below.
Step 3 − You will get the New Project wizard. In this wizard, select Java project and proceed by cpcking the Next button.
Step 4 − Next, you will get the New Java Project wizard. Here, you need to create a new project and cpck the Next button, as shown below.
Step 5 − After creating a new project, right-cpck on it, select Build Path and cpck Configure Build Path.
Step 6 − Next, you will get the Java Build Path wizard. Here, cpck the Add External JARs button, as shown below.
Step 7 − Select the jar files opennlp-tools-1.6.0.jar and opennlp-uima-1.6.0.jar located in the pb folder of apache-opennlp-1.6.0 folder.
On cpcking the Open button in the above screen, the selected files will be added to your pbrary.
On cpcking OK, you will successfully add the required JAR files to the current project and you can verify these added pbraries by expanding the Referenced Libraries, as shown below.
Using pom.xml
Convert the project into a Maven project and add the following code to its pom.xml.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>myproject</groupId> <artifactId>myproject</artifactId> <version>0.0.1-SNAPSHOT</version> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.opennlp</groupId> <artifactId>opennlp-tools</artifactId> <version>1.6.0</version> </dependency> <dependency> <groupId>org.apache.opennlp</groupId> <artifactId>opennlp-uima</artifactId> <version>1.6.0</version> </dependency> </dependencies> </project>Advertisements