fzy
Version, currently 0.6.014 versions
- 0.6.0latestNov 14, 2024
- 0.5.5not indexedNov 14, 2024
- 0.5.4not indexedNov 14, 2024
- 0.5.3not indexedNov 14, 2024
- 0.5.2not indexedNov 14, 2024
- 0.5.1not indexedNov 14, 2024
- 0.5.0not indexedNov 14, 2024
- 0.4.0not indexedNov 14, 2024
- 0.3.0not indexedNov 14, 2024
- 0.2.2not indexedNov 14, 2024
- 0.2.1not indexedNov 14, 2024
- 0.2.0not indexedNov 14, 2024
- 0.1.1not indexedNov 14, 2024
- 0.1.0not indexedNov 14, 2024
github.com/hugopl/fzy
String fuzzy matcher lib, port of Fyz algorithm.
49 stars
3 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
fzy:
github: hugopl/fzy
version: ~> 0.6.0Then run:
shards installshard.yml
- Crystal
>=0.36.1- License
- MIT
- Author
- Hugo Parente Lima
Dependencies
This version declares no dependencies.
README
fzy.cr
A Crystal port of awesome Fzy fuzzy finder algorithm.
Installation
- Add the dependency to your
shard.yml:
dependencies:
fzy:
github: hugopl/fzy
- Run
shards install
Usage
Basic usage:
require "fzy"
matches = Fzy.search("hey", %w(Hey Whatever Halley), store_positions: true)
matches.each do |match|
puts "value: #{match.item}"
puts "score: #{match.score}"
puts " pos: #{match.positions.inspect}"
end
Should print
value: Hey
score: Infinity
pos: [0, 1, 2]
value: Halley
score: 1.87
pos: [0, 4, 5]
If you need to do many searches on the same set of data you can speed up things by
creating an Fzy::PreparedHaystack or an array of Fzy::Hay.
require "fzy"
haystack = %w(Hey Halley Whatever)
prepared_haystack = Fzy::PreparedHaystack.new(haystack)
matches = Fzy.search("hey", prepared_haystack)
matches.each do |match|
puts "value: #{match.item}"
puts "score: #{match.score}"
puts " pos: #{match.positions.inspect}"
end
# Reusing the prepared haystack makes the search faster.
matches = Fzy.search("ho let's go!", prepared_haystack)
Contributing
- Fork it (https://github.com/hugopl/fzy/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Hugo Parente Lima - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.6.0- Tagged
- Nov 14, 2024
- Commit
1e8afa8da197- Crystal
>=0.36.1- Indexed
- yes
Dependents
Repository
github.com/hugopl/fzy
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 28, 2026
- Synced
- Sep 28, 2026
- Versions
- 14