{"id":37213156,"url":"https://github.com/f1monkey/phonetic","last_synced_at":"2026-01-15T00:34:43.832Z","repository":{"id":65389457,"uuid":"570284510","full_name":"f1monkey/phonetic","owner":"f1monkey","description":"Phonetic encoders - bmpm, caverphone, soundex, metaphone","archived":false,"fork":false,"pushed_at":"2023-08-01T12:26:47.000Z","size":2915,"stargazers_count":20,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T23:15:23.286Z","etag":null,"topics":["beider-morse","bmpm","caverphone","go","golang","metaphone","phonetic-algorithm","soundex"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/f1monkey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-24T19:40:08.000Z","updated_at":"2025-11-16T22:10:57.000Z","dependencies_parsed_at":"2024-06-19T16:04:54.318Z","dependency_job_id":"345f3ddd-8d15-4d67-bf15-e870a9eacf8c","html_url":"https://github.com/f1monkey/phonetic","commit_stats":{"total_commits":101,"total_committers":1,"mean_commits":101.0,"dds":0.0,"last_synced_commit":"52be9200c2bca5a63ba1899c020b05083d07f765"},"previous_names":["f1monkey/bmpm"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/f1monkey/phonetic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1monkey%2Fphonetic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1monkey%2Fphonetic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1monkey%2Fphonetic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1monkey%2Fphonetic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f1monkey","download_url":"https://codeload.github.com/f1monkey/phonetic/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f1monkey%2Fphonetic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28439763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beider-morse","bmpm","caverphone","go","golang","metaphone","phonetic-algorithm","soundex"],"created_at":"2026-01-15T00:34:43.235Z","updated_at":"2026-01-15T00:34:43.821Z","avatar_url":"https://github.com/f1monkey.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phonetic\n\nSet of different phonetic encoders' implementations.\n\n* [Installation](#installion)\n* [Usage](#usage)\n\t* [Soundex](#soundex)\n\t* [Metaphone](#metaphone)\n\t* [Cologne phonetics](#cologne-phonetics)\n\t* [Caverphone2](#caverphone2)\n\t* [Beider-Morse](#beider-morse)\n* [Benchmarks](#benchmarks)\n\n## Installion\n\nTo install:\n```\n$ go get -v github.com/f1monkey/phonetic\n```\n\n## Usage\n\n### Soundex\nThe fastest algorithm in this library. Soundex is used to encode words into a phonetic code for matching similar sounding words with different spellings. It was developed for indexing English language names. [Wiki page](https://en.wikipedia.org/wiki/Soundex).\n\nCode example:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/f1monkey/phonetic/soundex\"\n)\n\nfunc main() {\n\te := soundex.NewEncoder()\n\tresult := e.Encode(\"orange\")\n\tfmt.Println(result)\n\t// prints: O652\n}\n```\n\n### Metaphone\n\nThe Metaphone encoder converts words into a phonetic code that represents their pronunciation for comparing words based on their phonetic properties, rather than their spelling. The Metaphone encoder was designed for English. [Wiki page](https://en.wikipedia.org/wiki/Metaphone)\n\nCode example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/f1monkey/phonetic/metaphone\"\n)\n\nfunc main() {\n\te := metaphone.NewEncoder()\n\tresult := e.Encode(\"orange\")\n\tfmt.Println(result)\n\t// prints: ORNJ\n}\n```\n\n\n### Cologne phonetics\nCologne phonetics (Kölner Phonetik) is a phonetic algorithm used for indexing German words by their sound, allowing for name and word matching in German language databases. [Wiki page](https://en.wikipedia.org/wiki/Cologne_phonetics)\n\nCode example:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/f1monkey/phonetic/cologne\"\n)\n\nfunc main() {\n\te := cologne.NewEncoder()\n\tresult := e.Encode(\"Großtraktor\")\n\tfmt.Println(result)\n\t// prints: 47827427\n}\n```\n\n### Caverphone2\nCaverphone2 is a phonetic algorithm used for indexing and matching names, particularly in English and New Zealand languages. [Wiki page](https://en.wikipedia.org/wiki/Caverphone)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/f1monkey/phonetic/caverphone2\"\n)\n\nfunc main() {\n\te := caverphone2.NewEncoder()\n\tresult := e.Encode(\"orange\")\n\tfmt.Println(result)\n\t// prints: ARNK111111\n}\n```\n\n\n### Beider-Morse\nIt's a Go port of [the original PHP library](https://stevemorse.org/phoneticinfo.htm)\nBMPM is a phonetic algorithm used for indexing and matching names in multiple languages. Contains a huge amount of different rules to transform a word to it's phonetic representation. Current implementation is relatively slow.\n\n\nTo reduce outcoming binary size, the three rulesets were split into different packages:\n* `github.com/f1monkey/phonetic/beidermorse` - generic rules (for general usage)\n* `github.com/f1monkey/phonetic/beidermorse/beidermorseash` - ashkenazi rules\n* `github.com/f1monkey/phonetic/beidermorse/beidermorsesep` - sephardic rules\n\nEach package contains `exact` and `approx` (default) rulesets. To use `exact` ruleset, you should pass a special option to encoder (see in example).\n\nCode examples:\n\n* `generic` ruleset with `approx` accuracy\n\t```go\n\timport (\n\t\t\"fmt\"\n\t\t\"github.com/f1monkey/phonetic/beidermorse\"\n\t)\n\n\tfunc main() {\n\t\tencoder, _ := beidermorse.NewEncoder()\n\t\tresult := encoder.Encode(\"orange\")\n\t\tfmt.Println(result)\n\t\t// prints: [orangi oragi orongi orogi orYngi Yrangi Yrongi YrYngi oranxi oronxi orani oroni oranii oronii oranzi oronzi urangi urongi]\n\t}\n\t```\n* `generic` ruleset with `exact` accuracy\n\t```go\n\timport (\n\t\t\"fmt\"\n\t\t\"github.com/f1monkey/phonetic/beidermorse\"\n\t)\n\n\tfunc main() {\n\t\tencoder, _ := beidermorse.NewEncoder(beidermorse.WithAccuracy(beidermorse.Exact))\n\t\tresult := encoder.Encode(\"orange\")\n\t\tfmt.Println(result)\n\t\t// prints: [orange oranxe oranhe oranje oranZe orandZe]\n\n\t}\n\t```\n* `generic` ruleset with `exact` accuracy and `english` language with buffer reusing (to reduce GC pressure)\n\t```go\n\timport (\n\t\t\"fmt\"\n\t\t\"github.com/f1monkey/phonetic/beidermorse\"\n\t)\n\n\tfunc main() {\n\t\tencoder, err = beidermorse.NewEncoder(\n\t\t\tbeidermorse.WithAccuracy(beidermorse.Exact),\n\t\t\tbeidermorse.WithLang(beidermorse.English),\n\t\t\tbeidermorse.WithBufferReuse(true),\n\t\t)\n\t\tresult := encoder.Encode(\"orange\")\n\t\tfmt.Println(result)\n\t\t// prints: [orenk orenge orendS orendZe oronk oronge orondS orondZe orank orange orandS orandZe arenk arenge arendS arendZe aronk aronge arondS arondZe arank arange arandS arandZe]\n\n\t}\n\t```\n* `ashkenazi` ruleset with `approx` accuracy\n\t```go\n\t\timport (\n\t\t\t\"fmt\"\n\t\t\t\"github.com/f1monkey/phonetic/beidermorseash\"\n\t\t)\n\n\t\tfunc main() {\n\t\t\tencoder, _ := beidermorseash.NewEncoder()\n\t\t\tresult := encoder.Encode(\"orange\")\n\t\t\tfmt.Println(result)\n\t\t\t// prints: [orangi orongi orYngi Yrangi Yrongi YrYngi oranzi oronzi orani oroni oranxi oronxi urangi urongi]\n\t\t}\n\t```\n* `sephardic` ruleset with `approx` accuracy\n\t```go\n\t\timport (\n\t\t\t\"fmt\"\n\t\t\t\"github.com/f1monkey/phonetic/beidermorsesep\"\n\t\t)\n\n\t\tfunc main() {\n\t\t\tencoder, _ := beidermorsesep.NewEncoder()\n\t\t\tresult := encoder.Encode(\"orange\")\n\t\t\tfmt.Println(result)\n\t\t\t// prints: [uranzi uranz uranS uranzi uranz uranhi uranh]\n\t\t}\n\t```\n\n## Benchmarks\n* Soundex\n\t```\n\tgoos: linux\n\tgoarch: amd64\n\tpkg: github.com/f1monkey/phonetic/soundex\n\tcpu: AMD Ryzen 9 6900HX with Radeon Graphics\n\tBenchmark_Encoder_Encode-16    \t14173989\t        99.21 ns/op\t       8 B/op\t       1 allocs/op\n\tPASS\n\tok  \tgithub.com/f1monkey/phonetic/soundex\t1.497s\n\t```\n* Metaphone\n\t```\n\tgoos: linux\n\tgoarch: amd64\n\tpkg: github.com/f1monkey/phonetic/metaphone\n\tcpu: AMD Ryzen 9 6900HX with Radeon Graphics        \n\tBenchmark_Encoder_Encode-16    \t 6451292\t       267.1 ns/op\t      48 B/op\t       3 allocs/op\n\tPASS\n\tok  \tgithub.com/f1monkey/phonetic/metaphone\t1.916s\n\t```\n* Cologne phonetics\n\t```\n\tgoos: linux\n\tgoarch: amd64\n\tpkg: github.com/f1monkey/phonetic/cologne\n\tcpu: AMD Ryzen 9 6900HX with Radeon Graphics\n\tBenchmark_Encoder_Encode-16    \t 3737944\t       374.8 ns/op\t     104 B/op\t       3 allocs/op\n\tPASS\n\tok  \tgithub.com/f1monkey/phonetic/cologne\t1.729s\n\t```\n* Caverphone2\n\t```\n\tgoos: linux\n\tgoarch: amd64\n\tpkg: github.com/f1monkey/phonetic/caverphone2\n\tcpu: AMD Ryzen 9 6900HX with Radeon Graphics\n\tBenchmark_Encoder_Encode-16    \t 1864532\t       641.7 ns/op\t      40 B/op\t       3 allocs/op\n\tPASS\n\tok  \tgithub.com/f1monkey/phonetic/caverphone2\t1.851s\n\t```\n* Beider-Morse\n\t```\n\tgoos: linux\n\tgoarch: amd64\n\tpkg: github.com/f1monkey/phonetic/beidermorse\n\tcpu: AMD Ryzen 9 6900HX with Radeon Graphics\n\tBenchmark_Encoder_Encode_En_Approx-16                \t    5769\t    219152 ns/op\t   21264 B/op\t     146 allocs/op\n\tBenchmark_Encoder_Encode_En_Exact-16                 \t   13203\t     82072 ns/op\t    9199 B/op\t      84 allocs/op\n\tBenchmark_Encoder_Encode_Ru_Approx-16                \t   30060\t     54323 ns/op\t    6093 B/op\t      48 allocs/op\n\tBenchmark_Encoder_Encode_Ru_Exact-16                 \t   37522\t     28353 ns/op\t    2657 B/op\t      26 allocs/op\n\t```\n\tWith buffer reuse:\n\t```\n\tgoos: linux\n\tgoarch: amd64\n\tpkg: github.com/f1monkey/phonetic/beidermorse\n\tcpu: AMD Ryzen 9 6900HX with Radeon Graphics\n\tBenchmark_Encoder_Encode_BufferReuse_En_Approx-16    \t   10000\t    129346 ns/op\t    6126 B/op\t     130 allocs/op\n\tBenchmark_Encoder_Encode_BufferReuse_En_Exact-16     \t   23198\t     48813 ns/op\t    2297 B/op\t      72 allocs/op\n\tBenchmark_Encoder_Encode_BufferReuse_Ru_Approx-16    \t   48902\t     29909 ns/op\t    1297 B/op\t      41 allocs/op\n\tBenchmark_Encoder_Encode_BufferReuse_Ru_Exact-16     \t   65834\t     16260 ns/op\t     485 B/op\t      22 allocs/op\n\t```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff1monkey%2Fphonetic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff1monkey%2Fphonetic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff1monkey%2Fphonetic/lists"}