[Userscript] WaniKani Pitch Info

Does anyone else have problems with the audio in lessons when this script is installed? The audio doesn’t play automatically anymore. It still works when I press the play button manually.
It works fine when I disable just the pitch info script.

I’m using Chrome on macOS btw.

The script freezes when I open the details panel on the review page. It works fine on the lessons page, though.
Using firefox 57 with tampermonkey. No errors in console, but cpu usage is high, so maybe an infinite loop?

2 Likes

I was about to write that. It took me a while to figure out what was causing the error during my reviews, but now I just disable this script before starting reviews. Hopefully it’ll get fixed.

枝 has no pitch listed, but according to Weblio it’s a 0.

Also getting this freeze. Using latest release of Firefox with Tampermonkey.

Is it possible to make input box input pitch number, that is, forcing you to remember the pitch number?

Strange, I haven’t been having that issue in Chrome. Firefox did change some internal stuff recently, it would appear the DOM event watcher is now being called each time we add the pitch info, and in turn calls the DOM watcher event again re-adding it. This change never triggered it before, but oh well, I think I’ve fixed it now. Pushed out in update 0.39.

You mean that you’d just type the number at the end of your answer? Possibly, but it would require a decent amount of work, but I’ll add it to the list of potential features to add.

I’m not sure how to handle this. The reading for “0” is only for “え” but we’re looking for "えだ”. Matching for this one would break the rules for matching with other ones. I guess I could just make the script fall-back to the first result on the weblio page if nothing matches properly to try and cover more cases. For now I’ll just manually add it. Maybe @nasatitan can regenerate the list with the updated vocab-get function.

2 Likes

image

Sometimes Weblio has the pitch underneath for when it differs by part of speech. That’s saying the noun version of 枝 has a pitch of 0.

Hopefully my explanation above clears this up, but please don’t do anything like this. It’s better to have entries with missing pitches than to have incorrect pitches by over-guessing.

Awesome, thank you very much :slight_smile:

Thanks for this great script.

Since yesterday I’ve noticed that the pitch info isn’t showing during reviews. Well, I think I saw it once but usually it isn’t there. It seemed to work reliably before. Did something change around that?

I’ve running v0.39 and don’t see any errors in the JavaScript console.

What browser are you on? And if Firefox, have you updated to the newest Firefox?

Oh sorry for missing that basic information. I’m using Chrome 63.0.3239.132 (Mac OS) with tapermonkey.

The script seems fine when doing lessons so it’s just reviews that are an issue for me. When my next set of reviews comes around I’ll try disabling other scripts just in case.

Small update: the behavior I see is that the pitch info is displayed correctly for the first review item, but doesn’t appear for items after that. If I restart the review session then the first item of the new session will work fine but not the ones after.

It shows again, if you open the info panel twice.

Thanks, that works :slight_smile:

Well, that was a pain but I think I fixed it. The fix I had implemented for Firefox had broke Chrome’s proper detection of changes -_-, I guess Firefox changed their mutation observer behavior in their new revamped Firefox “Quantum” version for whatever reason.

Audio should autoplay in lessons properly too, though for some reason on Chrome the first entry in your lessons won’t auto-play, yet it does on Firefox… So I’m really not sure how to fix that one right now.

1 Like

Are there still some items missing pitch info? Just asking because I came across 家事 in lessons, which has the pitch info number but not the helpful diagram, and I’m unsure whether it’s a bug or known missing information.

Was that during the Lessons? That sometimes happens right now on the first lesson item.

Yep, it was… oh yeah, the actual page for that word has the pitch info (should have checked, sorry!). No worries then :slight_smile:

I was able to grab another ~300 pitch accents from OJAD out of the ~600 missing if you’d like me to PR them on github. Not sure if you would want them flagged so the links can direct to OJAD instead of Weblio perhaps?

Includes all the jukugo + する words, and others that Weblio doesn’t have (アメリカ人, 旅行者) for example.
Fortunately OJAD was simple enough to parse and match by both word & reading.
IE: can correctly match with えだ

The remaining ones are too wonky to bother trying to automate with accuracy:
all the 〜suffix/prefix〜 WK entries
phrases お誕生日おめでとう, 結構です
partials 別の, お陰で
combos 四十二階, 缶コーヒー

I think they’d have to be manually figured out by examining component parts + listening to audio.
And of course some of them can’t be (suffix relies on what precedes it / word specific).
So… yeah I didn’t bother :smiley:

A random selection if anyone wants to spot-check, though I’m 98% confident they’re all good.
Final pitch is particle*

  { character: 'お酒', reading: 'おさけ', pitchPattern: [ 0, 1, 1, 1 ] },
  { character: '明治', reading: 'めいじ', pitchPattern: [ 1, 0, 0, 0 ] },
  { character: '富士山',
    reading: 'ふじさん',
    pitchPattern: [ 1, 0, 0, 0, 0 ] },
  { character: '冷蔵庫',
    reading: 'れいぞうこ',
    pitchPattern: [ 0, 1, 1, 0, 0, 0 ] },
  { character: '豆', reading: 'まめ', pitchPattern: [ 0, 1, 0 ] },
  { character: '皮肉', reading: 'ひにく', pitchPattern: [ 0, 1, 1, 1 ] },
  { character: '奈良', reading: 'なら', pitchPattern: [ 1, 0, 0 ] },
  { character: '依存', reading: 'いぞん', pitchPattern: [ 0, 1, 1, 1 ] },
  { character: '苦労', reading: 'くろう', pitchPattern: [ 1, 0, 0, 0 ] },
  { character: '香港',
    reading: 'ほんこん',
    pitchPattern: [ 1, 0, 0, 0, 0 ] },
  { character: '台湾',
    reading: 'たいわん',
    pitchPattern: [ 0, 1, 1, 0, 0 ] },

I also have them all as just pitchnum form: [2] which the script wants to use instead.

2 Likes