MCPcopy Index your code
hub / github.com/DJTB/hatsuon

github.com/DJTB/hatsuon @v2.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.0 ↗ · + Follow
13 symbols 38 edges 7 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
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';

Related

WanaKana : Japanese romaji <-> kana transliteration library

Contributors

Thanks goes to these people (emoji key):

| [

Duncan Bay](https://github.com/DJTB)

💻 📖 🚇 🎨

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

License

MIT © Duncan Bay

Core symbols most depended-on inside this repo

getPitchPatternName
called by 21
src/utils.js
makeNakadaka
called by 13
src/utils.js
getMorae
called by 12
src/utils.js
isDigraph
called by 9
src/utils.js
getMoraCount
called by 7
src/utils.js
makeHeiban
called by 7
src/utils.js
makeAtamadaka
called by 7
src/utils.js
makeOdaka
called by 7
src/utils.js

Shape

Function 13

Languages

TypeScript100%

Modules by API surface

src/utils.js12 symbols
src/index.js1 symbols

For agents

$ claude mcp add hatsuon \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page