├── app ├── .gitignore ├── libs │ └── hanlp-1.6.8.jar ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── menu │ │ │ │ └── menu_main.xml │ │ │ └── layout │ │ │ │ ├── activity_main.xml │ │ │ │ └── content_main.xml │ │ ├── assets │ │ │ ├── data │ │ │ │ └── dictionary │ │ │ │ │ ├── other │ │ │ │ │ └── CharType.bin │ │ │ │ │ ├── person │ │ │ │ │ ├── nr.txt.bin │ │ │ │ │ ├── nrf.txt.trie.dat │ │ │ │ │ └── nr.tr.txt │ │ │ │ │ ├── CoreNatureDictionary.txt.bin │ │ │ │ │ ├── custom │ │ │ │ │ └── CustomDictionary.txt.bin │ │ │ │ │ └── CoreNatureDictionary.ngram.txt.table.bin │ │ │ └── README.md │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── hankcs │ │ │ └── hanlpandroiddemo │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── hankcs │ │ │ └── hanlpandroiddemo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── hankcs │ │ └── hanlpandroiddemo │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── .gitignore └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/libs/hanlp-1.6.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/libs/hanlp-1.6.8.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/assets/data/dictionary/other/CharType.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/assets/data/dictionary/other/CharType.bin -------------------------------------------------------------------------------- /app/src/main/assets/data/dictionary/person/nr.txt.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/assets/data/dictionary/person/nr.txt.bin -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /app/src/main/assets/data/dictionary/person/nrf.txt.trie.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/assets/data/dictionary/person/nrf.txt.trie.dat -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | HanLPAndroidDemo 3 | Settings 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/assets/data/dictionary/CoreNatureDictionary.txt.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/assets/data/dictionary/CoreNatureDictionary.txt.bin -------------------------------------------------------------------------------- /app/src/main/assets/data/dictionary/custom/CustomDictionary.txt.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/assets/data/dictionary/custom/CustomDictionary.txt.bin -------------------------------------------------------------------------------- /app/src/main/assets/data/dictionary/CoreNatureDictionary.ngram.txt.table.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hankcs/HanLPAndroidDemo/HEAD/app/src/main/assets/data/dictionary/CoreNatureDictionary.ngram.txt.table.bin -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/assets/README.md: -------------------------------------------------------------------------------- 1 | 本目录为HanLP的数据文件,本演示项目仅仅保留了bigram分词相关文件。 2 | 3 | 更多功能请下载[data.zip](http://nlp.hankcs.com/download.php?file=data)解压到此目录,按需删除不需要的文件以减小apk体积。 4 | 5 | HanLP中的数据分为*词典*和*模型*,其中*词典*是词法分析必需的,*模型*是句法分析必需的。 6 | 7 | data 8 | │ 9 | ├─dictionary 10 | └─model 11 | 12 | 用户可以自行增删替换,如果不需要句法分析等功能的话,随时可以删除model文件夹。 13 | 14 | 欢迎参考[HanLP文档](https://github.com/hankcs/HanLP)以了解更多信息。 -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/test/java/com/hankcs/hanlpandroiddemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.hankcs.hanlpandroiddemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest 13 | { 14 | @Test 15 | public void addition_isCorrect() throws Exception 16 | { 17 | assertEquals(4, 2 + 2); 18 | } 19 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/hankcs/SDK/android-sdk-macosx/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/assets/data/dictionary/person/nr.tr.txt: -------------------------------------------------------------------------------- 1 | ,A,B,C,D,E,F,G,K,L,M,S,U,V,X,Z 2 | A,20637728,0,0,0,0,0,0,195129,0,0,0,453,0,0,0 3 | B,0,1,155650,0,94221,0,2964,0,19,0,0,24,0,0,43757 4 | C,0,0,0,155393,0,0,0,0,0,0,0,47,461,0,0 5 | D,2409,3427,0,0,0,0,0,0,141568,16990,0,0,0,63,0 6 | E,1491,2198,0,0,1000,0,0,0,81654,9104,0,4,0,45,0 7 | F,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | G,6,0,0,1000,0,0,0,0,2907,1000,0,0,0,0,0 9 | K,0,217510,0,0,0,18,0,0,0,0,0,0,0,7506,11 10 | L,256487,1000,0,0,0,0,0,0,0,0,0,7,0,0,0 11 | M,0,29629,0,0,0,0,0,0,0,0,0,0,0,526,0 12 | S,1097701,43031,0,0,1000,2,0,21858,0,0,0,32,0,928,1 13 | U,0,0,251,0,275,0,0,0,0,0,0,0,0,0,46 14 | V,447,13,0,0,0,1,0,19,0,0,0,0,0,0,0 15 | X,0,0,0,9064,0,0,0,0,0,0,0,5,18,0,0 16 | Z,594,807,0,0,0,0,0,0,38385,4010,0,0,0,19,0 17 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 |