Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Is it possible to find the matching words and the percentage of matching words between two texts?

by karlgoethebier (Vicar)
on Dec 21, 2012 at 14:55 UTC ( #1009920=note: print w/ replies, xml ) Need Help??


in reply to Is it possible to find the matching words and the percentage of matching words between two texts?

#!/usr/bin/perl use strict; use warnings; use Set::Scalar; # use Data::Dumper; my @str1= qw(Poet Blake had a milky white cat He used to call it Pussy +); my @str2 = qw(Poet Blake had a white cat and used to call it Pussy); my $s1= Set::Scalar->new(@str1); my $s2 = Set::Scalar->new(@str2); my $result = $s1*$s2; print $result; __END__ (Blake Poet Pussy a call cat had it to used white)

See Set::Scalar

Perhaps this helps. Best regards, Karl

Update: You wrote you are a teacher. So i think you can do the math by yourself ;-)

Regards, Karl, Earl of GuttenPlag.

P.S.: And diff might be a weapon too...

«The Crux of the Biscuit is the Apostrophe»


Comment on Re: Is it possible to find the matching words and the percentage of matching words between two texts?
Download Code
Re^2: Is it possible to find the matching words and the percentage of matching words between two texts?
by supriyoch_2008 (Scribe) on Dec 22, 2012 at 10:18 UTC

    Hi karlgoethebier,

    Thanks for providing the code. It has solved my problem. Yes, I am a teacher and I shall do the math part.

    With kind regards

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009920]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2015-07-05 21:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls