Skip to content
/ bitap Public

[ABANDONED] A fuzzy string search library for PHP based on the Bitap algorithm

License

Notifications You must be signed in to change notification settings

okdana/bitap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

\Dana\Bitap

\Dana\Bitap is a minimal PHP implementation of a Bitap fuzzy string-matching algorithm.

Warning

This project hasn't been updated in a long time, and i don't think it's very good anyway. I haven't tried it myself, but you might consider using Loilo/Fuse instead.

Usage

Two methods are provided: match(), which tests an individual needle string against an individual hay-stack string, and grep(), which tests an individual needle string against an array of hay-stack strings (similar to \preg_grep().

// Returns true
(new \Dana\Bitap\Bitap())->match('foo', 'foobar', 0);

// Returns [0 => 'foobar']
(new \Dana\Bitap\Bitap())->grep('bar', ['foobar', 'foobaz'], 0);

// Returns [0 => 'foobar', 1 => 'foobaz']
(new \Dana\Bitap\Bitap())->grep('bar', ['foobar', 'foobaz'], 1);

To do

  • Make Unicode-safe
  • Provide methods which return the match index(es)

About

[ABANDONED] A fuzzy string search library for PHP based on the Bitap algorithm

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published