PHP Classes

PHP Similarity Between Two Strings: Calculate the similarity level of two text strings

Recommend this page to a friend!
  Info   View files Example   View files View files (12)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-01-03 (10 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 45 All time: 10,422 This week: 129Up
Version License PHP version Categories
find-diff 1.0.0GNU Lesser Genera...5Algorithms, PHP 5, Text processing
Description Author

This package can calculate the similarity level of two text strings.

It can take two text strings and apply algorithms to calculate a number that represents the similarity between those strings.

The class that implements the Hamming distance algorithm returns the number of text characters that are different in each string.

The class that implements the Levenshtein algorithm returns a number that represents the number of steps that are necessary to change the first string into the second strings.

Picture of mohammad anzawi
  Performance   Level  
Name: mohammad anzawi <contact>
Classes: 8 packages by
Country: Jordan Jordan
Age: 8
All time rank: 14562 in Jordan Jordan
Week rank: 146 Up1 in Jordan Jordan Up
Innovation award
Innovation award
Nominee: 2x

Details

find-diff

calculate levenshtein distances &amp; hamming distances between 2 strings using PHP

please note : PHP provided build-in functions to do what this library do it's just for fun !

levenshtein function

gmp_hamdist function

main Classes located in (/libs/) directory

installation

  • open your `terminal`/`cmd`/`powershell`
  • navigate to your projects directory
  • run `git clone https://github.com/anzawi/find-diff.git`
  • navigate to project `cd find-diff`
  • run `composer install`

this project require find-diff as a library check composer.json file and take a look on repositories section.

run test in command-line

  • open your `terminal`/`cmd`/`powershell`
  • navigate to project directory
  • run `php runTest --s1="Mohammad" --s2="Mohammed"`

run test project

  • run any preferred php server
  • navigate to project
  • you will see a simple form
  • start testing

don't forget to run test using phpunit ./vendor/bin/phpunit

  Files folder image Files  
File Role Description
Files folder imageapp (1 file)
Files folder imagelibs (2 files, 1 directory)
Files folder imagetests (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file readme.md Doc. Documentation
Accessible without login Plain text file runTest Data Auxiliary data

  Files folder image Files  /  app  
File Role Description
  Accessible without login Plain text file Action.php Class Class source

  Files folder image Files  /  libs  
File Role Description
Files folder imagesrc (2 files)
  Accessible without login Plain text file composer.json Data Auxiliary data
  Accessible without login Plain text file composer.lock Data Auxiliary data

  Files folder image Files  /  libs  /  src  
File Role Description
  Accessible without login Plain text file Hamming.php Class Class source
  Accessible without login Plain text file Levenshtein.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file HammingTest.php Class Class source
  Accessible without login Plain text file LevenshteinTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:45
This week:0
All time:10,422
This week:129Up