Skip to content

Commit 9b71333

Browse files
committed
docs(readme): add algorithm
1 parent d3ddb4a commit 9b71333

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ textlint --rule no-nfd README.md
2929

3030
## Example
3131

32-
(`\u309a`)
32+
or `\u309a`
3333

3434
NG: ホ゜ケット
3535
: ホ\u309aケット
3636
OK: ポケット
3737

38-
(`\u3099`)
38+
or `\u3099`
3939

4040
NG: エンシ゛ン
4141
: エンシ\u3099ン
@@ -54,6 +54,32 @@ Install devDependencies and Run `npm test`:
5454

5555
## Further Reading
5656

57+
2種類の濁点
58+
59+
以下はそれぞれ単独で存在できるVOICED SOUND MARK
60+
61+
-`\u309b`
62+
- [Unicode Character 'KATAKANA-HIRAGANA VOICED SOUND MARK' (U+309B)](http://www.fileformat.info/info/unicode/char/309b/index.htm "Unicode Character 'KATAKANA-HIRAGANA VOICED SOUND MARK' (U+309B)")
63+
-`\u309c`
64+
- [Unicode Character 'KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK' (U+309C)](http://www.fileformat.info/info/unicode/char/309c/index.htm "Unicode Character 'KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK' (U+309C)")
65+
66+
もう一つは、Combining Characterと呼ばれる結合する前提のCharacter(単独では存在できない)がある。
67+
68+
- `\u3099`
69+
- e.g.) `ホ\u309aケット`
70+
- `\u309a`
71+
- e.g.) `エンシ\u3099ン`
72+
73+
74+
![combining-character.png](./docs/img/combining-character.png)
75+
76+
via [Unicodeの特殊な文字 “結合文字列” | ものかの](http://tama-san.com/combining_character_sequence/ "Unicodeの特殊な文字 “結合文字列” | ものかの")
77+
78+
これらのそれぞれをチェックし、normalizeする。
79+
80+
`String.prototype.normalize()`は、Combining Characterに対してのみ有効で、
81+
単独で存在できる゜`\u309b`と゛`\u309c`は置換することでnormalizeする。
82+
5783
- [String.prototype.normalize() - JavaScript | MDN](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
5884
- [walling/unorm: JavaScript Unicode 8.0 Normalization - NFC, NFD, NFKC, NFKD.](https://github.com/walling/unorm)
5985
- [UTF-8にもいろいろある - ザリガニが見ていた...。](http://d.hatena.ne.jp/zariganitosh/20131124/utf8_nfd_nfc_bom)
@@ -75,7 +101,7 @@ For bugs and feature requests, [please create an issue](https://github.com/azu/t
75101
## Author
76102

77103
- [github/azu](https://github.com/azu)
78-
- [twitter/azu_re]http://twitter.com/azu_re)
104+
- [twitter/azu_re](http://twitter.com/azu_re)
79105

80106
## License
81107

docs/img/combining-character.png

14.4 KB
Loading

0 commit comments

Comments
 (0)