cosineg / opencc.net Goto Github PK
View Code? Open in Web Editor NEWThe .NET version of OpenCC(Open Chinese Convert), for the conversion between Simplified Chinese and Traditional Chinese.
License: Apache License 2.0
The .NET version of OpenCC(Open Chinese Convert), for the conversion between Simplified Chinese and Traditional Chinese.
License: Apache License 2.0
你好,open cc更新了数据格式为ocd2,辛苦做着更新适配下
Hello:
I want to test the repo to convert some tranditional Chinese text (Hong Kong) to simplified Chinese text.
I installed the latest version:
PM> Install-Package OpenCCNET -Version 0.2.2
But I found the repo is built with netstandard2.0.
I am coding with Visual Studio 2022 on Windows 10 for .NET 6.0.
I have the following C# code:
using OpenCCNET;
//using System.Text;
public static string HKToHant(string text)
{
ZhUtil.Initialize();
var textBuilder = new StringBuilder(text, text.Length * 2);
textBuilder.ConvertVariant(ZhDictionary.HKVariantsReversed);
return textBuilder.ToString();
}
But I got compiler error:
Error CS0246 The type or namespace name 'StringBuilder' could not be found
If I change the code, so it looks like:
using OpenCCNET;
using System.Text;
public static string HKToHant(string text)
{
ZhUtil.Initialize();
var textBuilder = new StringBuilder(text, text.Length * 2);
textBuilder.ConvertVariant(ZhDictionary.HKVariantsReversed);
return textBuilder.ToString();
}
Then I got another compiler error:
Error CS1061 'StringBuilder' does not contain a definition for 'ConvertVariant' and no accessible extension method 'ConvertVariant' accepting a first argument of type 'StringBuilder' could be found.
How can you fix this issue?
I suggest to upgrade to target .NET 6.0, since it is in long-term support, netstandard2.0. is too old.
Thanks,
Hello:
Today, I found the repo has a new release for NUGET, so I installed the new version (1.01), and try to test it, the follwing is the C# code:
ZhUtil.Initialize();
var document = new PdfDocument();
var page = document.AddPage();
var gfx = XGraphics.FromPdfPage(page);
var font = new XFont("SimHei", 20, XFontStyle.Regular);
gfx.DrawString("你好現在正在測試".ToHansFromHK(), font, XBrushes.Black, new XRect(20, 20, page.Width, page.Height), XStringFormats.Center);
document.Save("test.pdf");
But the code didn't get compiled, I got error message:
Error CS0103 The name 'ZhUtil' does not exist in the current context.
I am using Visual Studio 2022, my project is WinForms targetting .NET 6.0.
Please advise on how to fix this issue.
Thanks,
你好,open cc更新了数据格式为ocd2,辛苦大佬更新适配下
我在我的專案中有調整 TWPhrasesIT.txt
內容
演示 示範
但實際在轉換的時候
text = ZhConverter.HansToTW(text, true);
所有的「演示」都無法成功轉換為「示範」,請問有什麼方法可以轉換嗎?
尝试了下,“程序”可以翻译成“程式”。
又拿python的opencc试了下,“程序设计”是可以翻译成“程式设计”的
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.