2017 © Pedro Peláez
 

library similar-string

Find level of similarity between strings based on Dice's Coefficient

image

aheenam/similar-string

Find level of similarity between strings based on Dice's Coefficient

  • Tuesday, January 23, 2018
  • by rathesDot
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Similar String

Find level of similarity between strings based on Dice's Coefficient., (*1)

Installation

Install the package by running, (*2)

$ composer require aheenam/similar-string

Usage

This package contains two classes, one for calculating Dice's Coefficient of two strings and another working with this value., (*3)

Dice's Coefficient

<?php

use Aheenam\SimilarString\Dice;

(new Dice)('night', 'nacht') // returns 0.25
(new Dice)('abcd', 'abcd') // returns 1
(new Dice)('qwerty', 'asdf') // returns 0

Similar Strings

This class provides 2 different methods:, (*4)

orderBySimilarity($string, $similarStrings = [])

This method orders the strings in $similarStrings by their Dice-Coefficient when compared to $string, (*5)

<?php

use Aheenam\SimilarString\SimilarString;

(new SimilarString)->orderBySimilarity('nacht', ['night', 'abcde', 'lacht']);
// returns ['lacht', 'night', 'abcde']

findMostSimilar($string, $similarStrings = [])

This methods returns the best match for $string out of $similarStrings, (*6)

<?php

use Aheenam\SimilarString\SimilarString;

(new SimilarString)->findMostSimilar('nacht', ['night', 'abcde', 'lacht']);
// returns 'lacht'

Changelog

Check CHANGELOG for the changelog, (*7)

Testing

To run tests use, (*8)

$ composer test

If you are working on a windows machine use, (*9)

vendor\bin\phpunit

Contributing

Information will follow soon, (*10)

Security

If you discover any security related issues, please email rathes@aheenam.com or use the issue tracker of GitHub., (*11)

About

Aheenam is a small company from NRW, Germany creating custom digital solutions. Visit our website to find out more about us., (*12)

License

The MIT License (MIT). Please see License File for more information., (*13)

The Versions

23/01 2018

dev-master

9999999-dev

Find level of similarity between strings based on Dice's Coefficient

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rathes Sachchithananthan

23/01 2018

0.1.0

0.1.0.0

Find level of similarity between strings based on Dice's Coefficient

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rathes Sachchithananthan