In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces you how to use Android in HanLP. The content is very detailed. Interested friends can refer to it for reference. I hope it can help you.
portable version
Portable version zero configuration, only provides Chinese word segmentation, simplified and complex pinyin, synonyms and other functions. Just add dependencies to build.gradle:
dependencies {
compile 'com.hankcs:hanlp:portable-1.6.8'
}
Custom Edition
All functions of HanLP (word segmentation, simplified and complex, pinyin, text classification, syntax analysis) are compatible with Android. The specific configuration methods are as follows:
Download hanlp.jar and put it in app/libs.
Download data.zip and extract it to app/src/main/assets, deleting unwanted files as needed to reduce apk size.
Executing initialization code at program startup (usually MainApplication or MainActivity's onCreate method):
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("Write" + path + "is not supported! Please put the required data into app/src/main/assets/data") before compiling;
}
};
}
About how to use Android in HanLP to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.