Git Product home page Git Product logo

pinyin2group's Introduction

pinyin2group

Downloads Version License

基于pinyin4js的通讯录分组排序工具
注:暂仅支持Node

特点

  • 通讯录分组排序工具

  • 方便通讯录调用
    以首字母分组、可选补全26个字母、排序时同一字母自动比较下一个

  • 准确、完善的字库
    Unicode编码从4E00-9FA5范围及3007(〇)的20903个汉字中,pinyin4js能转换除46个异体字(异体字不存在标准拼音)之外的所有汉字

  • 拼音转换速度快
    经测试,从4E00-9FA5范围的20902个汉字,pinyin4js耗时约110毫秒

  • 多拼音格式输出支持
    支持多种拼音输出格式:带音标、不带音标、数字表示音标以及拼音首字母输出格式

  • 常见多音字识别
    支持常见多音字的识别,其中包括词组、成语、地名等

  • 简繁体中文转换

怎么用

  • INSTALL
    npm install pinyin2group
  • USE

Node

    //[email protected] or latest
    import { Pinyin2Group } from './Pinyin2Group';

    // more detail methods in test

    // output: [ { letter: 'A', wordsList: [] },
    // { letter: 'B', wordsList: [] },
    // { letter: 'C', wordsList: [] },
    // ...
    // { letter: 'W', wordsList: [] },
    // { wordsList: [ [Object] ], letter: 'X' },
    // { letter: 'Y', wordsList: [] },
    // { letter: 'Z', wordsList: [] } ]
    console.log(new Pinyin2Group().groupByFirstLetter([{ word: '厦门你好大厦厦门' }]));

    // output: [ { wordsList: [ [Object] ], letter: 'X' } ]
    console.log(new Pinyin2Group().groupByFirstLetter([{ word: '厦门你好大厦厦门' }], { hasFullLetter: false }));

    // output: xiamennihaodashaxiamen
    console.log(new Pinyin2Group().getPinyinWithoutTone('厦门你好大厦厦门'));

    // output: XIAMENNIHAODASHAXIAMEN
    console.log(new Pinyin2Group().getPinyinWithoutTone('厦门你好大厦厦门', { isUppercase: true }));

    // output: xia men ni hao da sha xia men
    console.log(new Pinyin2Group().getPinyinWithoutTone('厦门你好大厦厦门'), { separator: ' ' });

pinyin2group's People

Contributors

dependabot[bot] avatar york0519 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.