Giter Club home page Giter Club logo

phpstringcompare's Introduction

phpStringCompare

Original code is from hakanbolat/phpStringCompare

Compares two strings and outputs the similarities as percentage with PHP

##Usage:

    require_once 'StringPercentCompare.php';
    $compareStr = 'Asus ROG GL553VD-DM066 i7-7700HQ 2.80GHz 8GB 128GB SSD+1TB 15.6" FHD 4GB GTX 1050 FreeDOS Gaming Notebook';
    $comparedStr = 'ASUS GL553VD-DM065T i7-7700HQ/ 8 GB DDR4/1TB 5400RPM-128G M.2 SSD/4 GB NVIDIA GeForce GTX 1050/W10/GAMING NOTEBOOK';
  
    $compare = new StringPercentCompare($compareStr, $comparedStr);
  
    echo $compare->getSimilarityPercentage();

##Replace words

    $compare = new StringPercentCompare($compareStr, $comparedStr);
    
    $compare->replaceList = array(
        'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g',
        'д' => 'd', 'е' => 'e', 'ж' => 'j', 'з' => 'z',
        'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l',
        'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p',
        'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u',
        'ф' => 'f', 'х' => 'h', 'ц' => 'ts', 'ч' => 'ch',
        'ш' => 'sh', 'щ' => 'sch', 'ъ' => 'y', 'ы' => 'yi',
        'ь' => "'", 'э' => 'e', 'ю' => 'yu', 'я' => 'ya'
    );
    
    echo $compare->getSimilarityPercentage();

##Remove words

    $compare = new StringPercentCompare($compareStr, $comparedStr);
    
    $compare->removeList = array(
        'success', 'item'
    );
    
    echo $compare->getSimilarityPercentage();

phpstringcompare's People

Contributors

hakanbolat avatar

Stargazers

 avatar

Watchers

Shimba ( Vitaly ) avatar

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.