Japanese morphological analysis API provided by Yahoo! Japan.
Text analysis: Japanese morphological analysis-Yahoo! Developer Network https://developer.yahoo.co.jp/webapi/jlp/ma/v1/parse.html
Maven POM
<dependency>
<groupId>org.nlp4j</groupId>
<artifactId>nlp4j-core</artifactId>
<version>1.3.0.0</version>
</dependency>
<dependency>
<groupId>org.nlp4j</groupId>
<artifactId>nlp4j-yahoojp</artifactId>
<version>1.3.0.0</version>
</dependency>
If you have already obtained an APP ID on the Yahoo! Developer Network (https://developer.yahoo.co.jp/), set it in the JVM environment variable (yhoo_jp.appid) as shown below and execute it.
Even if you have not acquired it, if you want to move it for the time being, it will work for the time being even if you do not have it. Please obtain an APP ID as soon as possible.
-Dyhoo_jp.appid=YOUR_CODE
package example;
import java.util.ArrayList;
import nlp4j.Keyword;
import nlp4j.yhoo_jp.YJpMaService;
public class HelloYahooNLP1 {
public static void main(String[] args) throws Exception {
//Natural text
String text = "It is a good weather today.";
Document doc = new DefaultDocument();
//Set as attribute "text"
doc.putAttribute("text", text);
// Yahoo!JP annotator
YJpMaAnnotator annotator = new YJpMaAnnotator();
//Specify the attribute to be processed
annotator.setProperty("target", "text");
//Morphological analysis processing
annotator.annotate(doc); // throws Exception
//Keyword output
for (Keyword kwd : doc.getKeywords()) {
System.err.println(kwd);
}
}
}
The output result is as follows. I was able to get the result of morphological analysis with a short code.
today[facet=noun, str=today]
Is[facet=Particle, str=Is]
Good[facet=adjective, str=Good]
weather[facet=noun, str=weather]
is[facet=Auxiliary verb, str=is]
。 [facet=Special, str=。]
https://www.nlp4j.org/
Recommended Posts