eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'PhoneticStringUtilities::PhoneticStringComparator':

Home

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

Class: PhoneticStringComparator (private in PhoneticStringUtilities

This class is only visible from within PhoneticStringUtilities.

Inheritance:

   Object
   |
   +--PhoneticStringUtilities::PhoneticStringComparator
      |
      +--PhoneticStringUtilities::DaitchMokotoffStringComparator
      |
      +--PhoneticStringUtilities::DoubleMetaphoneStringComparator
      |
      +--PhoneticStringUtilities::ExtendedSoundexStringComparator
      |
      +--PhoneticStringUtilities::SingleResultPhoneticStringComparator

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

Description:


abstract superclass for various phonetic comparators.
They returns similar strings for similar sounding words, which can be used
to find similar sounding words in a search list.

Notice, that some comparators are better for particular languages.


Class protocol:

constant
o  defaultClass

instance creation
o  new
(comment from inherited method)
return an instance of myself without indexed variables

queries
o  isAbstract
(comment from inherited method)
Return if this class is an abstract class.
True is returned for Object here; false for subclasses.
Abstract subclasses must redefine this again.

utilities
o  does: aString soundLike: anotherString
return true, if aString sounds similar to anotherString

Usage example(s):

     PhoneticStringUtilities::SoundexStringComparator does:'miller' soundLike:'miler'.   

     PhoneticStringUtilities::SoundexStringComparator does:'miller' soundLike:'milner'.   

     PhoneticStringUtilities::SoundexStringComparator does:'müller' soundLike:'mueller'.   

     PhoneticStringUtilities::KoelnerPhoneticCodeStringComparator does:'müller' soundLike:'mueller'.   
     PhoneticStringUtilities::DoubleMetaphoneStringComparator does:'müller' soundLike:'mueller'.   

o  encode: word
return a phonetic encoding for a word.
This can eg. be used as key to map/hash similar sounding words

Usage example(s):

     SoundexStringComparator encode:'Fischer'             -> 'F260'
     SoundexStringComparator encode:'Fiescher'            -> 'F260'
     Caverphone2StringComparator encode:'Fischer'         -> 'FSKA111111'
     Caverphone2StringComparator encode:'Fiescher'        -> 'FSKA111111'
     MRAStringComparator encode:'Fischer'                 -> 'FSCHR'
     MRAStringComparator encode:'Fiescher'                -> 'FSCHR'
     SpanishPhoneticCodeStringComparator encode:'Fischer'  -> '24429'
     SpanishPhoneticCodeStringComparator encode:'Fiescher' -> '24429'
     DoubleMetaphoneStringComparator encode:'Fischer'      -> 'FXR'
     DoubleMetaphoneStringComparator encode:'Fiescher'     -> 'FXR'


Instance protocol:

api
o  does: aString soundLike: anotherString
return true, if aString sounds similar to anotherString

Usage example(s):

     PhoneticStringUtilities::SoundexStringComparator new does:'miller' soundLike:'miler'.   

     PhoneticStringUtilities::SoundexStringComparator new
            does:'miller' soundLike:'milner'.   

     PhoneticStringUtilities::SoundexStringComparator new
            does:'müller' soundLike:'mueller'.   

     PhoneticStringUtilities::KoelnerPhoneticCodeStringComparator new
            does:'müller' soundLike:'mueller'.   

o  phoneticStringsFor: aString
Should answer an array of alternate phonetic strings for the given input string.

** This method must be redefined in concrete classes (subclassResponsibility) **

initialization
o  initialize
Invoked when a new instance is created.

Usage example(s):

super initialize.   -- commented since inherited method does nothing


Examples:


PhoneticStringUtilities::SoundexStringComparator new
       does:'miller' soundLike:'miler'.   

PhoneticStringUtilities::SoundexStringComparator new
       does:'miller' soundLike:'milner'.   

PhoneticStringUtilities::SoundexStringComparator new
       does:'müller' soundLike:'mueller'.   

PhoneticStringUtilities::KoelnerPhoneticCodeStringComparator new
       does:'müller' soundLike:'mueller'.   


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Wed, 04 Dec 2024 08:47:03 GMT