src/DotNetCommon.PinYin/Internals/PinyinDict.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using ZIPStream = System.IO.Compression.GZipStream;
namespace DotNetCommon.PinYin.Internals
{
internal static class PinyinDict
{
private static Dictionary<string, ushort[]> _pyName;
private static string[] _pyShow;
private static ushort[] _pyIndex;
private static ushort[] _pyData;
private static int[] _wordPyIndex;
private static ushort[] _wordPy;
private static WordsSearchEx _search;
public static string[] PyShow
{
get
{
InitPy();
return _pyShow;
}
}
public static string[] GetPinyinList(string text, int tone = 0)
{
InitPy();
List<string> list = new List<string>();
for (int j = 0; j < text.Length; j++) { list.Add(null); }
var pos = _search.FindAll(text);
var pindex = -1;
foreach (var p in pos)
{
if (p.Start > pindex)
{
for (int j = 0; j < p.Length; j++)
{
list[j + p.Start] = _pyShow[_wordPy[_wordPyIndex[p.Index] + j] + tone];
}
pindex = p.End;
}
}
var i = 0;
while (i < text.Length)
{
if (list[i] == null)
{
var c = text[i];
if (c >= 0x3400 && c <= 0x9fd5)
{
var index = c - 0x3400;
var start = _pyIndex[index];
后面还有 216 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
