PHP Classes

check similariries between text files: i want to check different text documents to find similarities

Recommend this page to a friend!
  All requests RSS feed  >  check similariries between text files  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

check similariries between text files

Edit

Picture of Ayuba Dauda by Ayuba Dauda - 6 years ago (2018-06-07)

i want to check different text documents to find similarities

This request is clear and relevant.
This request is not clear or is not relevant.

+3

Am developing a plagiarism detection software with laravel and am at a point where i want to fetch a text file and compare it with other text files to find matching contents

Ask clarification

2 Recommendations

PHP Text Comparison: Compare two texts to find similar sentences

This class can compare two texts to find similar sentences.

It can take two text strings and compares them to determine how much each of the sentences in the texts are similar.

The class returns all sentences that have similarity level above a given percentage value also passed as parameter.
This recommendation solves the problem.
This recommendation does not solve the problem.

+2

Picture of riccardo castagna by riccardo castagna package author package author Reputation 195 - 6 years ago (2018-06-27) Comment

This php package is useful to compare two different texts in the hypothesis that the two source texts have a good spelling and a correct punctuation. It finds similar sentences and returns the percentages, these percentages are the measures of how much the sentences are similar with each others. Possible applications and uses could be in the field of journalism, for example, to find the similar articles, in the cases of plagiarism, for investigations of various kinds when it is necessary to analyze and compare texts with each other. I hope this could be useful for the developing of your software

  • 1 Comment
  • 1. Picture of riccardo castagna by riccardo castagna package author package author - 6 years ago (2018-07-02) Reply

    just a note: when I read this request for the first time, there was still nothing published about it. So, I started working on it. It was not my intention to be in competition with someone but only collaborative. In any case, it went like this, maybe it's better for you, so you can have two different points of view on how to solve your request and you can take a cue from both solutions, both from my colleague and from mine. I wish you good luck with your project.


PHP Similar Text Percentage: Compare two strings to compute a similarity score

This class can compare two strings to compute a similarity score.

It takes the text of two strings and analyze them using pure PHP code to evaluate how equal they are.

The class returns a number that represents a percentage of the two strings to tell the level of similarity.

It achieves that by sorting words, ignoring white space and punctuation, removing or adding word, strip URLs, replace words by acronyms or expanding acronyms into the original words, compare words with similar sounds using stems, checking parts of the strings, replace words by abbreviations or using anagrams.
This recommendation solves the problem.
This recommendation does not solve the problem.

+1

Picture of zinsou A.A.E.Moïse by zinsou A.A.E.Moïse package author package author Reputation 6835 - 6 years ago (2018-06-26) Comment

The habit here is to recommend the best package to achieve the asked purpose,however for want of the best I suggest this package that you can use this way :

require the main class file then in your script use this function

function similarfile($ffile,$sfile,$round=2,$insensitive=true,&$stat=null,&$diff=null){

if(!file_exists($ffile)||!file_exists($sfile)) return false;
$diff=array();
return similarText(file_get_contents($ffile),file_get_contents($sfile),$round,$insensitive,$stat,$diff);

}

eg: echo '<pre>'; var_dump(similarFile(__FILE__,__FILE__,2,true,$stats,$diff),$stats,$diff);

will print

float(100) array(3) { ["reallycontain"]=> bool(true) ["contain"]=> bool(true) ["percentageRc"]=> int(100) } array(0) { }


Recommend package
: 
: