nlp - Lemmatization java -
I am looking for an implementation for English in Java. I have already found something, but I have something that does not require much memory (1 GB Top) to run. Thank you. I do not need stammers.
The Java library has a limematizer which is a little resource intensive but I do not want it on my laptop. ; Run with 512 MB of RAM.
To use it:
- ;
- Create a new project for your editor
- Create a new Java below (based on the snippet from Stanford's site);
import java.util.Properties; Public class Stanford Lammameter {Stanford Coir NLP pipeline was protected; Public Stanford Lamimizer () {// Stanford Coir NLP Object Properties, with POS Tagging // (Required for Lematization), and Laminatingization Properties Props; Sahara = new property (); Propsput ("annotator", "tonkenize, ssplit, paus, lemma"); // Stanford Corelp loads a lot of models, so you probably want to do this once for each execution. PPline = New Stanfordcore NLP (prop); } Public listing & lt; String & gt; Lemmatize (string document text) {list & lt; String & gt; Lemmas = New Linkedist & lt; String & gt; (); // Make an empty interpretation with only the given text Annotation document = New Annotation (documentText); // Run all annotator on this lesson PPline.Notate (document); // hilarious list on all the sentences & lt; CoreMap & gt; Sentence = document. Get (analysis of sentences class); (Cormap sentence: for sentences) {// Repeat on all the tokens in a sentence for Coralable token: sentence.get (token annotation class)) {// Retrieve the list of lemmas lemmas.add for each word and Add (token.get (LemmaAnnotation.class)); }} Returns lemmas; }}
Comments
Post a Comment