I am interested to find out the matching words between an original text and a new text and the percentage
of matching words over the total words in new text. For example, I have an original text like $a="Poet Blake had a milky white cat.
He used to call it Pussy."; and a new text like $b="Poet Blake had a white cat and used to call it Pussy.";
The words that matched between these two texts are 11 i.e. Poet, Blake, had, a, white, cat, used, to, call, it, Pussy.
Moreover, there are 12 words in new text $b. Thus, the percentage of matching words over the new
text will be=(11/12)*100 i.e. 91.67%. Is it possible to get these results using a perl program?
This question is in continuation of one of my earlier nodes. I tried with a script that made use of a module called plagiarized.pm. but failed.
I am at my wit's end to get the desired results. I got some suggestions in this regard from perlmonks earlier. But I failed
to write a working script for the desired results.
Is it possible to use a simple script in perl to find the matching words between two texts and the percentage of matching words?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||