Skip to content

zengargoyle/p6-Search-Dict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

a fast binary search of dictionary like files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%