PinyinM.NET
1.0.3
dotnet add package PinyinM.NET --version 1.0.3
NuGet\Install-Package PinyinM.NET -Version 1.0.3
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="PinyinM.NET" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PinyinM.NET --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PinyinM.NET, 1.0.3"
#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.
// Install PinyinM.NET as a Cake Addin
#addin nuget:?package=PinyinM.NET&version=1.0.3
// Install PinyinM.NET as a Cake Tool
#tool nuget:?package=PinyinM.NET&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Pinyin.NET
1. 汉字转换为拼音
将汉字转换为带音调或不带音调的拼音
返回值为IEnumerable<IEnumerable<string>>,
每个IEnumerable<string>为一个汉字的拼音,
每个string为一个发音
如果输入的字符不是汉字,则返回值其本身
例如"到底"返回值为[["dao"], ["di","de"]] 例如"Stea mSt2等2待"返回值为[ ["stea"], ["m"], ["st2"], ["deng"],["2"], ["dai"]]
PinyinProcessor pinyinProcessor = new PinyinProcessor();//不带音调
//PinyinProcessor pinyinProcessor = new PinyinProcessor(PinyinFormat.WithToneMark); //带音调
pinyinProcessor.GetPinyin("到底");//[["dao"], ["di","de"]]
2. 拼音模糊搜索
在给的的数据源中的指定属性上进行拼音模糊搜索
支持拼音全拼 首字母 全拼和首字母混合搜索 (支持多音字)
list.Add(new MyClass
{
Name = "但是等待",
Pinyin = pinyinProcessor.GetPinyin("但是等待")
});
PinyinSearcher<MyClass> pinyinSearcher = new PinyinSearcher<MyClass>(list, "Pinyin");
var search = pinyinSearcher.Search("dansden");
foreach (var searchResult in search)
{
Console.WriteLine($" {searchResult.Weight} {searchResult.Source.Name}");
}
//输出 6 尝试111到底是
更新日志
1.0.3
- 重构 搜索
1.0.2
- 优化 混合字符转拼音,现在会自动以大写字母和部分分隔符分割
1.0.1
- 优化 包含英文的字母的拼音转换
- 新增 泛型搜索类型
- 优化 添加对字典以及KeyValuePair支持
- 优化 权重计算
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
重构 搜索