yaochenkun / pinyin-searcher Goto Github PK
View Code? Open in Web Editor NEW一个支持以汉字、拼音首字母、拼音前缀、非汉字串前缀、非汉字串后缀等及他们混合进行关键字搜索的jar包。
一个支持以汉字、拼音首字母、拼音前缀、非汉字串前缀、非汉字串后缀等及他们混合进行关键字搜索的jar包。
做模糊查询时看了很多项目,大部分项目在中文转拼音预处理这个环节,算法是用一堆List堆出来的,我不得不在查询对象里保存这堆预处理的List,几千条数据每条都多了一大串List我想想都觉得恶心,后续关键字匹配过程也异常复杂而且臃肿,老实这些东西让我觉得很厌烦.但你这边竟然把它转变成正则表达式,这个算法真的太神奇了,简直是变魔术. 现在我只需要在查询对象里保存一段短短的字符串,而关键字匹配需要一次String.match就OK了.简直太神奇,非常感谢你!
另外,我看到你的PinyinSearcher.java里用到了很多反射,我想目的是为了兼容所有的实体类,所以通过反射来获取字段.我认为通过接口来做会更好.需要查询的对象implements查询接口,通过查询接口提供的
public String setSearchWord()来设置查询的字段.而外面提供的查询方法可以通过泛型<T extends 查询接口>,这样保持了灵活性,而且性能更高,更易懂.
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.