a fast binary search of dictionary like files
Other
Switch branches/tags
Nothing to show
Latest commit a374fae Jun 15, 2017 @zengargoyle let mi6 reformat META
Permalink
Failed to load latest commit information.
lib/Search be a bit more verbose on :ver:auth Jun 14, 2017
logotype add a logo Jun 15, 2017
t fix for IO changes Jun 14, 2017
xt add xt test for META6.json Jun 14, 2017
.gitignore post xmas Jan 12, 2016
.travis.yml
LICENSE mi6 skeleton Nov 9, 2015
MANIFEST try to make todo tester happy Jun 14, 2017
META6.json
README.md push to github Nov 9, 2015

README.md

Build Status

NAME

Search::Dict - a fast binary search of dictionary like files

SYNOPSIS

use Search::Dict;

my &lookup = search-dict('/usr/share/dict/words');

given lookup('existing-word') -> $w {
  +$w;  # seek offset in dict
  ?$w;  # True
  ~$w;  # 'existing-word'
}
given lookup('non-existing-word') -> $w {
  +$w;  # seek offset after where non-existing-word would be
  ?$w;  # False
  ~$w;  # word after where non-existing-word would be
  # or
  $w.match.defined # False  - after last word in dict
}

DESCRIPTION

Search::Dict is a fast binary search of dictionary like files (e.g. /usr/share/dict/words). A dictionary file is one where:

one entry per line

lines are sorted

AUTHOR

zengargoyle zengargoyle@gmail.com

COPYRIGHT AND LICENSE

Copyright 2015 zengargoyle

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.