eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'PhoneticStringUtilities::NYSIISStringComparator':

Home

everywhere
www.exept.de
for:
[back]

Class: NYSIISStringComparator (private in PhoneticStringUtilities

This class is only visible from within PhoneticStringUtilities.

Inheritance:

   Object
   |
   +--PhoneticStringUtilities::NYSIISStringComparator

Package:
stx:libbasic2
Category:
Collections-Text-Support
Owner:
PhoneticStringUtilities

Description:


NYSIIS Algorithm:

1.
    remove all ''S'' and ''Z'' chars from the end of the surname 

2.
    transcode initial strings
        MAC => MC
        PF => F

3.
    Transcode trailing strings as follows,
    
        IX => IC
        EX => EC
        YE,EE,IE => Y
        NT,ND => D 

4.
    transcode ''EV'' to ''EF'' if not at start of name

5.
    use first character of name as first character of key 

6.
    remove any ''W'' that follows a vowel 

7.
    replace all vowels with ''A'' 

8.
    transcode ''GHT'' to ''GT'' 

9.
    transcode ''DG'' to ''G'' 

10.
    transcode ''PH'' to ''F'' 

11.
    if not first character, eliminate all ''H'' preceded or followed by a vowel 

12.
    change ''KN'' to ''N'', else ''K'' to ''C'' 

13.
    if not first character, change ''M'' to ''N'' 

14.
    if not first character, change ''Q'' to ''G'' 

15.
    transcode ''SH'' to ''S'' 

16.
    transcode ''SCH'' to ''S'' 

17.
    transcode ''YW'' to ''Y'' 

18.
    if not first or last character, change ''Y'' to ''A'' 

19.
    transcode ''WR'' to ''R'' 

20.
    if not first character, change ''Z'' to ''S'' 

21.
    transcode terminal ''AY'' to ''Y'' 

22.
    remove traling vowels 

23.
    collapse all strings of repeated characters 

24.
    if first char of original surname was a vowel, append it to the code


Instance protocol:

api
o  phoneticStringsFor: aString

private
o  rule10: key
10. transcode 'PH' to 'F'

o  rule11: key

o  rule12: key

o  rule13: key
13. if not first character, change 'M' to 'N'

o  rule14: key
14. if not first character, change 'Q' to 'G'

o  rule15: key
15. transcode 'SH' to 'S'

o  rule16: key
16. transcode 'SCH' to 'S'

o  rule17: key
17. transcode 'YW' to 'Y'

o  rule18: key

o  rule19: key
19. transcode 'WR' to 'R'

o  rule1: key

o  rule20: key
20. if not first character, change 'Z' to 'S'

o  rule21: key
21. transcode terminal 'AY' to 'Y'

o  rule22: key

o  rule23: key

o  rule24: key originalKey: originalKey

o  rule2: key

o  rule3: key

o  rule4: key
4. Transcode 'EV' to 'EF' if not at start of name

o  rule5: key
5. Use first character of name as first character of key. Ignored because we're doing an in-place conversion

o  rule6: key

o  rule7: key

o  rule8: key
8. transcode 'GHT' to 'GT'

o  rule9: key
9. transcode 'DG' to 'G'

o  transcodeAll: aString of: key to: replacementString startingAt: start

o  transcodeTrailing: anArrayOfStrings of: key to: replacementString



ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 21:36:30 GMT