やりたいこと
luceneを使用した形態素解析のプログラムを作りたいと思っています。
問題点
lucene.analysisがインポートできません。xmlファイルのdependencyには記述はしてあるのですが、その後の処理が分かりません。ちなみにファイル構成は以下のようになっています。
analyzer-sample - src - main - (中間フォルダ) - analyzersample.java
- pom.xml
- README.md
- text.txt
エラー文
analyzersample.java:20: エラー: パッケージorg.apache.lucene.analysisは存在しません import org.apache.lucene.analysis.Analyzer; ^ analyzersample.java:21: エラー: パッケージorg.apache.lucene.analysisは存在しません import org.apache.lucene.analysis.TokenStream; ^ analyzersample.java:22: エラー: パッケージorg.apache.lucene.analysis.jaは存在しません import org.apache.lucene.analysis.ja.JapaneseTokenizer; ^ analyzersample.java:23: エラー: パッケージorg.apache.lucene.analysis.ja.JapaneseTokenizerは存在しません import org.apache.lucene.analysis.ja.JapaneseTokenizer.Mode; ^ analyzersample.java:24: エラー: パッケージorg.apache.lucene.analysis.ja.tokenattributesは存在しません import org.apache.lucene.analysis.ja.tokenattributes.ReadingAttribute; ^ analyzersample.java:25: エラー: パッケージorg.apache.lucene.analysis.tokenattributesは存在しません import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
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>net.n2sm.test</groupId> <artifactId>analyzer-sample</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>analyzer-sample</name> <url>http://www.n2sm.net/</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.3</version> <executions> <execution> <goals> <goal>java</goal> </goals> </execution> </executions> <configuration> <mainClass>net.n2sm.test.AnalyzerSample</mainClass> </configuration> </plugin> </plugins> </build> <dependencies> <!-- https://mvnrepository.com/artifact/org.apache.lucene/lucene-analyzers-common --> <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-analyzers-common</artifactId> <version>7.5.0</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
試したこと
lucene-7.5.0をダウンロードし、その場所にシステム環境変数を設定しましたが意味がありませんでした。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。