这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
|
zh:courses:textmining2026:ch01 [2026/09/05 17:31] pzczxs [JDK安装及配置] |
zh:courses:textmining2026:ch01 [2026/09/06 12:17] (当前版本) pzczxs [测试实例] |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== 第一章:绪论 ====== | ====== 第一章:绪论 ====== | ||
| ===== 课件 ===== | ===== 课件 ===== | ||
| - | 下载:绪论 | + | 下载:{{ :zh:courses:textmining2026:ch01.pptx |绪论}} |
| - | ===== 基于Java的文本分析工具 ===== | ||
| - | *[[https://stanfordnlp.github.io/CoreNLP/|Stanford CoreNLP]] | ||
| - | *[[https://opennlp.apache.org/|OpenNLP]] | ||
| - | *[[https://gate.ac.uk/|General Architecture for Text Engineering (GATE)]] | ||
| - | *[[https://uima.apache.org/|Unstructured Information Management Applications (UIMA)]] | ||
| - | *[[http://mallet.cs.umass.edu/|Mallet]] | ||
| - | *[[https://github.com/deeplearning4j/deeplearning4j|Deep Learning for Java (DL4J)]] | ||
| - | *[[https://commons.apache.org/proper/commons-text/|Commons Text]] | ||
| - | *[[https://snowballstem.org/|Snowball]] | ||
| - | *[[https://sourceforge.net/projects/weka/|Weka]] | ||
| - | *[[https://tika.apache.org/|Tika]] | ||
| - | * | ||
| ===== 环境搭建 ===== | ===== 环境搭建 ===== | ||
| ==== JDK安装及配置 ==== | ==== JDK安装及配置 ==== | ||
| - | * 下载JDK(版本:<color red>Java 17或Java 8</color>):https://www.oracle.com/java/technologies/downloads/ | + | * 下载JDK(版本:<color red>Java 17</color>):https://www.oracle.com/java/technologies/downloads/ |
| * 设置环境变量: | * 设置环境变量: | ||
| <code> | <code> | ||
| - | JAVA_HOME: C:\Program Files\Java\jdk1.8.0_301 | + | JAVA_HOME: C:\Program Files\Java\jdk-17.0.20.1 |
| CLASSPATH: %JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar; | CLASSPATH: %JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar; | ||
| PATH: %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; | PATH: %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; | ||
| 行 55: | 行 44: | ||
| *修改Use default Workspace location,或直接点击Next; | *修改Use default Workspace location,或直接点击Next; | ||
| *选择maven-archetype-quickstart,点击Next; | *选择maven-archetype-quickstart,点击Next; | ||
| - | *输入Group Id(例如:<color red>cn.edu.bjut</color>),Artifact Id(例如:<color red>textmining</color>)和Package(例如:<color red>cn.edu.bjut.chapter1</color>),点击Finish。 | + | *输入Group Id(例如:<color red>cn.edu.bjut.textmining</color>),Artifact Id(例如:<color red>JavaTextMining</color>)和Package(例如:<color red>cn.edu.bjut.textmining.chapter1</color>),点击Finish。 |
| ==== POM配置文件 ==== | ==== POM配置文件 ==== | ||
| - | <file xml POM.xml> | + | <file xml pom.xml> |
| - | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | + | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| - | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | + | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| - | <modelVersion>4.0.0</modelVersion> | + | 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>cn.edu.bjut</groupId> | + | <groupId>cn.edu.bjut.textmining</groupId> |
| - | <artifactId>text-mining</artifactId> | + | <artifactId>JavaTextMining</artifactId> |
| - | <version>0.0.1-SNAPSHOT</version> | + | <version>0.0.1-SNAPSHOT</version> |
| - | <packaging>jar</packaging> | + | <packaging>jar</packaging> |
| - | <name>text-mining</name> | + | <name>textming</name> |
| - | <url>http://maven.apache.org</url> | + | <url>http://maven.apache.org</url> |
| - | <properties> | + | <properties> |
| - | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | + | <maven.compiler.source>17</maven.compiler.source> |
| - | </properties> | + | <maven.compiler.target>17</maven.compiler.target> |
| + | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| + | </properties> | ||
| - | <dependencies> | + | <dependencies> |
| - | <dependency> | + | <dependency> |
| - | <groupId>junit</groupId> | + | <groupId>junit</groupId> |
| - | <artifactId>junit</artifactId> | + | <artifactId>junit</artifactId> |
| - | <version>3.8.1</version> | + | <version>3.8.1</version> |
| - | <scope>test</scope> | + | <scope>test</scope> |
| - | </dependency> | + | </dependency> |
| - | + | <dependency> | |
| - | <dependency> | + | <groupId>org.slf4j</groupId> |
| - | <groupId>org.apache.opennlp</groupId> | + | <artifactId>slf4j-simple</artifactId> |
| - | <artifactId>opennlp-tools</artifactId> | + | <version>2.0.18</version> |
| - | <version>1.9.3</version> | + | </dependency> |
| - | </dependency> | + | <dependency> |
| - | </dependencies> | + | <groupId>org.apache.opennlp</groupId> |
| + | <artifactId>opennlp-tools</artifactId> | ||
| + | <version>2.3.0</version> | ||
| + | </dependency> | ||
| + | <dependency> | ||
| + | <groupId>org.apache.commons</groupId> | ||
| + | <artifactId>commons-lang3</artifactId> | ||
| + | <version>3.12.0</version> | ||
| + | </dependency> | ||
| + | <dependency> | ||
| + | <groupId>commons-io</groupId> | ||
| + | <artifactId>commons-io</artifactId> | ||
| + | <version>2.11.0</version> | ||
| + | </dependency> | ||
| + | <dependency> | ||
| + | <groupId>org.jsoup</groupId> | ||
| + | <artifactId>jsoup</artifactId> | ||
| + | <version>1.22.2</version> | ||
| + | </dependency> | ||
| + | <dependency> | ||
| + | <groupId>org.apache.lucene</groupId> | ||
| + | <artifactId>lucene-core</artifactId> | ||
| + | <version>8.11.2</version> | ||
| + | </dependency> | ||
| + | <dependency> | ||
| + | <groupId>org.apache.lucene</groupId> | ||
| + | <artifactId>lucene-analyzers-common</artifactId> | ||
| + | <version>8.11.2</version> | ||
| + | </dependency> | ||
| + | </dependencies> | ||
| </project> | </project> | ||
| </file> | </file> | ||
| 行 94: | 行 115: | ||
| ==== 实例代码 ==== | ==== 实例代码 ==== | ||
| <file java TokenizerExample.java> | <file java TokenizerExample.java> | ||
| - | package cn.edu.bjut.chapter1; | + | package cn.edu.bjut.textmining.chapter1; |
| import opennlp.tools.tokenize.SimpleTokenizer; | import opennlp.tools.tokenize.SimpleTokenizer; | ||