English
Source / code snippets

Kölner Phonetik Soundex Search

 

Michael
W.
time so one little Phonetik moreover...
CompileMarkSeparation
' phonetische Suche
' - Soundex
' - Kölner Phonetik
' XProfan X2

Proc Soundex

    Parameters String Wort
    Declare String c,d,e
    Var String erg = ""
    Wort = Upper$(Wort)
    Wort = Translate$(Wort,"ß","S")
    c = "" : d = "" : e = ""

    WhileLoop Len(Wort)

        Case InStr(Mid$(Wort,&loop,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZß") : c = c + Mid$(Wort,&loop,1)

    EndWhile

    Wort = c

    If Len(Wort) = 1

        erg = Wort

    ElseIf Len(Wort) > 1

        erg = Left$(Wort,1)

        WhileLoop 2,Len(Wort)

            c = Mid$(Wort,&loop,1)

            If InStr(c,"BFPV")

                d = "1"

            ElseIf InStr(c,"CGJKQSXZ")

                d = "2"

            ElseIf InStr(c,"DT")

                d = "3"

            ElseIf InStr(c,"L")

                d = "4"

            ElseIf InStr(c,"MN")

                d = "5"

            ElseIf InStr(c,"R")

                d = "6"

            EndIf

            If d <> e

                erg = erg + d
                e = d

            EndIf

            Case Len(erg) >= 4 : BREAK

        EndWhile

    EndIf

    erg = Left$(erg + "0000",4)
    Return erg

EndProc

Proc KPhon

    Parameters String Wort
    Declare String c,Pre,Post, Long WPos,WLen, i
    Var String erg = ""

    If Len(Wort) > 0

        c = ""
        Wort = Upper$(Wort)

        WhileLoop Len(Wort)

            Case InStr(Mid$(Wort,&loop,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜß") : c = c + Mid$(Wort,&loop,1)

        EndWhile

        Wort = c

    EndIf

    If Len(Wort) > 0

        WLen = Len(Wort)

        WhileLoop WLen

            Pre  = if(&loop > 1,Mid$(Wort,&loop - 1,1),"")
            c    = Mid$(Wort,&loop,1)
            Post = if(&loop < WLen,Mid$(Wort,&loop + 1,1),"")

            If InStr(c,"AEIJOUYÄÖÜ")

                erg = erg + "0"

            ElseIf c = "H"

                'ignore

            ElseIf (c = "B") or ((c = "P") and (Post <> "H"))

                erg = erg + "1"

            ElseIf InStr(c,"DT") and not(InStr(Post,"CSZ"))

                erg = erg + "2"

            ElseIf InStr(c,"FVW") or ((c = "P") and (Post = "H"))

                erg = erg + "3"

            ElseIf InStr(c,"GKQ")

                erg = erg + "4"

            ElseIf (c = "C") and (InStr(Post,"AHKLOQRUX")) and (&loop = 0)

                erg = erg + "4"

            ElseIf (c = "C") and (InStr(Post,"AHKOQUX")) and not(InStr(Pre,"SZ"))

                erg = erg + "4"

            ElseIf (c = "X") and not(InStr(Pre,"CKQ"))

                erg = erg + "48"

            ElseIf (c = "L")

                erg = erg + "5"

            ElseIf InStr(c,"MN")

                erg = erg + "6"

            ElseIf (c = "R")

                erg = erg + "7"

            ElseIf InStr(c,"SZß")

                erg = erg + "8"

            ElseIf (c = "C") and (InStr(Pre,"SZ"))

                erg = erg + "8"

            ElseIf (c = "C") and Not(InStr(Post,"AHKLOQRUX")) and (&loop = 0)

                erg = erg + "8"

            ElseIf (c = "C") and Not(InStr(Post,"AHKOQUX"))

                erg = erg + "8"

            ElseIf InStr(c,"DT") and (InStr(Post,"CSZ"))

                erg = erg + "8"

            ElseIf (c = "X") and (InStr(Pre,"CKQ"))

                erg = erg + "8"

            Else

                'Fehler

            EndIf

        EndWhile

        ' jetzt erg ausdünnen
        i = Len(erg)

        While i > 1

            c = Mid$(erg,i,1)
            Case (c = Mid$(erg,i - 1,1)) or (c = "0") : erg = Del$(erg,i,1)
            Dec i

        EndWhile

    EndIf

    Return erg

EndProc

proc x

    parameters string s
    print s,"=",KPhon(s),"--",Soundex(s)

endproc

Cls
x("Wikipedia")
x("Breschnew")
x("Müller-Lüdenscheidt")
x("Meier")
x("Maier")
x("Mayer")
x("Mayr")
x("Haus")
x("Maus")
x("frisch")
x("Fisch")
x("Waage")
x("wiegen")
x("Britney")
x("Spears")
x("bewährten")
xass=s2>("Superzicke")
waitkey
end
 
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
12/28/14  
 



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.892 Views

Untitledvor 0 min.
p.specht06/05/22
Walter06/05/22
Uwe Lang11/20/21
Manfred Barei11/19/21
More...

Themeninformationen

this Topic has 1 subscriber:

Michael W. (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