https://github.com/djtb/hatsuon
Japanese pitch accent utils
https://github.com/djtb/hatsuon
accent haku japanese mora on pattern pitch pronunciation
Last synced: 9 months ago
JSON representation
Japanese pitch accent utils
- Host: GitHub
- URL: https://github.com/djtb/hatsuon
- Owner: DJTB
- License: mit
- Created: 2018-04-06T02:03:00.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T15:46:00.000Z (over 3 years ago)
- Last Synced: 2025-04-15T17:43:12.297Z (about 1 year ago)
- Topics: accent, haku, japanese, mora, on, pattern, pitch, pronunciation
- Language: JavaScript
- Homepage: https://djtb.github.io/hatsuon
- Size: 2.81 MB
- Stars: 31
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- Contributing: contributing.md
- License: license
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
# 発音 hatsuon
> Japanese pitch accent tools
[](https://www.npmjs.com/package/hatsuon)
[](https://npm-stat.com/charts.html?package=hatsuon&from=2016-04-01)
[](https://travis-ci.com/DJTB/hatsuon)
[](https://codecov.io/github/DJTB/hatsuon)
[](http://commitizen.github.io/cz-cli/)
[](./code_of_conduct.md)
## Why?
Japanese dictionaries often display the pitch accent of a word with a single number that determines where the pitch falls. This can be difficult to mentally visualize without counting through the [mora]() of the word. This library provides useful tools for generating pitch patterns which can then be easily displayed via SVG.
## Installation
```sh
npm install --save hatsuon
```
## Demo
[Visualization Example](https://djtb.github.io/hatsuon)
## Usage
```js
import { hatsuon } from 'hatsuon';
hatsuon({ reading: 'ちゅうがっこう', pitchNum: 3 });
// =>
{
reading: 'ちゅうがっこう',
pitchNum: 3,
morae: ['ちゅ', 'う', 'が', 'っ', 'こ', 'う'],
// low, high, high, low, low, low, low*
// *following particle (は、が, の etc) pitch
pattern: [0, 1, 1, 0, 0, 0, 0],
patternName: '中高', // nakadaka
}
```
Extra available utils (see source for documentation):
```js
import {
isDigraph,
getMorae,
getMoraCount,
makePitchPattern,
getPitchPatternName,
getPitchNumFromPattern,
} from 'hatsuon';
```
## Related
[WanaKana](https://github.com/WaniKani/WanaKana) : Japanese romaji <-> kana transliteration library
## Contributors
Thanks goes to these people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
| [
Duncan Bay](https://github.com/DJTB)
[💻](https://github.com/DJTB/hatsuon/commits?author=DJTB "Code") [📖](https://github.com/DJTB/hatsuon/commits?author=DJTB "Documentation") [🚇](#infra-DJTB "Infrastructure (Hosting, Build-Tools, etc)") [🎨](#design-DJTB "Design") |
| :---: |
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
## License
MIT © [Duncan Bay](https://github.com/DJTB)