Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 7 Monaten, 3 Wochen
Letzter Beitrag:
vor 7 Monaten, 2 Wochen
Beteiligte Autoren:
Art Bonds, Ola, Guenter PREDL, Fabrice Harari, Guy F.

Soundex

Startbeitrag von Art Bonds am 25.11.2017 22:24

I was looking through the Help for Soundex and was surprised when it was not there. Most DB servers have that functionality. Am I missing something (maybe my Frenglish is not as proficient as it should be...).

Thanks, Art

Antworten:

Hi,

Is this what you are looking for ?

http://doc.windev.com/en-US/?2034005

von Guy F. - am 26.11.2017 03:01
I was hoping there was a Soundex function in Wx, but this may have to do. Thanks!

von Art Bonds - am 26.11.2017 04:06
Hello Art,

there is nothing like that for the English language in WinDev and the phonetik function available is only french based...

However, there is a fully coded soundex function in WXEDM, ready for you.

Best regards

von Fabrice Harari - am 26.11.2017 13:26
Hi Art, this is the Soundx algorithm in Standard BASIC:

100 DECLARE EXTERNAL FUNCTION FNSoundex$
110
120 DATA Ashcraft, Ashcroft, Gauss, Ghosh, Hilbert, Heilbronn, Lee, Lloyd
130 DATA Moses, Pfister, Robert, Rupert, Rubin, Tymczak, Soundex, Example
140 FOR i = 1 TO 16
150 READ name$
160 PRINT """"; name$; """"; TAB(15); FNsoundex$(name$)
170 NEXT i
180 END
190
200 EXTERNAL FUNCTION FNsoundex$(name$)
210 LET name$ = UCASE$(name$)
220 LET n$ = "01230129022455012623019202"
230 LET s$ = name$(1:1)
240 LET p = VAL(n$(ORD(s$) - 64 : ORD(s$) - 64))
250 FOR i = 2 TO LEN(name$)
260 LET n = VAL(n$(ORD(name$(i:i)) - 64: ORD(name$(i:i)) - 64))
270 IF n 0 AND n 9 AND n p THEN LET s$ = s$ & STR$(n)
280 IF n 9 THEN LET p = n
290 NEXT i
300 LET s$ = s$ & "000"
310 LET FNSoundex$ = s$(1:4)
320 END FUNCTION

It should be easy to convert to WLanguage ...

There are two more BASIC Sources:
http://www.source-code.biz/snippets/vbasic/4.htm

Another one in VB6
Private Function SoundEx(ByVal WordString As String, _
Optional SoundExLen As Integer = 4) As String

Dim Counter As Integer
Dim CurrChar As String

If SoundExLen > 10 Then
SoundExLen = 10
ElseIf SoundExLen < 4 Then
SoundExLen = 4
End If
SoundExLen = SoundExLen - 1

WordString = UCase(WordString)

For Counter = 1 To Len(WordString)
If Asc(Mid(WordString, Counter, 1)) < 65 Or Asc(Mid(WordString, Counter, 1)) > 90 Then
Mid(WordString, Counter, 1) = " "
End If
Next Counter
WordString = Trim(WordString)

SoundEx = WordString

SoundEx = Replace(SoundEx, "A", "0")
SoundEx = Replace(SoundEx, "E", "0")
SoundEx = Replace(SoundEx, "I", "0")
SoundEx = Replace(SoundEx, "O", "0")
SoundEx = Replace(SoundEx, "U", "0")
SoundEx = Replace(SoundEx, "Y", "0")
SoundEx = Replace(SoundEx, "H", "0")
SoundEx = Replace(SoundEx, "W", "0")
SoundEx = Replace(SoundEx, "B", "1")
SoundEx = Replace(SoundEx, "P", "1")
SoundEx = Replace(SoundEx, "F", "1")
SoundEx = Replace(SoundEx, "V", "1")
SoundEx = Replace(SoundEx, "C", "2")
SoundEx = Replace(SoundEx, "S", "2")
SoundEx = Replace(SoundEx, "G", "2")
SoundEx = Replace(SoundEx, "J", "2")
SoundEx = Replace(SoundEx, "K", "2")
SoundEx = Replace(SoundEx, "Q", "2")
SoundEx = Replace(SoundEx, "X", "2")
SoundEx = Replace(SoundEx, "Z", "2")
SoundEx = Replace(SoundEx, "D", "3")
SoundEx = Replace(SoundEx, "T", "3")
SoundEx = Replace(SoundEx, "L", "4")
SoundEx = Replace(SoundEx, "M", "5")
SoundEx = Replace(SoundEx, "N", "5")
SoundEx = Replace(SoundEx, "R", "6")

CurrChar = Left(SoundEx, 1)
For Counter = 2 To Len(SoundEx)
If Mid(SoundEx, Counter, 1) = CurrChar Then
Mid(SoundEx, Counter, 1) = " "
Else
CurrChar = Mid(SoundEx, Counter, 1)
End If
Next Counter
SoundEx = Replace(SoundEx, " ", "")

SoundEx = Mid(SoundEx, 2)
SoundEx = Replace(SoundEx, "0", "")

SoundEx = SoundEx & String(SoundExLen, "0")
SoundEx = Left(WordString, 1) & Left(SoundEx, SoundExLen)
End Function

von Guenter PREDL - am 26.11.2017 13:59
Fabrice, Guenter,

Thanks for the replies. I have been doing some research on soundex-like algorithms. Quite an interesting topic. Soundex is almost 100 years old now, and other algorithms have improved on it over the years. Daitch-Mokotoff Soundex, Cologn phonetics, Metaphone, Double Metaphone, Metaphone 3, New York State Identification and Intelligence System, and more. All have pluses and minuses.
Currently the best (IMO) is Metaphone 3, but you have to pay to use it. The next is Double Metaphone. I have found some PHP code, around 800 lines or so. I am going to try and convert that to WLanguage this weekend. If I am successful I will post it to the code examples part of this board and make an announcement here.

So if any of y'all have a PHP to WLanguage utility laying around I sure could use it... :D

von Art Bonds - am 30.11.2017 14:59
Hi Art,

This is the global and straightforward solution to your problem:
Change your language to Finnish.
It is pronounced letter for letter just like it is written:-)

Best regards
Ola

von Ola - am 01.12.2017 11:22
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.