Run kuromoji on Win10 + Eclipse + Java environment (January 2020 version)

As expected, Java-made kuromoji is compatible with Maven without depending on the OS, so it is very easy to install and use.

The title of this post includes Win10 and Eclipse, but kuromoji does not depend on either.

Maven

This is the only setup. Model data will also be downloaded.

<!-- https://mvnrepository.com/artifact/com.atilika.kuromoji/kuromoji -->
<dependency>
	<groupId>com.atilika.kuromoji</groupId>
	<artifactId>kuromoji</artifactId>
	<version>0.9.0</version>
	<type>pom</type>
</dependency>
<dependency>
	<groupId>com.atilika.kuromoji</groupId>
	<artifactId>kuromoji-ipadic</artifactId>
	<version>0.9.0</version>
</dependency>

Code

The sample code is as it is.

// https://www.atilika.com/ja/kuromoji/
package hello.kuromoji;

import com.atilika.kuromoji.ipadic.Token;
import com.atilika.kuromoji.ipadic.Tokenizer;
import java.util.List;

public class KuromojiExample {
	public static void main(String[] args) {
		Tokenizer tokenizer = new Tokenizer();
		List<Token> tokens = tokenizer.tokenize("I want to eat sushi. I also want to eat curry.");
		for (Token token : tokens) {
			System.out.println(token.getSurface() + "\t" + token.getAllFeatures());
		}
	}
}

Execution result

Prefix,Noun connection,*,*,*,*,O,Oh,Oh
Sushi noun,General,*,*,*,*,sushi,Sushi,Sushi
Is a particle,Case particles,General,*,*,*,But,Moth,Moth
Eat verb,Independence,*,*,One step,Continuous form,eat,Tabe,Tabe
Tai auxiliary verb,*,*,*,Special Thailand,Uninflected word,Want,Thailand,Thailand
.. symbol,Kuten,*,*,*,*,。,。,。
Curry noun,General,*,*,*,*,curry,curry,curry
Also particles,Particle,*,*,*,*,Also,Mo,Mo
Eat verb,Independence,*,*,One step,Continuous form,eat,Tabe,Tabe
Tai auxiliary verb,*,*,*,Special Thailand,Uninflected word,Want,Thailand,Thailand
.. symbol,Kuten,*,*,*,*,。,。,。

Impressions

Kuromoji is very easy to use.

reference

Referenced page

kuromoji | Atilika https://www.atilika.com/ja/kuromoji/

Recommended Posts

Run kuromoji on Win10 + Eclipse + Java environment (January 2020 version)
Run Mecab on Win10 + Eclipse + Java + cmecab-java (January 2020)
Run PostgreSQL on Java
Java development environment construction on Mac-JDK Install (2020 preservation version)
How to run Java EE Tutial on github on Eclipse
Java version control on macOS
Java development environment (Mac, Eclipse)
Run java applet on ubuntu
Java version change on CentOS
Run Eclipse CDT on Ubuntu
Run Java EE applications on CICS
[Eclipse Java] Development environment setting memo
About Eclipse environment (Java, Liberty, JavaScript)
[ev3 × Java] leJOS development environment construction (Eclipse on Mac OSX / bluetooth)
Install Java development environment on Mac
Building a development environment for Flutter on Win10 --- Flutter SDK Install (2020 preservation version)
Java development environment construction memo on Mac
Eclipse screen layout change method (Java version)
Java version control with jenv on OSX
Build a Java development environment on Mac
Build Java 8 development environment on AWS Cloud9
Download and install Eclipse (Java) (Mac version)
Create an ARM-cpu environment with qemu on mac and run java [Result → Failure]
Spring Boot environment construction with Docker (January 2021 version)
Try to build Java8 environment on Amazon Linux2
Try Azure Service Fabric (Java) on Mac-Local Environment
Run Edge (Chromium version) on Mac with Selenium
[Java] Build Java development environment on Ubuntu & check execution
Try using Sourcetrail (win version) in Java code
Compile and run Java on the command line
Build a Java runtime environment on Sakura VPS
How to run NullpoMino 7.5.0 on Ubuntu 20.04.1 64bit version
What to do if you get a NoClassDefFoundError when trying to run eclipse on Java9
[Even beginners can do it! ] How to install Eclipse on Windows 10 (Java environment construction)