Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
/ fuzzy Public archive

Fuzzy search using Levenshtein Distance (LD) and Longest Common Substring (LCS) algorithm.

License

Notifications You must be signed in to change notification settings

esyede/fuzzy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

fuzzy

Fuzzy search using Levenshtein Distance (LD) and Longest Common Substring (LCS) algorithm (single file, no dependencies)

Requirements

  • PHP 5.4 or newer

Installation

Download the file from release page and drop to your project. That's it.

Usage example

require 'Fuzzy.php';

$data = [
  ['name' => 'Halima Nasyidah', 'address' => 'Jln. Wahidin Sudirohusodo No. 483'],
  ['name' => 'Tiara Novitasari', 'address' => 'Gg. Kenanga No. 86'],
  ['name' => 'Irwan Balapati Nugroho', 'address' => 'Perum. Jamika No. 952'],
  ['name' => 'Dimas Marwata Napitupulu', 'address' => 'Kpg. Sijangkir No. 792']
];

$fuzzy = new Esyede\Fuzzy($data);

$keyword = 'Arah';
$attributes = 'name';

$results = $fuzzy->search($keyword, $attributes);
print_r($results);

$keyword = 'Na';
$attributes = ['name', 'address'];

$results = $fuzzy->search($keyword, $attributes);
print_r($results);

That's pretty much it. Thank you for stopping by!

License

This library is licensed under the MIT License