Giter VIP home page Giter VIP logo

npinyin's Introduction

汉字转拼音工具(.net 版)

将汉字转为拼音。基于 hotoo/pinyin 开发。 可以用于汉字注音、排序 等。

由于工作中需要将中文转为拼音,没找到有比较好的 .net 版转拼音工具。感觉hotoo/pinyin比较不错,于是就用 c# 改了一下。

目前只是简单的实现了常用汉字转拼音的功能,像一些分词功能,多音字功能目前还没加,有需要的自己可以参考别的版本进行实现。

使用方法

引入 NPinyin.dll

  1. 基本使用
using NPinyin;

var hans = "中文";
var pinyin = new Pinyin();
var result = pinyin.ConvertToPinyin(hans); // zhong wen
  1. 可选参数
using NPinyin;

var hans = "中文";
var pinyin = new Pinyin();
pinyin.Option = new PinyinOption()
{
    Style = PinyinStyle.Normal, // 不带声调(默认) zhong wen
    // Style = PinyinStyle.Tone // 带声调 zhōng wén
    EnableInterval = true       // 多个拼音之间是否启用间隔 zhong wen  zhongwen
};
var result = pinyin.ConvertToPinyin(hans); // zhong wen

支持版本

  • .NET 5.0
  • .NET Framework 3.5 - 4.8

相关项目

npinyin's People

Contributors

wutong1995 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.