English
Source / code snippets

Distance Levenshtein Lewenstein Lossifowitsch String Difference Wladimir

 
Peter woodpecker has Levenshtein-Distance [...]  for XProfan vorgemacht: [...] 

Peter woodpecker (07.11.10)
Well, the yellow of egg is the Original-Levenshtein not yet:
CompileMarkSeparation
WindowTitle "Levenshtein-Distanz (Stringvergleich)"
Cls @rgb(200,200,100)

proc LD' Compute Levenshtein-Distance

    parameters s$,t$
    s$=lower$(s$):var m&=len(s$)
    t$=lower$(t$):var n&=len(t$)
    declare d&[m&,n&],i&,j&,cost&,mi&,c&
    case m& = 0 : return n&
    case n& = 0 : return m&
    i&=0 : while i&<=m& : d&[i&,0]=i& : inc i& : endwhile
    j&=0 : while j&<=n& : d&[0,j&]=j& : inc j& : endwhile
    i&=1

    WHILE i&<=m&

        j&=1

        While j&<=n&

            cost&=1
            case Mid$(s$,i&,1)=Mid$(t$,j&,1):cost& = 0
            mi&=d&[i&-1,j&]+1
            c&=d&[i&,j&-1]+1
            case c&<mi& : mi&=c&
            c&=d&[i&-1,j&-1]+cost&
            case c&<mi& : mi&=c&
            d&[i&,j&]=mi&
            inc j&

        EndWhile

        inc i&

    ENDWHILE

    return d&[m&,n&]

Endproc

' Input Loop
declare str1$,str2$

While 1

    Locate 10,10 : print "String1  =                                   ";
    Locate 12,10 : print "String2  =                                   ";
    Locate 14,10 : print "Ergebnis =                                   ";
    Locate 10,21 : input str1$ : case str1$="" : End
    Locate 12,21 : input str2$
    Locate 14,21 : Print LD(str1$,str2$)
    WaitInput

EndWhile

'./../../function-references/XProfan/end/'>END

it missing z.B. a Änderung the Kostenbewerung in dependence of possible Hörfehlern (y,ü,i,j ; sh sch ; t d ; p b; k g; h _ ) u.v.a. More...
 
11/09/10  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.615 Views

Untitledvor 0 min.
p.specht05/08/21
Erfurt11/30/15
Peter Max Müller10/10/14
RudiB.03/18/13
More...

Themeninformationen

this Topic has 1 subscriber:

iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie