colophonetics

1.0.2 • Public • Published

Colophonetics

A JavaScript-based implementation of the Cologne Phonetics algorithm. It is one of the phonetic algorithms suited for the German language. More information on it can be found on the german or english Wikipedia page. Words that sound similar but may be written completely differently are represented by the same numerical sequence.

One example is the popular German name "Meier" which may also be written "Mayr". In Cologne Phonetics, both are represented as 67.

Why this fork?

  • passes tests based on the rules of the algorithm
  • faster
  • common-js and es-module

Usage

import

// import as ES-Module
import colophonetics from "colophonetics"

// or import as Common-JS
const colophonetics = require("colophonetics")

strings

// Wikipedia's example:
const nameString = "Müller-Lüdenscheidt"
console.log(colophonetics(testString))
// > "65752682"

// Meier/Mayr example:
console.log(colophonetics("Meier Mayr"))
// > "67 67"

arrays

const nameArray = ["Meier", "Mayr", "Maier"]
console.log(colophonetics(nameArray))
// > ["67", "67", "67"]

const sentence = ["The rabbit", "was to", "slow"]
console.log(colophonetics(sentence))
// > [ '2 712', '38 2', '853' ]

Package Sidebar

Install

npm i colophonetics

Weekly Downloads

19

Version

1.0.2

License

MIT

Unpacked Size

10.5 kB

Total Files

6

Last publish

Collaborators

  • tocrar