HanLP.NET 0.5.5.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package HanLP.NET --version 0.5.5.7
                    
NuGet\Install-Package HanLP.NET -Version 0.5.5.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HanLP.NET" Version="0.5.5.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HanLP.NET" Version="0.5.5.7" />
                    
Directory.Packages.props
<PackageReference Include="HanLP.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HanLP.NET --version 0.5.5.7
                    
#r "nuget: HanLP.NET, 0.5.5.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HanLP.NET@0.5.5.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HanLP.NET&version=0.5.5.7
                    
Install as a Cake Addin
#tool nuget:?package=HanLP.NET&version=0.5.5.7
                    
Install as a Cake Tool

HanLP.NET 全C#版HanLP,no-wrapper,

1 HanLP与HanLP.NET

1.1 HanLP

自然语言处理包HanLP具备中文分词、词性标注、关键词提取、自动摘要、依存句法分析、命名实体识别、短语提取、拼音转换、简繁转换等等功能。 HanLP从开源起步,发展顺利,应用广泛,更多的介绍请访问: HanLP官网:https://www.hanlp.com/semantics/dashboard/index HanLP开源:https://github.com/hankcs/HanLP

1.2 HanLP.NET

HanLP.NET是非包装no-wrapper,全C#版HanLP。 (1)翻译:源自 HanLP Java 1.8.6 ,做了比较大的改造。 (2)代码:100%纯C#代码,no-Wrapper,无需 JDK, IKVM 支持。 (3)版本:本版本的程序库适配.NET 10, Windows 10+,X64平台。 (3)定制:需适配其他平台的类库,请联系作者修改、编译。

2 为什么要翻译?##

2.1 人民有需要!

(1)现实需求:桌面软件,工业软件,统信系统,手机(安卓,iOS,鸿蒙等),机器人,具身智能,ARM平台等等需要脱离Java与Python、自主可控的、工业软件级别的NLP底座。 (2)HanLP的局限性:用Java编写,改编自Yahoo, Google的系列算法及 LTP C++,2.0后版本为 Python,运行需要Java环境或IKVM或Python,不便于其他平台的应用与开发。 (3)有用:对HanLP.NET的需求是呼之欲出!因为C#是世界上最好的编程语言。C#+Visual Studio可解决所有这些广泛的应用需求。

2.2 没有全部翻译

(1)未翻译训练 train 相关的代码。需要?请联系定制; (2)未翻译管道 pipeline 相关的代码。需要?请联系定制;

2.3 HanLP.NET的改进

(1)重新训练与处理了个别错误的数据; (2)替代大部分性能低下的 Java Trie,BinTrie 代码; (3)支持 json 文件进行字典、模型 加载的设置; (4)改造了字典、模型 加载算法,速度更快; (5)改造了不少 java 代码(不适于工业应用);

3 怎么用 HanLP.NET

请从下面的网址下载测试代码,了解全部功能。 https://gitee.com/hanlp_net/demo

(1)指定数据源 将测试代码中的 hanlp-data-config.json 文件保存于 exe 同一个文件夹。 请阅读下面 3.2;可设置成:仅仅加载必须的字典与模型;

(2)预加载字典、模型 //预读取字典,模型数据;得到可能的错误信息; string err = HanLP.init();

(3)调用接口实现相应功能(例如:分词) string text = @"我新造一个词叫幻想乡你能识别并标注正确词性吗?"; List<Term> words = NLPTokenizer.segment(text); 更多接口请阅读测试代码。

3.1 准备 HanLP 数据

请自行下载 HanLP 数据(653MB),并解压至(为) data 文件夹(dictionary + model)或其他文件夹。 HanLP官网(HanLP 1.7.5 数据包)::https://file.hankcs.com/hanlp/data-for-1.7.5.zip 其中个别数据有错,HanLP.NET 0.5.5.0 版本之后能自动处理。

3.2 指定数据源

HanLP.NET 支持将任意文件夹设置为数据源根目录。 请阅读并修改 hanlp-data-config.json 文件。 例如:DataPath 数据 data 根文件夹(根目录) 字段。 其他在说明在 json 文件内有中文说明。

3 联系我们

您的需求肯定远不止这些。 当前发布版本为.NET 10, Windows 10,x64; Hanlp.NET可支持各类别或版本:.Frameworks,.NET,国产系统,CPU ... 如果您需要适配类型CPU ,操作系统的包,可联系联高软件。 联高软件:http://www.315soft.com

4 版权

HanLP源代码的授权协议为 Apache License 2.0,可免费用做商业用途。 请在产品说明中附加HanLP的链接和授权协议。 HanLP 版权归于原作者; LPT 版权归原作者。 HanLP.NET 代码版权归北京联高软件开发有限公司

Product Compatible and additional computed target framework versions.
.NET net10.0-windows10.0.17763 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.8.6 134 5/31/2026
0.5.8.3 118 5/28/2026
0.5.5.7 110 5/18/2026
0.5.2.1 107 5/16/2026
0.5.2 111 5/16/2026