zoukankan      html  css  js  c++  java
  • [Powershell] Convert Chinese character to pinying

    Found a new job in Beijing, the company was using cloud stuff for infrastructure IT systems, like mail system, mobile messaging, IM. The company is going bigger and stronger, making more money, so the bosses decided update to AD/exchange/lync. It is quite hard to manage compare to a pure foreign enterprise cause Chinese prefer see Chinese characters when doing jobs. Like mix Chinese characters and pinyings togerther, or first letters from Chinese characters. To me, this could be a big problem potentially, so I would like to figure out a way to convert Chinese characters to pinyings.

    Welcome email to: larry.song@outlook.com

    There actually already many websites provide such service, probably I can simply invoke those webservices as API, but I prefer ways more offically instead of webservices over internet.

    Fortunately, Microsoft already provided a DLL for this kind purpose, downloading from:

    http://www.microsoft.com/en-us/download/details.aspx?id=15251

    Details usage we can know from help document after installation, it really straightforward, like

    Simplified Chinese Pin-Yin Conversion Library Document.chm

    Under

    C:Program Files (x86)Microsoft Visual Studio International PackSimplified Chinese Pin-Yin Conversion Library

    For powershell, the only need is ChnCharInfo.dll, I can copy it to wherever I like,

    Then, how I import the DLL?

    Another way more fancy is using [Reflection.Assembly]::LoadFile

    After we loaded it into powershell runspace, we can invoke its class, class name can be known from chm file we mentioned just now.

    The library only owns one namespace and one class, what a simple class makes like easier.

    Below example reveals the way to convert a Chinese character to pinying.

     

    The number following the pinying is 5 different tones when Chinese pronouncing.

  • 相关阅读:
    [zjoi2012]灾难——拓扑排序+灭绝树
    [bzoj3590]Quare——状压DP
    [bzoj4144]Petrol——最小生成树+最短路
    [bzoj2407]探险——重构图+最短路
    [bzoj2725]故乡的梦——最短路+线段树
    [bzoj2118]墨墨的等式——同余最短路
    [loj2736][JOISC 2016 Day3]回转寿司——分块+堆
    PHP学习笔记二十四【Get Set】
    PHP学习笔记二十三【This】
    PHP学习笔记二十二【静态方法二】
  • 原文地址:https://www.cnblogs.com/LarryAtCNBlog/p/4740454.html
Copyright © 2011-2022 走看看