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:

Enabling colored pitch accent (click here)
"auto-pitch-accent": {
  "enabled": true, // (1)!
  "colored-pitch-accent": {
    "enabled": true,
    // ...
  }
  // ...
}
  1. The auto-pitch-accent module must be enabled to use colored pitch accent.

Note

The 起伏 pattern is not automatically detected. To use this color, you must manually set the PAOverride field to -1.


Pitch Accent Groups

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


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 two places:

  • PAPositions
  • PAOverride

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


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.11.0.4)

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.11.0.4)

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.11.0.4)

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:

{
  "modules": {
    "auto-pitch-accent": {
      "pa-override": {
        // set to false (default: true)
        "heiban-marker-required": 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 Yomichan 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.11.0.4)

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:

{
  "modules": {
    "auto-pitch-accent": {
      "pa-positions": {
        // default: true
        "display-entire-dictionary": false
      }
    }
  }
}

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} marker. 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 Pitch Accent 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:

{
  "modules": {
    "auto-pitch-accent": {
      // set to false (default: true)
      "search-for-ajt-word": 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 hiragana, katakana, or katakana with long vowel marks in the runtime options:

{
  "modules": {
    "auto-pitch-accent": {
      // 0: whatever is shown in WordReading (usually hiragana, but can sometimes be katakana)
      // 1: force katakana
      // 2: force katakana with long vowel marks
      "reading-display-mode": 1,
    }
  }
}

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.

  • The generated style is exactly the generated style of the AJTWordPitch field. To display the style properly, copy and edit the HTML tags directly.

  • 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.

  • Example with all possible styles:

    チュ<span style="text-decoration:overline;" class="pitchoverline">ーカ<span class="nasal">°</span></span><span class="downstep"><span class="downstep-inner"></span></span><span class="nopron"></span>セイ<b>・チュ<span style="text-decoration:overline;" class="pitchoverline">ーカ<span class="nasal">°</span><span class="nopron"></span></span><span class="downstep"><span class="downstep-inner"></span></span>セイ</b>
    


Last update: March 8, 2023