{"id":28247643,"url":"https://github.com/beldar/universal-rhymer","last_synced_at":"2025-07-24T02:31:23.150Z","repository":{"id":293537976,"uuid":"980609881","full_name":"beldar/universal-rhymer","owner":"beldar","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-15T20:06:21.000Z","size":10585,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T05:34:39.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beldar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-05-09T12:14:01.000Z","updated_at":"2025-05-15T20:06:25.000Z","dependencies_parsed_at":"2025-05-15T21:35:18.493Z","dependency_job_id":null,"html_url":"https://github.com/beldar/universal-rhymer","commit_stats":null,"previous_names":["beldar/universal-rhymer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beldar/universal-rhymer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beldar%2Funiversal-rhymer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beldar%2Funiversal-rhymer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beldar%2Funiversal-rhymer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beldar%2Funiversal-rhymer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beldar","download_url":"https://codeload.github.com/beldar/universal-rhymer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beldar%2Funiversal-rhymer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266785431,"owners_count":23983821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-05-19T11:10:58.569Z","updated_at":"2025-07-24T02:31:23.100Z","avatar_url":"https://github.com/beldar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# universal-rhymer\n\nA Node.js library to find rhymes and count syllables from a CMU-style phoneme dictionary in ARPABET or IPA formats.\n\n## Installation\n\nInstall from npm:\n\n```bash\nnpm install universal-rhymer\n```\n\n## Usage\n\nUse the library in your TypeScript or JavaScript project:\n\n```ts\nimport { initDictionary } from \"universal-rhymer\";\n\nasync function demo() {\n  const { countSyllables, findRhyme, findRhymesBySyllable } =\n    await initDictionary(\"path/to/dict.txt\");\n\n  // Count syllables\n  console.log(countSyllables(\"time\"));\n  // =\u003e 1\n\n  // Find flat list of rhymes\n  console.log(findRhyme(\"time\"));\n  // =\u003e [\"rhyme\", \"lime\", ...]\n\n  // Find rhymes grouped by syllable count\n  console.log(findRhymesBySyllable(\"time\"));\n  // =\u003e { 1: [\"rhyme\", \"lime\"], ... }\n}\n\ndemo();\n```\n\n## CLI Demo\n\nA simple command-line demo is included in `demo.ts`. Run it with:\n\n```bash\nnpm run demo -- path/to/dictionary [word]\n```\n\n- `path/to/dictionary`: path to your ARPABET or IPA dictionary file\n- `[word]`: optional word to analyze (defaults to `time`)\n\n## CSV Conversion\n\nConvert a CSV-based dictionary into the CMU/IPA format using `csv2dict.ts`:\n\n- If your CSV has a header row starting with `word`, it will be skipped.\n- **Multiple phoneme columns**:\n  ```csv\n  word,phoneme1,phoneme2,phoneme3\n  time,T,AY,M\n  ```\n- **Single-quoted phoneme string**:\n  ```csv\n  word,phonemes\n  time,\"T AY M\"\n  ```\n\nRun the converter:\n\n```bash\nnpm run csv2dict -- input.csv output.dict\n```\n\nThe `output.dict` file can then be used directly:\n\n```bash\nnpm run demo -- output.dict [word]\n```\n\n## API Reference\n\n```ts\nasync function initDictionary(\n  path: string\n): Promise\u003c{\n  /** Count syllables of a word using the first pronunciation */\n  countSyllables(word: string): number;\n\n  /** Find an array of words that rhyme with the input word */\n  findRhyme(word: string): string[];\n\n  /**\n   * Find rhymes grouped by their syllable count.\n   * Returns a mapping: syllableCount -\u003e array of rhyming words\n   */\n  findRhymesBySyllable(word: string): Record\u003cnumber, string[]\u003e;\n}\u003e;\n```\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to open an issue or pull request.\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeldar%2Funiversal-rhymer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeldar%2Funiversal-rhymer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeldar%2Funiversal-rhymer/lists"}