Skip to content

Instantly share code, notes, and snippets.

View brianewilkins's full-sized avatar

Brian Wilkins brianewilkins

  • IBM - CDS
  • Bedfont, UK
View GitHub Profile
@brianewilkins
brianewilkins / doubleMetaphone_search.js
Created August 7, 2019 11:01
A Cloudant Search index function that implements the Double Metaphone algorithm
'use strict'
// Match vowels (including `Y`).
var vowels = /[AEIOUY]/
// Match few Slavo-Germanic values.
var slavoGermanic = /W|K|CZ|WITZ/
// Match few Germanic values.
var germanic = /^(VAN |VON |SCH)/
@brianewilkins
brianewilkins / tchaikovsky_spelling_variants
Last active January 18, 2023 04:34
Alternative spellings of Tchaikovsky
Cajkovskij
Chaikovsky
Chaĭkovski
Chaĭkovskiĭ
Ciaikovski
Ciaikovskij
Ciaikovskji
Ciaikovsky
Csajkovszkij
Czajkowski
@brianewilkins
brianewilkins / fuzzy-search-using-the-double-metaphone-algorithm.md
Created July 8, 2019 15:10
"Fuzzy search using the Double Metaphone algorithm" - Work in progress

type: blog title: Fuzzy search using the Double Metaphone algorithm description: Using the Double Metaphone algorithm to find words that sound alike. layout: default date: 2019-07-02 author: Brian Wilkins image: assets/img/chris-barbalis-1217112-unsplash.jpg authorLink: relcanonical:

@brianewilkins
brianewilkins / ddoc.txt
Last active August 7, 2019 11:45
Design document that contains a view that implements the Double Metaphone algorithm
{
"_id": "_design/doubleMetaphone",
"views": {
"doubleMetaphone": {
"map": "'use strict'\n\n// Match vowels (including `Y`).\nvar vowels = /[AEIOUY]/\n\n// Match few Slavo-Germanic values.\nvar slavoGermanic = /W|K|CZ|WITZ/\n\n// Match few Germanic values.\nvar germanic = /^(VAN |VON |SCH)/\n\n// Match initial values of which the first character should be skipped.\nvar initialExceptions = /^(GN|KN|PN|WR|PS)/\n\n// Match initial Greek-like values of which the `CH` sounds like `K`.\nvar initialGreekCh = /^CH(IA|EM|OR([^E])|YM|ARAC|ARIS)/\n\n// Match Greek-like values of which the `CH` sounds like `K`.\nvar greekCh = /ORCHES|ARCHIT|ORCHID/\n\n// Match values which when following `CH`, transform `CH` to sound like `K`.\nvar chForKh = /[ BFHLMNRVW]/\n\n// Match values which when preceding a vowel and `UGH`, sound like `F`.\nvar gForF = /[CGLRT]/\n\n// Match initial values which sound like either `K` or `J`.\nvar initialGForKj = /Y[\\s\\S]|E[BILPRSY]|I[BELN]/\n\n// Match initial values which sound lik
@brianewilkins
brianewilkins / doubleMetaphone_view.js
Last active August 7, 2019 10:58
A Cloudant view map function that implements the Double Metaphone algorithm
'use strict'
module.exports = doubleMetaphone
// Match vowels (including `Y`).
var vowels = /[AEIOUY]/
// Match few Slavo-Germanic values.
var slavoGermanic = /W|K|CZ|WITZ/