@kensio/pinyinjs 1.7.8 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -2
- package/data/core.entries +2259 -2259
- package/data/core.freq +0 -0
- package/data/full.counts +0 -0
- package/data/full.entries +2289 -2289
- package/data/full.freq +0 -0
- package/data/manifest.json +8 -8
- package/data/standard.entries +2257 -2257
- package/data/standard.freq +0 -0
- package/dist/cli/flag-lists.d.ts +2 -1
- package/dist/cli/flag-lists.d.ts.map +1 -1
- package/dist/cli/flag-lists.js.map +1 -1
- package/dist/cli/format-options.d.ts +5 -1
- package/dist/cli/format-options.d.ts.map +1 -1
- package/dist/cli/format-options.js +9 -2
- package/dist/cli/format-options.js.map +1 -1
- package/dist/cli/html-commands.d.ts.map +1 -1
- package/dist/cli/html-commands.js +15 -3
- package/dist/cli/html-commands.js.map +1 -1
- package/dist/cli/systems.d.ts +15 -43
- package/dist/cli/systems.d.ts.map +1 -1
- package/dist/cli/systems.js +9 -12
- package/dist/cli/systems.js.map +1 -1
- package/dist/decode/guo-rule.d.ts +64 -0
- package/dist/decode/guo-rule.d.ts.map +1 -0
- package/dist/decode/guo-rule.js +138 -0
- package/dist/decode/guo-rule.js.map +1 -0
- package/dist/decode/reading-rules.d.ts +1 -0
- package/dist/decode/reading-rules.d.ts.map +1 -1
- package/dist/decode/reading-rules.js +3 -0
- package/dist/decode/reading-rules.js.map +1 -1
- package/dist/dictionary/artifact.js +2 -2
- package/dist/dictionary/artifact.js.map +1 -1
- package/dist/dictionary/frequency-table.d.ts +103 -0
- package/dist/dictionary/frequency-table.d.ts.map +1 -1
- package/dist/dictionary/frequency-table.js +96 -8
- package/dist/dictionary/frequency-table.js.map +1 -1
- package/dist/dictionary/merge-types.d.ts +12 -0
- package/dist/dictionary/merge-types.d.ts.map +1 -1
- package/dist/dictionary/merge-types.js.map +1 -1
- package/dist/dictionary/merge-word.d.ts.map +1 -1
- package/dist/dictionary/merge-word.js +2 -2
- package/dist/dictionary/merge-word.js.map +1 -1
- package/dist/dictionary/merge.d.ts.map +1 -1
- package/dist/dictionary/merge.js +11 -1
- package/dist/dictionary/merge.js.map +1 -1
- package/dist/dictionary/name-mass.d.ts +42 -0
- package/dist/dictionary/name-mass.d.ts.map +1 -0
- package/dist/dictionary/name-mass.js +66 -0
- package/dist/dictionary/name-mass.js.map +1 -0
- package/dist/dictionary/proper-noun.d.ts +8 -1
- package/dist/dictionary/proper-noun.d.ts.map +1 -1
- package/dist/dictionary/proper-noun.js +13 -3
- package/dist/dictionary/proper-noun.js.map +1 -1
- package/dist/dictionary/script-pairings.d.ts +12 -0
- package/dist/dictionary/script-pairings.d.ts.map +1 -1
- package/dist/dictionary/script-pairings.js +20 -0
- package/dist/dictionary/script-pairings.js.map +1 -1
- package/dist/dictionary/traditional-carry.d.ts +23 -0
- package/dist/dictionary/traditional-carry.d.ts.map +1 -0
- package/dist/dictionary/traditional-carry.js +201 -0
- package/dist/dictionary/traditional-carry.js.map +1 -0
- package/dist/format/annotate.d.ts.map +1 -1
- package/dist/format/annotate.js +3 -3
- package/dist/format/annotate.js.map +1 -1
- package/dist/format/html.d.ts +41 -6
- package/dist/format/html.d.ts.map +1 -1
- package/dist/format/html.js +34 -83
- package/dist/format/html.js.map +1 -1
- package/dist/format/language-tag.d.ts +57 -0
- package/dist/format/language-tag.d.ts.map +1 -0
- package/dist/format/language-tag.js +76 -0
- package/dist/format/language-tag.js.map +1 -0
- package/dist/format/syllable-span.d.ts +10 -0
- package/dist/format/syllable-span.d.ts.map +1 -0
- package/dist/format/syllable-span.js +87 -0
- package/dist/format/syllable-span.js.map +1 -0
- package/dist/format/transcribed.d.ts +36 -0
- package/dist/format/transcribed.d.ts.map +1 -0
- package/dist/format/transcribed.js +38 -0
- package/dist/format/transcribed.js.map +1 -0
- package/dist/format/transcription.d.ts.map +1 -1
- package/dist/format/transcription.js +7 -19
- package/dist/format/transcription.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/transcription/systems.d.ts +82 -0
- package/dist/transcription/systems.d.ts.map +1 -0
- package/dist/transcription/systems.js +64 -0
- package/dist/transcription/systems.js.map +1 -0
- package/package.json +2 -2
- package/dist/cli/system-table.d.ts +0 -12
- package/dist/cli/system-table.d.ts.map +0 -1
- package/dist/cli/system-table.js +0 -48
- package/dist/cli/system-table.js.map +0 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ běijīng běijīng ㄅㄟˇ ㄐㄧㄥ pei³-ching¹ běijīng beeij
|
|
|
69
69
|
| ------------ | --------------------------------------------------- |
|
|
70
70
|
| `convert` | hanzi to pinyin |
|
|
71
71
|
| `html` | the same, as HTML |
|
|
72
|
-
| `annotate` | hanzi with its
|
|
72
|
+
| `annotate` | hanzi with its reading above, as ruby HTML |
|
|
73
73
|
| `segment` | split text into words |
|
|
74
74
|
| `match` | filter text by a pinyin query, best first |
|
|
75
75
|
| `check` | mark typed pinyin against the text |
|
|
@@ -398,6 +398,22 @@ ruby rt {
|
|
|
398
398
|
}
|
|
399
399
|
```
|
|
400
400
|
|
|
401
|
+
**The reading does not have to be pinyin.** `transcription` writes it in
|
|
402
|
+
bopomofo, Wade-Giles, Yale, Gwoyeu Romatzyh or the IPA, which is what a page
|
|
403
|
+
offering a reader 注音符號 over the characters needs:
|
|
404
|
+
|
|
405
|
+
```ts
|
|
406
|
+
import { convertToAnnotatedHtml, BOPOMOFO } from "@kensio/pinyinjs";
|
|
407
|
+
|
|
408
|
+
convertToAnnotatedHtml(dictionary, "银", { transcription: BOPOMOFO });
|
|
409
|
+
// <ruby lang="zh">银<rp>(</rp><rt><span class="py-syllable py-tone-2"
|
|
410
|
+
// lang="zh-Bopo-CN">ㄧㄣˊ</span></rt><rp>)</rp></ruby>
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
The tone class does not move, since the tone belongs to the syllable rather than
|
|
414
|
+
to the spelling, so one CSS rule colours a second tone in either. The `lang`
|
|
415
|
+
follows the system. More in [HTML output](docs/html/).
|
|
416
|
+
|
|
401
417
|
`toAnnotatedHtml(pieces, options)` renders pieces you already have, and
|
|
402
418
|
`ConvertedPiece.source` is what makes that possible, holding the characters each
|
|
403
419
|
piece reads, or undefined where it reads on into the ones before it.
|
|
@@ -483,7 +499,7 @@ import { candidates, homophonesOf, ReverseIndex } from "@kensio/pinyinjs";
|
|
|
483
499
|
|
|
484
500
|
const index = ReverseIndex.of(dictionary);
|
|
485
501
|
|
|
486
|
-
candidates(index, "shi", { limit: 5 }); // ["是", "时", "
|
|
502
|
+
candidates(index, "shi", { limit: 5 }); // ["是", "时", "時", "事", "使"]
|
|
487
503
|
candidates(index, "yinhang"); // ["銀行", "银行", "引吭", "引航", "印航"]
|
|
488
504
|
candidates(index, "yínháng"); // ["銀行", "银行"], narrowed by tone
|
|
489
505
|
homophonesOf(index, "长城"); // ["長城", "長程", "长程", "常程"]
|