Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Nice implementation. But I would also suggest that this should patch the existing perl implementation of Text::Levenshtein. Text::LevensteinXS is vanilla C and compiles and installs under 5.6.x on Win32 or Linux. You don't need 5.8 but it comiles with that too. See below. You may find Algorithm::HowSimilar does a very similar job but faster in pure perl.

[root@devel3 perl_modules]# tar -xzf Text-LevenshteinXS-0.01.tar.gz [root@devel3 perl_modules]# cd Text-LevenshteinXS-0.01 [root@devel3 Text-LevenshteinXS-0.01]# perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Text::LevenshteinXS [root@devel3 Text-LevenshteinXS-0.01]# make cp LevenshteinXS.pm blib/lib/Text/LevenshteinXS.pm AutoSplitting blib/lib/Text/LevenshteinXS.pm (blib/lib/auto/Text/Leven +shteinXS) /usr/bin/perl /usr/local/lib/perl5/5.6.2/ExtUtils/xsubpp -typemap /us +r/local/lib/perl5/5.6.2/ExtUtils/typemap LevenshteinXS.xs > Levensht +einXS.xsc && mv LevenshteinXS.xsc LevenshteinXS.c Please specify prototyping behavior for LevenshteinXS.xs (see perlxs m +anual) cc -c -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE +-D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" + -fpic "-I/usr/local/lib/perl5/5.6.2/i686-linux/CORE" LevenshteinXS +.c Running Mkbootstrap for Text::LevenshteinXS () chmod 644 LevenshteinXS.bs rm -f blib/arch/auto/Text/LevenshteinXS/LevenshteinXS.so LD_RUN_PATH="" cc -shared -L/usr/local/lib LevenshteinXS.o -o blib/a +rch/auto/Text/LevenshteinXS/LevenshteinXS.so chmod 755 blib/arch/auto/Text/LevenshteinXS/LevenshteinXS.so cp LevenshteinXS.bs blib/arch/auto/Text/LevenshteinXS/LevenshteinXS.bs chmod 644 blib/arch/auto/Text/LevenshteinXS/LevenshteinXS.bs Manifying blib/man3/Text::LevenshteinXS.3 [root@devel3 Text-LevenshteinXS-0.01]# make test PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl 1..6 # Running under perl version 5.006002 for linux # Current time local: Thu Mar 4 14:36:44 2004 # Current time GMT: Thu Mar 4 14:36:44 2004 # Using Test.pm version 1.24 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 [root@devel3 Text-LevenshteinXS-0.01]# make install Installing /usr/local/lib/perl5/site_perl/5.6.2/i686-linux/auto/Text/L +evenshteinXS/LevenshteinXS.so Installing /usr/local/lib/perl5/site_perl/5.6.2/i686-linux/auto/Text/L +evenshteinXS/LevenshteinXS.bs Files found in blib/arch: installing files in blib/lib into architectu +re dependent library tree Installing /usr/local/lib/perl5/site_perl/5.6.2/i686-linux/auto/Text/L +evenshteinXS/autosplit.ix Installing /usr/local/lib/perl5/site_perl/5.6.2/i686-linux/Text/Levens +hteinXS.pm Installing /usr/local/man/man3/Text::LevenshteinXS.3 Writing /usr/local/lib/perl5/site_perl/5.6.2/i686-linux/auto/Text/Leve +nshteinXS/.packlist Appending installation info to /usr/local/lib/perl5/5.6.2/i686-linux/p +erllocal.pod [root@devel3 Text-LevenshteinXS-0.01]# perl -v This is perl, v5.6.2 built for i686-linux [snip] [root@devel3 Text-LevenshteinXS-0.01]# D:\Tools\Perl Modules\Text-LevenshteinXS-0.01>perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Text::LevenshteinXS D:\Tools\Perl Modules\Text-LevenshteinXS-0.01>nmake Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cp LevenshteinXS.pm blib\lib\Text\LevenshteinXS.pm AutoSplitting blib\lib\Text\LevenshteinXS.pm (blib\lib\auto\Text\Leven +shteinXS) G:\Perl\bin\Perl.exe -IG:\Perl\lib -IG:\Perl\lib G:\Perl\lib\E +xtUtils/xs ubpp -typemap G:\Perl\lib\ExtUtils\typemap LevenshteinXS.xs > Levensh +teinXS.xsc && G:\Perl\bin\Perl.exe -IG:\Perl\lib -IG:\Perl\lib -MExtUtils::Comma +nd -e mv L evenshteinXS.xsc LevenshteinXS.c Please specify prototyping behavior for LevenshteinXS.xs (see perlxs m +anual) cl -c -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT + -DHAVE_DE S_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_REA +DFIX -O1 - MD -DNDEBUG -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -IG:\Perl\li +b\CORE Le venshteinXS.c LevenshteinXS.c "Running Mkbootstrap for Text::LevenshteinXS ()" G:\Perl\bin\Perl.exe -IG:\Perl\lib -IG:\Perl\lib -MExtUtils::C +ommand -e chmod 644 LevenshteinXS.bs G:\Perl\bin\Perl.exe "-IG:\Perl\lib" "-IG:\Perl\lib" -MExtUtil +s::Mksymli sts -e "Mksymlists('NAME' => 'Text::LevenshteinXS', 'DLBASE' => 'Leve +nshteinXS' , 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' = +> []);" link -out:blib\arch\auto\Text\LevenshteinXS\LevenshteinXS.dll +-dll -nolo go -nodefaultlib -release -libpath:"G:\Perl\lib\CORE" -machine:x86 L +evenshtein XS.obj G:\Perl\lib\CORE\perl56.lib oldnames.lib kernel32.lib user32. +lib gdi32. lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib olea +ut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc3 +2.lib odbc cp32.lib msvcrt.lib -def:LevenshteinXS.def Creating library blib\arch\auto\Text\LevenshteinXS\LevenshteinXS.li +b and obje ct blib\arch\auto\Text\LevenshteinXS\LevenshteinXS.exp G:\Perl\bin\Perl.exe -IG:\Perl\lib -IG:\Perl\lib -MExtUtils::C +ommand -e chmod 755 blib\arch\auto\Text\LevenshteinXS\LevenshteinXS.dll G:\Perl\bin\Perl.exe -IG:\Perl\lib -IG:\Perl\lib -MExtUtils::C +ommand -e cp LevenshteinXS.bs blib\arch\auto\Text\LevenshteinXS\LevenshteinXS.bs G:\Perl\bin\Perl.exe -IG:\Perl\lib -IG:\Perl\lib -MExtUtils::C +ommand -e chmod 644 blib\arch\auto\Text\LevenshteinXS\LevenshteinXS.bs D:\Tools\Perl Modules\Text-LevenshteinXS-0.01>nmake test Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. G:\Perl\bin\Perl.exe -Iblib\arch -Iblib\lib -IG:\Perl\lib -IG: +\Perl\lib test.pl 1..6 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 D:\Tools\Perl Modules\Text-LevenshteinXS-0.01>nmake install Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. Installing G:\Perl\site\lib\auto\Text\LevenshteinXS\LevenshteinXS.dll Installing G:\Perl\site\lib\auto\Text\LevenshteinXS\LevenshteinXS.lib Installing G:\Perl\site\lib\auto\Text\LevenshteinXS\LevenshteinXS.exp Installing G:\Perl\site\lib\auto\Text\LevenshteinXS\LevenshteinXS.bs Installing G:\Perl\site\lib\auto\Text\LevenshteinXS\autosplit.ix Installing G:\Perl\site\lib\Text\LevenshteinXS.pm Writing G:\Perl\site\lib\auto\Text\LevenshteinXS\.packlist Appending installation info to G:\Perl\lib/perllocal.pod D:\Tools\Perl Modules\Text-LevenshteinXS-0.01>perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-thread [snip] D:\Tools\Perl Modules\Text-LevenshteinXS-0.01>

cheers

tachyon


In reply to Re: improved levenshtein by tachyon
in thread improved levenshtein by bageler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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:
    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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (1)
    As of 2018-07-23 02:07 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















      Results (459 votes). Check out past polls.

      Notices?