{"id":32294452,"url":"https://github.com/yosina-lib/yosina","last_synced_at":"2026-03-01T04:08:58.907Z","repository":{"id":308264935,"uuid":"794387471","full_name":"yosina-lib/yosina","owner":"yosina-lib","description":"Yosina is a transliteration library deals with the letters and symbols used in Japanese writing.","archived":false,"fork":false,"pushed_at":"2025-09-24T13:14:48.000Z","size":2058,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-12-06T22:53:09.844Z","etag":null,"topics":["hyphens","japanese","normalization","preprocessing","symbols","transliteration","unicode"],"latest_commit_sha":null,"homepage":"https://yosina.io/","language":"Rust","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/yosina-lib.png","metadata":{"files":{"readme":"README.ja.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-01T03:23:21.000Z","updated_at":"2025-11-12T23:01:49.000Z","dependencies_parsed_at":"2025-09-15T04:25:16.579Z","dependency_job_id":null,"html_url":"https://github.com/yosina-lib/yosina","commit_stats":null,"previous_names":["yosina-lib/yosina"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/yosina-lib/yosina","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yosina-lib%2Fyosina","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yosina-lib%2Fyosina/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yosina-lib%2Fyosina/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yosina-lib%2Fyosina/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yosina-lib","download_url":"https://codeload.github.com/yosina-lib/yosina/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yosina-lib%2Fyosina/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29960236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["hyphens","japanese","normalization","preprocessing","symbols","transliteration","unicode"],"created_at":"2025-10-23T03:44:33.221Z","updated_at":"2026-03-01T04:08:58.898Z","avatar_url":"https://github.com/yosina-lib.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yosinaプロジェクト\n\n- [English](./README.md)\n\n| 言語 | パッケージリポジトリ | インストールコマンド |\n|----------|-------------------|-----------------|\n| JavaScript/TypeScript | [npm ![@yosina-lib/yosina](https://img.shields.io/npm/v/@yosina-lib/yosina) ](https://www.npmjs.com/package/@yosina-lib/yosina) | `npm install @yosina-lib/yosina` |\n| Python | [PyPI ![yosina](https://img.shields.io/pypi/v/yosina)](https://pypi.org/project/yosina/) | `pip install yosina` |\n| Rust | [crates.io ![yosina](https://img.shields.io/crates/v/yosina)](https://crates.io/crates/yosina) | `cargo add yosina` |\n| Java | [Maven Central ![yosina.io/yosina](https://img.shields.io/maven-central/v/io.yosina/yosina)](https://central.sonatype.com/artifact/io.yosina/yosina) | [クイックスタート](#java)を参照 |\n| Ruby | [RubyGems ![yosina](https://img.shields.io/gem/v/yosina)](https://rubygems.org/gems/yosina) | `gem install yosina` |\n| Go | [Go Packages ![yosina](https://img.shields.io/badge/pkg.go.dev-reference-007d9c)](https://pkg.go.dev/github.com/yosina-lib/yosina/go) | `go get github.com/yosina-lib/yosina/go` ![github.com/yosina-lib/yosina/go](https://img.shields.io/badge/go.dev-reference-007d9c) |\n| PHP | [Packagist ![yosina-lib/yosina](https://img.shields.io/packagist/v/yosina-lib/yosina)](https://packagist.org/packages/yosina-lib/yosina) | `composer require yosina-lib/yosina` |\n| C# (.NET) | [NuGet Gallery ![Yosina](https://img.shields.io/nuget/v/Yosina)](https://www.nuget.org/packages/Yosina) | `dotnet add package Yosina` |\n| Dart | [pub.dev ![yosina](https://img.shields.io/pub/v/yosina.svg)](https://pub.dev/packages/yosina) | `dart pub add yosina` |\n| Swift | Swift Package Manager | [クイックスタート](#swift)を参照 |\n\n## はじめに\n\nYosinaは、日本語文字に使用される文字や記号を専門的に扱う翻字ライブラリです。日本語は、中国語や英語の文字だけでなく、ドイツ語やフランス語などの様々な文字体系の影響を受けた独特の文字体系を持つ長い歴史があります。また、日本の文字コード体系の標準には非常に複雑な問題があり、Unicodeが広く普及した後でも不確実性を引き起こし続けています。\n\n「Yosina」という名前は、「適切に」「ふさわしく」「あなたが最善と思うように」という意味の古い日本語の副詞「よしなに」から取られています。日本語テキストを扱う開発者は、同じ文字に対してなぜこれほど多くのバリエーションが存在するのかと常に疑問に思い、そのような落とし穴をすべて忘れさせてくれるものがあればと願ったことがあるでしょう。Yosinaは、開発者がそのようなテキストをより適切に処理できる方法となることを願って名付けられました。\n\n## 機能\n\nYosinaは、次のような様々な日本語テキスト変換を処理できます：\n\n- **半角・全角変換**：半角カタカナや記号を全角に変換し、その逆も可能です。\n\n    ![変換例](./common/assets/conversion-example1.svg)\n\n    ![変換例](./common/assets/conversion-example2.svg)\n\n- **視覚的に曖昧な文字の処理**：カタカナ・ひらがなの間のハイフンマイナスを長音記号に文脈的に置き換え、その逆も可能です。\n\n    ![変換例](./common/assets/conversion-example3.svg)\n\n    ![変換例](./common/assets/conversion-example4.svg)\n\n- **旧字体から新字体への漢字変換**：旧字体の字形を現代の新字体に変換します。\n\n    ![変換例](./common/assets/conversion-example5.svg)\n\n- **ひらがな・カタカナ変換**：ひらがなとカタカナの間で双方向に変換し、濁音・半濁音文字を正しく処理します。\n\n- **日本語繰り返し記号の展開**：繰り返し記号（々、ゝ、ゞ、ヽ、ヾ）を前の文字を適切な濁音処理で繰り返すことで展開します。\n\n## 多言語サポート\n\nYosinaは複数のプログラミング言語で利用可能です：\n\n- **[JavaScript/TypeScript](javascript/)** - 包括的な機能を持つオリジナル実装 (Node.js 22+, 主要ブラウザ, Deno 1.28+)\n- **[Python](python/)** - PythonicなインターフェースのPythonポート (Python 3.10+)\n- **[Rust](rust/)** - 高性能なRust実装 (Rust 2021 edition以降)\n- **[Java](java/)** - Gradleビルドシステムを使用したJava実装 (Java 17+)\n- **[Ruby](ruby/)** - Ruby固有のインターフェースを持つRuby実装 (Ruby 2.7+)\n- **[Go](go/)** - エラーハンドリングとパフォーマンスに重点を置いたGo実装 (Go 1.21+)\n- **[PHP](php/)** - モダンなPHP機能をサポートするPHP実装 (PHP 8.2+)\n- **[C#](csharp/)** - .NETサポートとコード生成機能を持つC#実装 (.NET 9.0+)\n- **[Swift](swift/)** - Swift Package ManagerをサポートするSwift実装 (Swift 5.0+)\n- **[Dart](dart/)** - FlutterおよびDartアプリケーション向けのDart実装 (Dart 3.0+)\n\n## クイックスタート\n\n### JavaScript/TypeScript\n\n```bash\nnpm install @yosina-lib/yosina\n```\n\n```javascript\nimport { makeTransliterator, TransliterationRecipe } from '@yosina-lib/yosina';\n\n// レシピを使用(推奨)\nconst recipe: TransliterationRecipe = {\n  kanjiOldNew: true,\n  toHalfwidth: true,\n  replaceSuspiciousHyphensToprolongedSoundMarks: true\n};\n\nconst transliterator = await makeTransliterator(recipe);\nconst result = transliterator('日本語のテキスト');\nconsole.log(result);\n```\n\n### Python\n\n```bash\npip install yosina\n```\n\n```python\nfrom yosina import make_transliterator, TransliterationRecipe\n\n# レシピを使用(推奨)\nrecipe = TransliterationRecipe(\n    kanji_old_new=True,\n    jisx0201_and_alike=True,\n    replace_suspicious_hyphens_to_prolonged_sound_marks=True\n)\n\ntransliterator = make_transliterator(recipe)\nresult = transliterator(\"日本語のテキスト\")\nprint(result)\n```\n\n### Rust\n\n`Cargo.toml`に追加：\n\n```toml\n[dependencies]\nyosina = \"1.0.0\"\n```\n\n### Java\n\n`build.gradle`に追加：\n\n```gradle\ndependencies {\n    implementation 'io.yosina:yosina:1.0.0'\n}\n```\n\n```java\nimport io.yosina.Yosina;\nimport io.yosina.TransliterationRecipe;\nimport java.util.function.Function;\n\n// レシピを使用(推奨)\nTransliterationRecipe recipe = new TransliterationRecipe()\n    .withKanjiOldNew(true)\n    .withCombineDecomposedHiraganasAndKatakanas(true)\n    .withReplaceSpaces(true);\n\nFunction\u003cString, String\u003e transliterator = Yosina.makeTransliterator(recipe);\nString result = transliterator.apply(\"日本語のテキスト\");\nSystem.out.println(result);\n```\n\n### Ruby\n\n```bash\ngem install yosina\n```\n\n```ruby\nrequire 'yosina'\n\n# レシピを使用(推奨)\nrecipe = Yosina::TransliterationRecipe.new(\n  kanji_old_new: true,\n  replace_spaces: true,\n  replace_suspicious_hyphens_to_prolonged_sound_marks: true\n)\n\ntransliterator = Yosina.make_transliterator(recipe)\nresult = transliterator.call(\"日本語のテキスト\")\nputs result\n```\n\n### Go\n\n```bash\ngo get github.com/yosina-lib/yosina/go\n```\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"github.com/yosina-lib/yosina/go\"\n)\n\nfunc main() {\n    recipe := \u0026yosina.TransliterationRecipe{\n        ReplaceSpaces: true,\n        KanjiOldNew: true,\n    }\n    \n    transliterator, err := yosina.MakeTransliterator(recipe)\n    if err != nil {\n        log.Fatal(err)\n    }\n    \n    result, err := transliterator(\"日本語のテキスト\")\n    if err != nil {\n        log.Fatal(err)\n    }\n    \n    fmt.Println(result)\n}\n```\n\n### PHP\n\n```bash\ncomposer require yosina-lib/yosina\n```\n\n```php\n\u003c?php\n\nuse Yosina\\TransliterationRecipe;\nuse Yosina\\Yosina;\n\n$recipe = new TransliterationRecipe(\n    replaceSpaces: true,\n    kanjiOldNew: true\n);\n\n$transliterator = Yosina::makeTransliterator($recipe);\n$result = $transliterator('日本語のテキスト');\necho $result;\n```\n\n### C#\n\n```bash\ndotnet add package Yosina\n```\n\n```csharp\nusing Yosina;\n\n// レシピを使用(推奨)\nvar recipe = new TransliterationRecipe\n{\n    ReplaceSpaces = true,\n    ReplaceRadicals = true,\n    KanjiOldNew = true\n};\n\nvar transliterator = Yosina.MakeTransliterator(recipe);\nvar result = transliterator(\"日本語のテキスト\");\nConsole.WriteLine(result);\n```\n\n### Swift\n\n`Package.swift`に追加：\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/yosina-lib/yosina-swift\", from: \"1.0.0\")\n]\n```\n\n```swift\nimport Yosina\n\n// レシピを使用(推奨)\nlet recipe = TransliterationRecipe(\n    kanjiOldNew: true,\n    toHalfwidth: true,\n    replaceSpaces: true\n)\n\nlet transliterator = try recipe.makeTransliterator()\nlet result = transliterator.transliterate(\"日本語のテキスト\")\nprint(result)\n```\n\n### Dart\n\n```bash\ndart pub add yosina\n```\n\n```dart\nimport 'package:yosina/yosina.dart';\n\n// レシピを使用(推奨)\nfinal recipe = TransliterationRecipe(\n  kanjiOldNew: true,\n  toHalfwidth: true,\n  replaceSpaces: true,\n);\n\nfinal transliterator = makeTransliterator(recipe);\nfinal result = transliterator('日本語のテキスト');\nprint(result);\n```\n\n## プロジェクトの範囲と制限\n\n韓国語などの他の言語でも同様の問題が存在することは知られていますが、このライブラリは現在のところ日本語の文字に現れる文字のみを処理します。\n\nこのライブラリが処理する唯一の文字符号化文字集合 (CCS) はUnicodeです。JIS標準で定義されたCCSは特定のバージョンのUnicode文字集合によって支えられていると仮定していますが、その逆は仮定していません。\n\nJIS X 0201では、通常のラテン文字と引用符やアポストロフィなどの特定の記号をJIS X 0211で指定された制御符号と組み合わせて発音記号付きのアルファベットをレンダリングする制御シーケンスが規定されています。しかし、上記の理由により、そのようなシーケンスはサポートされません。\n\n## 利用可能なトランスリテレータ\n\nYosinaは15の専門的なトランスリテレータを提供しており、レシピシステムを通じて個別に使用したり、組み合わせて使用したりできます：\n\n### 1. **丸囲み・角囲み文字** (`circled-or-squared`)\n丸囲みや角囲みの文字を通常の文字に変換します。\n- オプション: `templates` (カスタムレンダリング)、`includeEmojis` (絵文字を含める)\n- 例: `①②③` → `(1)(2)(3)`、`㊙㊗` → `(秘)(祝)`\n\n### 2. **結合文字** (`combined`)\n結合文字を個別の文字シーケンスに展開します。\n- 例: `㍻` (平成) → `平成`、`㈱` → `(株)`\n\n### 3. **ひらがな・カタカナ合成** (`hira-kata-composition`)\n分解されたひらがなとカタカナを合成された等価文字に結合します。\n- オプション: `composeNonCombiningMarks` (非結合マークを合成)\n- 例: `か + ゙` → `が`、`ヘ + ゜` → `ペ`\n\n### 4. **ひらがな・カタカナ** (`hira-kata`)\nひらがなとカタカナの間で双方向に変換します。\n- オプション: `mode` (\"hira-to-kata\" または \"kata-to-hira\")\n- 例: `ひらがな` → `ヒラガナ` (hira-to-kata)\n\n### 5. **ハイフン** (`hyphens`)\n様々なダッシュ・ハイフン記号を日本語で一般的に使用されるものに置き換えます。\n- オプション: `precedence` (マッピング優先順位)\n- 利用可能なマッピング: \"ascii\"、\"jisx0201\"、\"jisx0208_90\"、\"jisx0208_90_windows\"、\"jisx0208_verbatim\"\n- 例: `2019—2020` (emダッシュ) → `2019-2020`\n\n### 6. **表意文字注釈** (`ideographic-annotations`)\n伝統的な中国語から日本語への翻訳で使用される表意文字注釈を置き換えます。\n- 例: `㆖㆘` → `上下`\n\n### 7. **IVS-SVSベース** (`ivs-svs-base`)\n表意文字異体字セレクタ（IVS）と標準化異体字セレクタ（SVS）を処理します。\n- オプション: `charset`、`mode` (\"ivs-or-svs\" または \"base\")、`preferSVS`、`dropSelectorsAltogether`\n- 例: `葛󠄀` (葛 + IVS) → `葛`\n\n### 8. **日本語繰り返し記号** (`japanese-iteration-marks`)\n繰り返し記号を前の文字を繰り返すことで展開します。\n- 例: `時々` → `時時`、`いすゞ` → `いすず`\n\n### 9. **JIS X 0201および類似** (`jisx0201-and-alike`)\n半角・全角文字変換を処理します。\n- オプション: `fullwidthToHalfwidth`、`convertGL` (英数字/記号)、`convertGR` (カタカナ)、`u005cAsYenSign`\n- 例: `ABC123` → `ＡＢＣ１２３`、`ｶﾀｶﾅ` → `カタカナ`\n\n### 10. **旧字体・新字体** (`kanji-old-new`)\n旧字体の漢字を新字体に変換します。\n- 例: `舊字體の變換` → `旧字体の変換`\n\n### 11. **数学英数記号** (`mathematical-alphanumerics`)\n数学英数記号を通常のASCIIに正規化します。\n- 例: `𝐀𝐁𝐂` (数学太字) → `ABC`\n\n### 12. **長音記号** (`prolonged-sound-marks`)\nハイフンと長音記号の間の文脈的な変換を処理します。\n- オプション: `skipAlreadyTransliteratedChars`、`allowProlongedHatsuon`、`allowProlongedSokuon`、`replaceProlongedMarksFollowingAlnums`\n- 例: `イ−ハト−ヴォ` (ハイフン付き) → `イーハトーヴォ` (長音記号)\n\n### 13. **部首** (`radicals`)\nCJK部首文字を対応する表意文字に変換します。\n- 例: `⾔⾨⾷` (康熙部首) → `言門食`\n\n### 14. **空白** (`spaces`)\n様々なUnicode空白文字を標準ASCII空白に正規化します。\n- 例: `A　B` (表意文字空白) → `A B`\n\n### 15. **ローマ数字** (`roman-numerals`)\nUnicodeのローマ数字文字を対応するASCII文字に変換します。\n- 例: `Ⅰ Ⅱ Ⅲ` → `I II III`、`ⅰ ⅱ ⅲ` → `i ii iii`\n\n## レシピシステムでのトランスリテレータの使用\n\nトランスリテレータを使用する推奨方法は、高レベルインターフェースを提供するレシピシステムを通じてです：\n\n```javascript\nconst recipe = new TransliterationRecipe({\n  kanjiOldNew: true,                     // kanji-old-newを使用\n  toFullwidth: true,                      // jisx0201-and-alikeを使用\n  replaceSpaces: true,                    // spacesを使用\n  hiraKata: \"hira-to-kata\",              // hira-kataを使用\n  replaceCombinedCharacters: true         // combinedを使用\n});\n\nconst transliterator = makeTransliterator(recipe);\n```\n\n高度な使用例では、低レベルAPIを使用してカスタムトランスリテレータチェーンを作成することもできます。\n\n## 標準とデータセット\n\nYosina仕様を構成するために以下の標準が採用されています：\n\n- JIS X 0201:1997\n- JIS X 0208:1997, JIS X 0208:2004\n- JIS X 0213\n- [Unicode 12.1](https://www.unicode.org/versions/Unicode12.1.0/)\n\n以下の公開データセットも使用されています：\n\n- [Adobe-Japan1-7](https://github.com/adobe-type-tools/Adobe-Japan1/)\n- [UniJIS-UTF32-H CMAP](https://github.com/adobe-type-tools/cmap-resources/)\n- [UniJIS2004-UTF32-H CMAP](https://github.com/adobe-type-tools/cmap-resources/)\n- [CVJKI漢字データベース](https://kanji-database.sourceforge.net/)\n\n\n## 例\n\n実装例と使用パターンは[`examples/`](examples/)ディレクトリにあります。\n\n## ライセンス\n\nMITライセンス。具体的なライセンスの詳細については、各言語実装を参照してください。\n\n## 貢献\n\n貢献を歓迎します！変更はすべての言語実装間で互換性を維持し、既存のコードスタイルに従うようにしてください。\n\n## 関連プロジェクト\n\n詳細な仕様と追加ドキュメントについては、[Yosina仕様](https://github.com/yosina-lib/yosina-spec)リポジトリを参照してください。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyosina-lib%2Fyosina","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyosina-lib%2Fyosina","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyosina-lib%2Fyosina/lists"}