项目作者: shakyjake

项目描述 :
Fuzzy string matching based on physical distance between keyboard keys
高级语言: JavaScript
项目地址: git://github.com/shakyjake/Fuzzical.git
创建时间: 2020-01-09T11:30:09Z
项目社区:https://github.com/shakyjake/Fuzzical

开源协议:MIT License

下载


Fuzzical

Fuzzy string matching based on physical distance between keys

Usage

new Fuzzical('yrdy', ['tester', 'test', 'Lorem ipsum dolor sit amet']); will return an ordered array of objects like so:

  1. [
  2. {"Phrase":"test","Score":0.4375},
  3. {"Phrase":"tester","Score":0.2916666666666667},
  4. {"Phrase":"Lorem ipsum dolor sit amet","Score":0.028846153846153848}
  5. ]

You can also pass a single string as the second argument (new Fuzzical('yrdy', 'test');), though this will still return an array as above (with a single entry).

Limitations

  • Only works for QWERTY, so it’s a heavily anglo-centric and unsuited to an international audience
  • Ignores punctuation but doesn’t strip punctuation, which is really rather silly now that I think of it

Cowardly Disclaimer

I built this for fun so can’t guarantee any updates/improvements going forward