Giter Club home page Giter Club logo

phpstringcompare's Introduction

phpStringCompare

Compares two strings and outputs the similarities as percentage with PHP

Usage:

  require_once 'StringPercentCompare.php';
  $string1 = 'Asus ROG GL553VD-DM066 i7-7700HQ 2.80GHz 8GB 128GB SSD+1TB 15.6" FHD 4GB GTX 1050 FreeDOS Gaming Notebook';
  $string2 = 'ASUS GL553VD-DM065T i7-7700HQ/ 8 GB DDR4/1TB 5400RPM-128G M.2 SSD/4 GB NVIDIA GeForce GTX 1050/W10/GAMING NOTEBOOK';
  $percent = new StringPercentCompare(
        $string1,
        $string2,
        array('remove_html_tags'=>true, 'remove_extra_spaces'=>true,
            'remove_punctuation'=>true, 'punctuation_symbols'=>Array('(',')'),
            'convert_language'=>true, 'non_alphanumeric'=>true,
            'unnecessary_words'=>true, 'convert_word'=>true,'debug'=>true
        ));
  echo $percent->getSimilarityPercentage();

phpstringcompare's People

Contributors

hakanbolat avatar

Stargazers

legibe avatar

Watchers

 avatar

Forkers

shbumba

phpstringcompare's Issues

bug remove_extra_spaces/remove_html_tags

hi :-)

there's a little bug in the code, line 71:

if (!empty($params['remove_extra_spaces'])) {
	$this->_remove_extra_spaces = $params['remove_html_tags'];
}

should actually be:

if (!empty($params['remove_extra_spaces'])) {
	$this->_remove_extra_spaces = $params['remove_extra_spaces'];
}

also, there's two arrays ($lang1 and $lang2) containing a list of accents of non-english languages that is unused in the code, and also incomplete (i can think of "éèêàôö" in french, "ß" in german, "ñ" in spanish, ... the list must be somewhere on internet, google knows it for sure, but a function to get them all would be a more efficient approach, and stackoverflow will have that for sure).

it's a great script otherwise, thanks for sharing it, even though it was a long time ago! ( :

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.