{"id":13601922,"url":"https://github.com/miao-lang/miao-lang","last_synced_at":"2025-04-11T04:31:58.859Z","repository":{"id":45103695,"uuid":"359440371","full_name":"miao-lang/miao-lang","owner":"miao-lang","description":"喵语翻译：将人类语言翻译为喵语言。","archived":false,"fork":false,"pushed_at":"2022-07-05T08:17:29.000Z","size":445,"stargazers_count":620,"open_issues_count":7,"forks_count":30,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-01T21:47:57.381Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://miao-lang.com","language":"TypeScript","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/miao-lang.png","metadata":{"files":{"readme":"README.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}},"created_at":"2021-04-19T11:49:24.000Z","updated_at":"2024-09-30T07:48:41.000Z","dependencies_parsed_at":"2022-09-08T05:04:34.372Z","dependency_job_id":null,"html_url":"https://github.com/miao-lang/miao-lang","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miao-lang%2Fmiao-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miao-lang%2Fmiao-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miao-lang%2Fmiao-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miao-lang%2Fmiao-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miao-lang","download_url":"https://codeload.github.com/miao-lang/miao-lang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223458722,"owners_count":17148507,"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","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":"2024-08-01T18:01:10.142Z","updated_at":"2025-04-11T04:31:58.847Z","avatar_url":"https://github.com/miao-lang.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# 喵语言（Miao-lang）\n\n这是一个可以将人类语言翻译为喵语言的程序。\n\n在线演示：[https://miao-lang.com](https://miao-lang.com)\n\n## 特性\n\n - 可以将任意文本转为由若干“喵”组成的喵语言，且这个过程是可逆的\n - 支持网页、微信等常见应用，将喵语言复制到这些应用并发送不会损失信息\n\n## 安装\n\n```bash\nnpm install miao-lang\n```\n\n## 使用方法\n\n```ts\nimport Miao from 'miao-lang'\n\nlet human_msg = 'Hello 喵星人！'\nlet miao_msg = Miao.encode(human_msg)\n\nconsole.log(miao_msg) // 喵​‍‍‌‌‌​‌‍‍‌‌​‍‍‌‍‍​‍‍‍‌​‍‌‍​‌‍‍‌‌​‌‍‌​‌‌‍‌​‍‍喵​‍‍‍‍‍​‍‌‌​‍​‍‍​‍‌‍‍​‌‍‌‌​‌‌‌‍​‍‍​‍‌‌‌‍​‍‍‌‌​‌喵‌‌​‌‌‍​‌‌‍​‌‌‍‌‌​‌‌‍‍‍喵。\n\nlet msg2 = Miao.decode(miao_msg)\n\nconsole.log(msg2) // Hello 喵星人！\nconsole.log(msg2 === human_msg) // true\n```\n\n### API\n\n - `Miao.encode(t: string, options?: Human2miaoOptions): string` 将普通文本转为喵语言\n - `Miao.decode(t: string): string` 将喵语言转为普通文本\n - `Miao.isMiao(t: string): string` 判断输入的文本是否为喵语言\n\n#### Types\n\n- `Human2miaoOptions`\n  - `calls`: `string` 动物叫声, 如: `汪`, `咕`, `嗷`\n  - `halfwidthSymbol`: `boolean` 是否使用半角符号，如`,.?!`\n\n### 多种族化\n\n示例:\n```ts\nimport Miao from 'miao-lang'\n\nlet human_msg = 'Hello 鸽子精！'\nlet gu_msg = Miao.encode(human_msg, { calls: '咕' })\n\nconsole.log(gu_msg) // 咕咕咕咕。\n```\n\n### 国际化\n\n示例:\n```ts\nimport Miao from 'miao-lang'\n\nlet human_msg = 'Hello Guys.'\nlet msg = Miao.encode(human_msg, { calls: 'Meow ', halfwidthSymbol: true})\n\nconsole.log(msg) // Meow ​‍‍‌‌‌​‌‍‍‌‌​‍‍‌‍‍​‍‍‍‌​‍‌‍​‌‍‍‌‌​‌‍‌​‌‌‍‌​‍‌Meow ‍‍‍​‌‍​‍‍‌‍‍​‍‍​‍‍‌​‌‌‍‌‌​‍‌​‌‌‌‌‍‌Meow .\n```\n\n\n## 工作原理\n\n喵语言本质上是一种文本编码、解码算法，其原理为使用零宽字符将原文编码，并隐藏于若干“喵”之中。目前版本中所用到的零宽字符有 `\\u200b`、`\\u200c`、`\\u200d` 。\n\n其中编码流程如下：\n\n 0. 生成 Base64 字符与零宽字符的对照表；\n 1. 将原文转为 Base64 编码；\n 2. 使用对照表将 Base64 编码后的内容转为由零宽字符组成的不可见的新编码；\n 3. 根据一定规则，在新编码的最前、最后以及中间位置，插入若干“喵”以及标点符号；\n 4. 完成。\n\n解码过程则是以上流程的逆运算。\n\n## 最后\n\n本项目纯属娱乐，祝大家玩得开心！\n愿喵之力与你同在！\n\n![](https://github.githubassets.com/images/mona-whisper.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiao-lang%2Fmiao-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiao-lang%2Fmiao-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiao-lang%2Fmiao-lang/lists"}