JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q46433F
  • License MIT

Japanese pitch accent tools

Package Exports

  • hatsuon
  • hatsuon/dist/index.es.js
  • hatsuon/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hatsuon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

発音 hatsuon

Japanese pitch accent tools

npm npm Travis branch Codecov branch
Commitizen friendly Code of Conduct

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

npm install --save hatsuon

Demo

Visualization Example

Usage

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):

import {
  isDigraph,
  getMorae,
  getMoraCount,
  makePitchPattern,
  getPitchPatternName,
  getPitchNumFromPattern,
} from 'hatsuon';

WanaKana : Japanese romaji <-> kana transliteration library

Contributors

Thanks goes to these people (emoji key):


Duncan Bay

💻 📖 🚇 🎨

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT © Duncan Bay