Skip to content

Commit

Permalink
升级到2.3版,支持各种编码导入到Win微软拼音中。
Browse files Browse the repository at this point in the history
  • Loading branch information
studyzy committed May 23, 2018
1 parent 1a8f4a5 commit 40e4e63
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
11 changes: 8 additions & 3 deletions IME WL Converter/IME WL Converter/Entities/WordLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public string[] PinYin
return result;
}

return null;
return Codes[0].ToArray();
}
set
{
Expand All @@ -126,10 +126,15 @@ public string[] PinYin
public int GetPinYinLength()
{
int len = 0;
foreach (var s in PinYin)
if (Codes.Count > 1 || Codes[0].Count > 1)
{
len += s.Length;
foreach (var s in PinYin)
{
len += s.Length;
}
}
else
len = Codes[0][0].Length;
return len;

}
Expand Down
2 changes: 2 additions & 0 deletions IME WL Converter/IME WL Converter/Forms/HelpForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ private void HelpForm_Load(object sender, EventArgs e)
helpString +=
"2.0版增加了简繁体转换功能、支持多种五笔、郑码、仓颉、注音、二笔等输入法词库、百度拼音PC版、灵格斯ld2格式等,增加对仓颉平台、雅虎奇摩输入法的支持。加强了Rime输入法和小小输入法\r\n";
helpString += "2.1版修复了自定义转换时的Bug,增加了超音速录、手心输入法等的支持。升级为.Net 3.5只要在Vista以上操作系统不需要安装.Net。";
helpString += "2.2支持手心输入法和最新版Win10微软拼音(用户自定义短语)\r\n";
helpString += "2.3支持Win10微软拼音(用户自定义短语)对其他输入法编码的支持\r\n";
helpString += "关于各种输入法的词库转换操作方法可以参见项目网站(https://github.com/studyzy/imewlconverter/)\r\n";
helpString +=
"如果您觉得深蓝词库转换能够给您的生活带来了极大的方便,可以通过Paypal或者支付宝捐赠该软件(https://github.com/studyzy/imewlconverter/wiki/Donate)。\r\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public bool Is1CharMutiCode

public override void GetCodeOfWordLibrary(WordLibrary wl)
{
if (wl.CodeType == CodeType.Pinyin)
if(wl.CodeType== CodeType.English)
{
wl.SetCode(CodeType.UserDefinePhrase, wl.Word);
}
else if (wl.CodeType == CodeType.Pinyin)
{
wl.SetCode(CodeType.UserDefinePhrase,wl.GetPinYinString("", BuildType.None));
}
Expand Down
10 changes: 8 additions & 2 deletions IME WL Converter/IME WL Converter/IME/Win10MsPinyin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public IList<string> Export(WordLibraryList wlList)
//Win10拼音只支持最多32个字符的编码
wlList = Filter(wlList);
string tempPath = Path.GetDirectoryName(Application.ExecutablePath) + "\\Win10_1703微软拼音词库.dat";

if (File.Exists(tempPath)) { File.Delete(tempPath); }
var fs = new FileStream(tempPath, FileMode.OpenOrCreate, FileAccess.Write);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(Encoding.ASCII.GetBytes("mschxudp")); //proto8
Expand Down Expand Up @@ -205,13 +205,19 @@ public IList<string> Export(WordLibraryList wlList)
private WordLibraryList Filter(WordLibraryList wlList)
{
var result = new WordLibraryList();
//var key = new List<string>();
foreach (var wl in wlList)
{
if (wl.GetPinYinLength() > 32)
continue;
if (wl.Word.Length > 64)
continue;
result.Add(wl);
//var py = wl.GetPinYinString("", BuildType.None);
//if (!key.Contains(py))
//{
result.Add(wl);
// key.Add(py);
//}
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("深蓝 http://studyzy.cnblogs.com")]
[assembly: AssemblyProduct("深蓝词库转换")]
[assembly: AssemblyCopyright("Copyright © 2010-2017")]
[assembly: AssemblyCopyright("Copyright © 2010-2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("IME WL Converter Test")]//单元测试的时候可以访问内部对象
Expand Down

3 comments on commit 40e4e63

@WanderMax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

赞,微软拼音,选择第几个居然只能用数字么?

@studyzy
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WanderMax 什么意思?不明白您的需求。

@WanderMax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是你的问题,我是说微软拼音自己的问题

Please sign in to comment.