How to compare text?
cmkl
cmkleffner at gmx.de
Tue Dec 4 07:36:48 EST 2001
what about using the standard module 'difflib' with all it's helpers?
This module uses a very smart and fast algorithm for comparing
sequences and evaluating differences.
- The difflib method 'ndiff' is an easy wrapper to a UNIX-diff like
function to compare lists of strings.
- others are the classes Differ and SequenceMatcher
Maybe that's overkilled for a simple purpose, but its worth
to take a look.
Carl
"Guenter Kruschina" <G.Kruschina at gmx.de> wrote in message news:<mailman.1007411287.7555.python-list at python.org>...
> From: "A" <printers at sendme.cz>
> To: tutor at python.org, activepython at listserv.ActiveState.com,
> python-list at python.org
> Subject: How to compare text?
> Send reply to: printers at sendme.cz
> Priority: normal
> Date sent: Mon, 3 Dec 2001 11:06:04 +0100
>
> >
> > Hello,
> > How can I compare of one parragraph of text with another
> > paragraph?Each paragraph can have about 100 words.
> > For example I have the first paragraph
> >
> > I want to be very good at Python programming. Better than in Perl.
> >
> > THe second paragraph might look loke this:
> >
> > She works all day long to master Perl.
> >
> > All that I need is to find out if any of word from the second is in the
> > first paragraph. For the example above I should find out word
> >
> > Perl
> >
> >
> > What is the best and quickest way?
> > Thank you for help.
> > Ladislav
> >
> >
> > _______________________________________________
> > ActivePython mailing list
> > ActivePython at listserv.ActiveState.com
> > http://listserv.ActiveState.com/mailman/listinfo/activepython
> >
>
>
> Hallo Ladislav, I have written a small progam, which will work as you expe=
> ct. I
> hope so. I think this is a fast way to compare two paragraphs.
>
> wbg
> G=FCnter
>
>
>
> --
More information about the Python-list
mailing list