eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'PhoneticStringUtilities::NYSIISStringComparator':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: NYSIISStringComparator (private in PhoneticStringUtilities

This class is only visible from within PhoneticStringUtilities.

Inheritance:

   Object
   |
   +--PhoneticStringUtilities::PhoneticStringComparator
      |
      +--PhoneticStringUtilities::SingleResultPhoneticStringComparator
         |
         +--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  encode: aString
2. Transcode initial strings: MAC => MC PF => F

usage example(s):

     self new encode:'hello'
     self new encode:'bliss'

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

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

o  rule12: key
12. change 'KN' to 'N', else 'K' to 'C'

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
18. if not first or last character, change 'Y' to 'A'

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

o  rule1: key
1. Remove all 'S' and 'Z' chars from the end of the name

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

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

o  rule22: key
22. remove trailing vowels

o  rule23: key
23. collapse all strings of repeated characters

o  rule24: key originalKey: originalKey
24. if first char of original surname was a vowel, append it to the code

o  rule2: key
2. Transcode initial strings: MAC => MC PF => F

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

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
6. Remove any 'W' that follows a vowel

o  rule7: key
7. replace all vowels with 'A'

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 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 11:24:27 GMT