[Userscript] WaniKani Pitch Info

:warning: This is a third-party script/app and is not created by the WaniKani team. By using this, you understand that it can stop working at any time or be discontinued indefinitely.

As a result of the discussions in this thread, I made a userscript that displays the pitch type for a given vocabulary reading. The data has been automatically generated from results on http://www.weblio.jp and will auto-lookup any new ones WaniKani may add in the future.

Script:

Requirements:

A userscript app for you given browser, tested working with:

Tampermonkey (Most Browsers, Preferred)

a20c7a57763c9a189a09e9cac19e7481

TODO List:

-Check if pitch info is different for secondary readings and display it
-Handle checking for contextual pitch info
-Look into Greasemonkey compatibility issues

—(Maybe) Implement some more colorful/visual modifications of the readings themselves instead of just a description. Done! Big thanks to nasatitan for programming this visual representation of pitch.

-(Maybe) Give occasional knowledge about general pitch rules.
-(Maybe) Option to require writing the correct tone number in your answer.

Github

108 Likes

[quote=“seanblue, post:54, topic:18721”]
@Invertex It might make sense to create a dedicated forum topic for your script for feedback and updates. My only suggestion at the moment would be to also include the raw number from Weblio, in addition to your description of the number’s meaning.[/quote]
Done :smiley:
And will do for the next update.

I had some conflicting information on this, but looking into it further I seems mora is the most used term so I’ll switch to that, thanks.

No I’ve not, but I will for sure!

Pushed out new update, 0.17, it should fix that issue, but with it new bugs may be introduced due to unknown edge-cases with how weblio formats their results. I already caught a couple, hopefully shouldn’t be any other but keep an eye out!

Also now displays the pitch value and uses mora instead of moji.

1 Like

This is the best thing ever, thank you so much! I was already wondering what would be the best way to incorporate pitch accents into my learning since I wanted to get this information into my head as soon as possible.

I may be wrong (since I’m a beginner and have no experience with pitch accents) but I just installed 0.17 and I think the bug that was mentioned before still exists (or a similar one).
For example:
「父(ちゃん)」の意味や使い方 わかりやすく解説 Weblio辞書
ちち
Pitch starts low, stays high for 2 mora, ends low. [2]

2 Likes

edit: Nvm, it seems correct.

ちち [2] [1] 【父】

親のうちの,男の方。実父・継父・養父の総称。 ↔ 母 「二児の-となる」

新しい物事の開拓者。先駆者。また,偉大な貢献をした人。 「近代経済学の-」 「独立の-」

キリスト教で,神の呼称。三位一体内の子キリストに対して父。

Should I be using the second number out of those two numbers or something? Or should I be displaying both in some way?

I believe you should be showing both. This means that they are both valid pitches.

1 Like

I don’t see the pitch info.

That’s weird @netpapa , the script is working correctly for me here.

1 Like

@Invertex
Spotted this item that came up with having no pitch accent found, likely because there are two possible readings, I’m guessing. The handy link you included in the number gives the information on the Weblio page however.

Nice job on the script so far :smiley:

1 Like

Alright, implemented it in the latest version, 0.18! Thanks.

Also, does anyone know of any words that might have more than 2 acceptable pitches? I hard coded it for two since it was simpler but if there is the possibility of a word having more than two I’ll make it dynamic.

Hmm, well I guess I should add that my script is programmed in TamperMonkey. So it could be my script has issues with Greasemonkey? Could you give TamperMonkey a try and see if it works? It supports most browsers.

Thanks, I’ll have a look into it!

I don’t offhand, but I did find another case with two pitches that is interesting. It’s a more complicated case, where the pitch accent depends on the part of speech.

When used as a noun or na-adjective, it seems that 多分 has a pitch accent of [0]. But when used as an adverb, it has a pitch accent of [1].

1 Like

Alright, fixed that! Indeed, it was because of the two readings so it was breaking the string matching.

Hrmm interesting, yeah I had seen a few pages like that but didn’t know enough to interpret them. I guess I’l have to add that to a TODO list, as that will be a bit more of an undertaking to create handling for.

1 Like

I haven’t tried the script so far, but it looks like a welcome addition!

What I would change is the way information is displayed. In a related (now defunct?) thread I made the following proposal:

If what you have is a number, then one way to do this would be to split the word into kana, and apply the relevant style to the appropriate character. The one thing that might be tricky is that compound kana should be treated as one.

It might be helpful to know that so-called “defficient” mora (long vowels, ん, and the small っ) cannot bear the accent (but are still counted).

1 Like

Yeah, and I just found an even better one. Two parts of speech, one has two valid pitches and the other has one.

1 Like

Why does this strike you as wrong? Is it because it adds up to 3 mora? This includes any attached particles.

EDIT: oh you mean the description. Yeah… A 2 mora character can’t start low, stay high for 2 and the go low. It would start low, go high, then go low for the attached particle

Thanks for this!

So I was curious to look up the pitch accent on 当たり and 辺り. 当たり starts low, ends high, and 辺り starts high ends low. But the audio on WK totally doesn’t match (at least to me). 辺り sounds like it starts low, goes high, then goes in the middle (is that even a thing?) and 当たり sounds like it goes from high to low. Is this just my imagination? I am pretty confused now. :confused:

1 Like

I was thinking that the right part of the picture would be the best way to display this. It’s not obvious how it should work for words that have more than one valid pitch though.

So just to make sure I understand, a word like がっこう has four mora, but such a word could not downstep on the っ or う? However, digraphs count as a single mora, so かいしゃ has three mora, right?

Thanks :blush:

1 Like

That was the first one I had looked up as well and was confused, so instead I went and listened to other vocab and most others seemed to match the pitch info. I think the case might just be whoever did the recordings has some pitch influence from their own region of Japan?

Cool :slight_smile:

The idea I’m suggesting has a similar feel actually to this extension. This extension points out not only when a Kanji has a certain (on’yomi) pronounciation, but also points out when its a Rule or an exception for that radical, so you can learn the rules from it. WaniKani Phonetic-Semantic Composition for Greasemonkey

Of course that extension is teaching on’yomi, whereas yours is teaching pitch accent so its different, but the way-of-teaching could be similar.

Thanks, it works in TamperMonkey.

1 Like