All Projects → hankcs → HanLPAndroidDemo

hankcs / HanLPAndroidDemo

Licence: other
HanLP Android Demo

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to HanLPAndroidDemo

Pyhanlp
中文分词 词性标注 命名实体识别 依存句法分析 新词发现 关键词短语提取 自动摘要 文本分类聚类 拼音简繁 自然语言处理
Stars: ✭ 2,564 (+14982.35%)
Mutual labels:  hanlp
Hanlp
中文分词 词性标注 命名实体识别 依存句法分析 成分句法分析 语义依存分析 语义角色标注 指代消解 风格转换 语义相似度 新词发现 关键词短语提取 自动摘要 文本分类聚类 拼音简繁转换 自然语言处理
Stars: ✭ 24,626 (+144758.82%)
Mutual labels:  hanlp
text-classification-svm
The missing SVM-based text classification module implementing HanLP's interface
Stars: ✭ 46 (+170.59%)
Mutual labels:  hanlp
sca-best-practice
Provide microservice API for HanLP
Stars: ✭ 13 (-23.53%)
Mutual labels:  hanlp
jstarcraft-nlp
专注于解决自然语言处理领域的几个核心问题:词法分析,句法分析,语义分析,语种检测,信息抽取,文本聚类和文本分类. 为相关领域的研发人员提供完整的通用设计与参考实现. 涵盖了多种自然语言处理算法,适配了多个自然语言处理框架. 兼容Lucene/Solr/ElasticSearch插件.
Stars: ✭ 92 (+441.18%)
Mutual labels:  hanlp

HanLP Android 示例

portable版

portable版零配置,仅提供中文分词、简繁拼音、同义词等功能。只需在build.gradle中加入依赖:

dependencies {
    compile 'com.hankcs:hanlp:portable-1.6.8'
}

自定义版

HanLP的全部功能(分词、简繁、拼音、文本分类、句法分析)都兼容安卓,具体配置方法如下:

  1. 下载hanlp.jar放入app/libs
  2. 下载data.zip解压到app/src/main/assets ,按需删除不需要的文件以减小apk体积。
  3. 在程序启动时(通常是MainApplicationMainActivityonCreate方法)执行初始化代码:
    private void initHanLP()
    {
        try
        {
            Os.setenv("HANLP_ROOT", "", true);
        }
        catch (ErrnoException e)
        {
            throw new RuntimeException(e);
        }
        final AssetManager assetManager = getAssets();
        HanLP.Config.IOAdapter = new IIOAdapter()
        {
            @Override
            public InputStream open(String path) throws IOException
            {
                return assetManager.open(path);
            }

            @Override
            public OutputStream create(String path) throws IOException
            {
                throw new IllegalAccessError("不支持写入" + path + "!请在编译前将需要的数据放入app/src/main/assets/data");
            }
        };
    }

之后就可以像普通Java项目一样调用HanLP的全部功能了。

欢迎参考HanLP文档以了解更多信息。

screenshot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].