Giter Club home page Giter Club logo

pinyin-so's Introduction

pinyin-so

⚠️⚠️⚠️ 目前为非稳定版本

NPM version

拼音搜索方案,支持 全拼/简拼/同音字 等。

image/normal/2020-05-18/img-1589737460574-6747.png

Demo

by some framework as:

Usage

import PinyinSo from 'pinyin-so';

/**
 * @name    PinyinSo.so
 * @param   {String}    targetStr   待搜索文本
 * @param   {String}    keyword     搜索关键词
 * @returns {Boolean | Array}       失败结果 或者 结果索引
 */
const res = PinyinSo.so(`${targetStr}`, `${keyword}`);
if(res) {
  const [start, end] = res;
} else {
  console.log('No matching results.');
}

待办

  • 优化代码
  • 发新版

参考|感谢

pinyin-so's People

Stargazers

 avatar  avatar

Watchers

 avatar

pinyin-so's Issues

同音字搜索:多音字问题

官网的例子,「疏影横斜水清浅」,用「数」搜索,「疏」不会高亮,因为「数」有俩读音「shu」「shuo」,导致有问题。

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.