Skip to content

Pitch Accent

This page is dedicated to showcasing how pitch accent is displayed, and various ways to edit said display.

What Is Pitch Accent?

Here is a (slightly modified) excerpt taken from the AJT Japanese Github page that explains the notation well:

Quote

For more information on the Japanese pitch accent, I would like to refer you to this wikipedia article. In short, the following notations can be found:

  • Overline: Indicates "High" pitch (see "Binary pitch" in Wikipedia article).
  • Overline downstep: usually means stressing the mora/syllable before.
  • Red circle mark: Nasal pronunciation.

    For example, げ would be a nasal け, and would represented as け°.

  • Blue color: Devoiced mora (barely pronounced at all).

    For example, would be closer to h than hi.
    Likewise, would be more like a k than ku.


Specifying Pitch Accent

The displayed pitch accent is usually the first position found in PAPositions. However, you can override this automatically chosen position using the PAOverride field.

The demo above covers the most basic usage of PAOverride, which should suffice for most people.

The rest of the page covers the details on exactly how PAOverride works, and all the ways to customize how the pitch accent is displayed.


Colored Pitch Accent

The reading, word and pitch overline can be automatically colored in Migaku style colors, according to the pitch accent.

This automatic coloring behavior is disabled by default, and must be enabled in the runtime options:

"autoPitchAccent.coloredPitchAccent.enabled": true, // (1)!
  1. The autoPitchAccent module must be enabled to use colored pitch accent. For example:
    "autoPitchAccent.enabled": true,
    
    This is enabled by default, so you likely don't need to manually enable this module.

Pitch Accent Groups

Anki Tag 日本語 Example Reading
heiban 平板 自然 しぜん ̄
atamadaka 頭高 人生 じ\んせい
nakadaka 中高 弱点 じゃくて\ん
odaka 尾高 道具 どうぐ\
kifuku 起伏 驚く おどろ\く

Controlling What Gets Colored

New in version 0.12.0.0 (latest version: 0.12.0.0-prerelease-18)

There are many runtime options that change exactly what is colored. By default, everything except words found in tooltips (kanji hover and word indicators) are highlighted.

"autoPitchAccent.coloredPitchAccent.color.wordReadingPitchOverline": true,
"autoPitchAccent.coloredPitchAccent.color.wordReadingKanji": true,
"autoPitchAccent.coloredPitchAccent.color.testedContent": true,
"autoPitchAccent.coloredPitchAccent.color.fullSentence": true,
"autoPitchAccent.coloredPitchAccent.color.definitions": true,

"tooltips.overrideOptions.autoPitchAccent": {
  // highlights bolded kanji
  "autoPitchAccent.coloredPitchAccent.color.wordReadingKanji": false,
  // highlights bolded sentence below word
  "autoPitchAccent.coloredPitchAccent.color.fullSentence": false, // (1)!
},
  1. If you want enable word coloring within the sentence, the word within the sentence must be able to be highlighted in the first place. To enable this, use the following runtime option:
    "tooltips.highlightWordInSentence": true,
    

When Pitch Is Not Automatically Colored

Pitch accent coloring requires a numeric position value somewhere within the card. This is usually found in one of these places:

  • PAPositions
  • PAOverride
  • AJTWordPitch (the numeric position is automatically calculated through the HTML)

Usually, PAPositions is automatically filled.

In the cases where pitch accent coloring does not work as expected, your two main options are:

  1. Using PAOverride with a number (recommended).
  2. Force the pitch accent group with tags (see below).

Kifuku Coloring

New in version 0.12.0.0 (latest version: 0.12.0.0-prerelease-18) A word is automatically colored as 起伏 if the WordTags field contains a verb tag, and its pitch accent group is not 平板.

This WordTags field can only be filled out if you have a modern version of the JMdict or Jitendex dictionary in Yomitan. For old cards that do not have this field filled, you will have to manually mark the word with -1 (in PAOverride).

Override Pitch Accent Group

In some extremely rare cases, you must set manually set the pitch accent group, if the available options do not work. To do this, add the appropriate tag to the card.

The exact tags that can be used are shown in the summary table above, under the Anki Tag and 日本語 sections. For example, the tag can be heiban, 平板, etc.

Note

The tag only overrides the pitch accent color, and does not affect the pitch accent representation itself.

This fact can be useful for certain exceptions, such as how 通る is [1] instead of [2]. If you want to use the 起伏 pattern on 通る, you will have to set the PAOverride value to 1, and then add the 起伏 tag.

TODO image of above (without tag, with tag)


How Pitch Accent is Selected

Pitch accent is selected based on the following priority:

  1. PAOverrideText
  2. PAOverride
  3. PAPositions
  4. AJTWordPitch

The first field that is non-empty will be the field that is used to display the pitch accent.

Note

When the auto-pitch-accent module is disabled, the priority changes to the following:

  1. PAOverrideText
  2. PAOverride
  3. AJTWordPitch

Of course, as the module is disabled, PAOverride will not be parsed in any way. More info on this can be found in the PAOverride field section below.


(1) PAOverrideText

New in version 0.11.0.0 (latest version: 0.12.0.0-prerelease-18)

If the PAOverrideText field is filled, then this field is displayed exactly as is, without any changes or parsing. This provides the most flexibility, but the least ease of usage.

hello world as PA

PAOverrideText with: "Hello world!"

(2) PAOverride

The PAOverride allows for two primary formats: positions and text format. If the field contents cannot be parsed in either of these formats, then the field is displayed without any special formatting. This will act just like PAOverrideText.

(2.1) PAOverride: Positions Format

When the PAOverride field contains any number, that number will be considered as the downstep position, and be rendered as such. The number -1 represents the 起伏 pattern, and can be used to set the downstep to be after the second last mora.

Examples (on the 偽者 card):

PAOverride Result Notes
0 セモノ
1 セモノ
-1 セモ 起伏

Multiple Numbers

New in version 0.11.0.0 (latest version: 0.12.0.0-prerelease-18)

Multiple numbers can be used, as long as they are separated by commas. This is useful on certain words with devoiced mora, where the pitch accent can be multiple positions with little real distinction.

Additionally, individual numbers can be bolded to grey out the other positions. This is useful to highlight the correct pitch accent among all possiblities.

Examples (on the 偽者 card):

PAOverride Result Notes
0,2,4 セモノ・ニモノ・ニセモノ
0 ,2, 4 セモノ・ニモノ・ニセモノ The parser ignores all whitespace.
<b>0</b>,2,4 セモノモノセモノ

Restrictions on bolded numbers

Multiple numbers cannot be bolded together. If you want to bold multiple numbers, they have to be bolded individually. Additionally, commas cannot be bolded.

For example, 0,<b>1</b>,<b>2</b>,3 is valid, but 0,<b>1,2</b>,3 and 0,<b>1,</b>2,3 are invalid.

(2.2) PAOverride: Text Format

New in version 0.11.0.0 (latest version: 0.12.0.0-prerelease-18)

How To Type Special Characters (click here)

This section requires you to type certain special characters. You can type these characters on any standard IME.

Characters Result
\
うえ (ue)
,
/

If no number is found within the PAOverride field, the contents will be parsed using this format.

To define any pitch accent in text format, use 「\」 to specify downstep. For example, 人生 should be written as 「じ\んせい」.

For words with no downstep (平板型), the 「 ̄」 character must be placed at the end of the word. For example, 身長 should be written as 「しんちょう ̄」.

Removing the required  ̄ symbol (click here)

The restriction that 平板 words require the  ̄ symbol at the end can be removed using the following runtime option:

"autoPitchAccent.paOverride.heibanMarkerRequired": false,

This would allow any words without any downstep marker to be rendered as 平板. Using the above example, one can instead type 身長 as 「しんちょう」.

Examples:

PAOverride Result
じ\んせい ンセイ
いきお\い キオ
どうぐ\ ウグ
しんちょう ̄ ンチョウ

Multiple Words

Multiple words can be defined, as long as they are separated with either the 「・」 or 「、」 characters.

This is particularly useful on expressions with multiple words, such as 「毒を食らわば皿まで」.

Examples:

PAOverride Result
どく\、くらう ̄、さら ̄ 、クラウ、サ
ち\か・ちか\ カ・チ

Note

This renderer will not accept any field with formatting. This means that bold, italics, overlines, etc. cannot be present in the field. For example, the input <b>にせもの</b> will be rejected.

(2.3) PAOverride: Raw Text

As a last case resort, if the input of this field cannot be parsed as either of the two, the exact contents of PAOverride will be displayed. This will behave exactly the same as PAOverrideText.


(3) PAPositions

This field is automatically filled out as long as Yomitan has pitch accent dictionaries, and the tested word is covered in said dictionary.

By default, the first pitch of the first dictionary is shown.

Show All Possibilities in Dictionary

New in version 0.11.0.0 (latest version: 0.12.0.0-prerelease-18)

TODO: update pictures with correct config + add new config value for all dictionaries

Sometimes, pitch accent dictionaries show multiple pitch accents for a word. However, only the first pitch accent is shown by default.

If you want to show all of the pitch accent entries (in the first dictionary), use the following runtime option:

"autoPitchAccent.paPositions.displayMode": "selected-dictionary",

If you want to select the correct pitch accent, bold that position in PAPositions (or simply use PAOverride as described above)

Note

This option only works on cards formatted with JPMN's {jpmn-pitch-accent-positions} helper. This means this option will not work on old cards that were imported to the JPMN format.


(4) AJTWordPitch

If you have the optional AJT Japanese add-on installed and correctly configured, then this field is automatically generated on all cards.

This is used as a fallback option, in case your installed pitch accent dictionaries does not cover the tested content, but this add-on does.


How the Reading is Selected

The reading consists of the actual kana that is shown on the card. By default, the word reading is selected based on the following priority:

  1. AJTWordPitch
  2. WordReading

Reading: AJTWordPitch

Usually, the reading is selected from AJTWordPitch. This has a few features over the raw word reading:

  • AJTWordPitch usually includes devoiced and nasal info, whereas WordReading does not.
  • Readings are katakana, and cannot be changed to hiragana.

Note

If you do not want the reading in AJTWordPitch to be used, change the following runtime option to false:

"autoPitchAccent.searchForAJTWord": false,

Reading: WordReading

If the word cannot be found under AJTWordPitch, then the default reading in WordReading is used, and displayed in katakana.

Unlike AJTWordPitch, this reading can be changed to the word reading kana (usually hiragana), katakana, or katakana with long vowel marks in the runtime options:

// The reading display to show if nothing is generated by AJT Japanese.
// Valid options:
// "word-reading"
// "katakana"
// "katakana-with-long-vowel-marks"
"autoPitchAccent.readingDisplayMode": "katakana",

Pitch Accent Styling Details

This covers some details if you are directly using PAOverrideText, and want to have a similar format to the generated pitch accent. You very likely won't be doing this.

Styling Details (click here)
  • The generated style is very similar to the generated style of the AJTWordPitch field. To display the style properly, you can simply copy and edit the HTML tags directly. If you want to see the true generated output, use the AnkiWebView Inspector and inspect the element.

  • If you want to grey out other words, you will have to use the bold <b> tag. However, you must wrap the greyed out words with the <b> tag.

    This is the opposite of what would expect from everything in this page, but the behavior is this way due to restrictions in the current CSS specification.

  • Note that AJT Japanese also outputs the following span classes, however these are simply ignored by JPMN. You can include them if you want, but they will have no effect on the styling:

    • <span class="low"></span>
    • <span class="low_rise"></span>
  • Example with all possible styles:

     チュ<span class="high_drop">ーカ<span class="nasal">°</span></span><span class="devoiced"></span>セイ<b>・ニ<span class="high">セモノ</span></b>
    

Last update: May 13, 2024