Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/phonetic/core_ext/string/nysiis.rb,
lib/phonetic/core_ext/string/soundex.rb,
lib/phonetic/core_ext/string/metaphone.rb,
lib/phonetic/core_ext/string/caverphone.rb,
lib/phonetic/core_ext/string/dm_soundex.rb,
lib/phonetic/core_ext/string/caverphone2.rb,
lib/phonetic/core_ext/string/refined_soundex.rb,
lib/phonetic/core_ext/string/double_metaphone.rb

Instance Method Summary collapse

Instance Method Details

#caverphone(options = {}) ⇒ Object

Caverphone value of string

Examples:

'Lashaunda'.caverphone # => 'LSNT11'
'Vidaurri'.caverphone # => 'FTR111'


8
9
10
# File 'lib/phonetic/core_ext/string/caverphone.rb', line 8

def caverphone(options = {})
  Phonetic::Caverphone.encode(self, options)
end

#caverphone2(options = {}) ⇒ Object

Caverphone 2 value of string

Examples:

'Stevenson'.caverphone2 # => 'STFNSN1111'
'Peter'.caverphone2 # => 'PTA1111111'


8
9
10
# File 'lib/phonetic/core_ext/string/caverphone2.rb', line 8

def caverphone2(options = {})
  Phonetic::Caverphone2.encode(self, options)
end

#dm_soundex(options = {}) ⇒ Object

D-M Soundex values of string.

Examples:

'Anja'.dm_soundex # => ['060000', '064000']
'Schwarz'.dm_soundex # => ['474000', '479400']
'Schtolteheim'.dm_soundex # => ['283560']


9
10
11
# File 'lib/phonetic/core_ext/string/dm_soundex.rb', line 9

def dm_soundex(options = {})
  Phonetic::DMSoundex.encode(self, options)
end

#double_metaphone(options = { size: 4 }) ⇒ Object Also known as: metaphone2

Double Metahpone code of string.

Examples:

'czerny'.double_metaphone # => ['SRN', 'XRN']
'dumb'.double_metaphone   # => ['TM', 'TM']
'edgar'.double_metaphone  # => ['ATKR', 'ATKR']
# or use alias:
'czerny'.metaphone2 # => ['SRN', 'XRN']
'dumb'.metaphone2   # => ['TM', 'TM']
'edgar'.metaphone2  # => ['ATKR', 'ATKR']


13
14
15
# File 'lib/phonetic/core_ext/string/double_metaphone.rb', line 13

def double_metaphone(options = { size: 4 })
  Phonetic::DoubleMetaphone.encode(self, options)
end

#metaphone(options = { size: 4 }) ⇒ Object

Metaphone value of string.

Examples:

'Accola'.metaphone # => 'AKKL'
'Nikki'.metaphone # => 'NK'
'Wright'.metaphone #=> 'RT'


9
10
11
# File 'lib/phonetic/core_ext/string/metaphone.rb', line 9

def metaphone(options = { size: 4 })
  Phonetic::Metaphone.encode(self, options)
end

#nysiis(options = { trim: true }) ⇒ Object

Caverphone value of string.

Examples:

'Alexandra'.nysiis # => 'ALAXANDR'
'Aumont'.nysiis # => 'AANAD'
'Bonnie'.nysiis # => 'BANY'


9
10
11
# File 'lib/phonetic/core_ext/string/nysiis.rb', line 9

def nysiis(options = { trim: true })
  Phonetic::NYSIIS.encode(self, options)
end

#refined_soundex(options = { trim: true }) ⇒ Object

Refined Soundex value of string.

Examples:

'Caren'.refined_soundex   # => 'C30908'
'Hayers'.refined_soundex  # => 'H093'
'Lambard'.refined_soundex # => 'L7081096'


9
10
11
# File 'lib/phonetic/core_ext/string/refined_soundex.rb', line 9

def refined_soundex(options = { trim: true })
  Phonetic::RefinedSoundex.encode(self, options)
end

#soundex(options = { trim: true }) ⇒ Object

Soundex value of string

Examples:

'Ackerman'.soundex # => 'A265'
'ammonium'.soundex # => 'A500'
'implementation'.soundex # => 'I514'


9
10
11
# File 'lib/phonetic/core_ext/string/soundex.rb', line 9

def soundex(options = { trim: true })
  Phonetic::Soundex.encode(self, options)
end