github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

rmm5t / liquidmetal

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 42
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Click here to lend your support to: liquidmetal and make a donation at www.pledgie.com ! Edit Pledgie Setup

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A mimetic poly-alloy of the Quicksilver scoring algorithm, essentially LiquidMetal. </Schwarzenegger Voice> — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Readme typo 
rmm5t (author)
Mon Jun 15 06:36:11 -0700 2009
commit  9584fa7c02b5bc4cae2b02cf74886a32a57dfd04
tree    97c00e07f64cb84c5de31de3f2f34b8736aa6bf7
parent  3a107592a5e59101048ee9838edfec19307c4e36
liquidmetal /
name age
history
message
file .gitignore Thu Feb 05 16:52:55 -0800 2009 Initial commit [rmm5t]
file README.markdown Mon Jun 15 06:36:11 -0700 2009 Readme typo [rmm5t]
file liquidmetal.js Mon Feb 09 14:17:47 -0800 2009 Date tweak [rmm5t]
file test.html Sat Feb 07 08:27:44 -0800 2009 Made tests a little less brittle against algori... [rmm5t]
README.markdown

LiquidMetal

A mimetic poly-alloy of the Quicksilver scoring algorithm, essentially LiquidMetal. </Schwarzenegger Voice>

Flex matching short abbreviations against longer strings is a boon in productivity for typists. Applications like Quicksilver, LaunchBar, and Launchy have made this method of keyboard entry a popular one. It's time to bring this same functionality to web controls. LiquidMetal makes scoring long strings against abbreviations easy.

Usage

Include the library:

<script src="liquidmetal.js" type="text/javascript"></script>

Score any string against an abbreviation:

LiquidMetal.score("FooBar",  "foo")   //=> 0.950
LiquidMetal.score("FooBar",  "fb")    //=> 0.917
LiquidMetal.score("Foo Bar", "fb")    //=> 0.929
LiquidMetal.score("Foo Bar", "baz")   //=> 0.0
LiquidMetal.score("Foo Bar", "")      //=> 0.8

All scores fall between a range of 0.0 (no match) to 1.0 (perfect match).

Inspired By

  • Quicksilver and its scoreForAbbreviation algorithm by Alcor
  • Quicksilver.js by Lachie Cox

Why?

  • To satisfy my own requirements for the jquery.flexselect plugin
  • The Quicksilver algorithm doesn't give proper weight to abbreviations that match the first character of the scored string.
  • The Quicksilver algorithm is extremely slow for certain length string/abbreviation combinations because of its use of recursion. While slightly slower for shorter length string/abbreviation combinations, LiquidMetal outperforms the Quicksilver algorithm by orders of magnitude under other conditions.
  • The javascript version of the Quicksilver algorithm is case sensitive and doesn't give added weight to camel case strings.

Todo

  • More tests
  • Consider tweaking the scores for "trailing" characters
  • Some abbreviations are capable of yielding multiple scores. Return the highest score instead of just the first.
  • See if it's possible to tune the performance further.

Author

Ryan McGeary (@rmm5t)

Other

MIT License

Copyright (c) 2009, Ryan McGeary (ryanonjavascript -[at]- mcgeary [dot] org)

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server