[Userscript] WaniKani Pitch Info

I was thinking that there should be a table of pitch rules somewhere to keep track of rules that have been implemented and not, for example the discussion above about 小学校. Something alone the lines of:

Completed / Rule description / Example Word / Reference / Double Check OJAD
No / Compound words with 中高 / asdf / Dogen Phonetics, Ep. 9 / Checked

Just so that there’s a record of what’s been done, but also to vet information.

Edit: this could also double as being the “occasional knowledge” you wanted to display. Perhaps when a rule is triggered by a word, the rule description from the table will show.

Edit #2: Replaced example word with “asdf” since I don’t know what I’m talking about.

I don’t get it. Why would the script care about rules? Aren’t you just getting the pitch number from Weblio and/or OJAD and hardcoding those values in the script?

Disclaimer: I’m a newcomer to pitch accent so I could be wrong about everything :smiley:

You can use the pitch number to find the pattern in the dictionary chart. But the chart is more of a starting point. After you know the pattern, you apply the rules for various cases. Cases mentioned so far in this thread are the accent falling on ん, small つ, extended vowels. Also I believe the chart for 中高 patterns can’t tell you how long the pitch stays high… I think. Hitting the limit of my knowledge…

I really wish I had a translated version of the chart notes, they probably explain everything.

Actually, are there even any compound words in WaniKani? I said 小学校 was one, but I feel like I’m wrong about that. Doing a little research on compounds in Japanese is just making more confused.

For the record, the description I mentioned has already been removed. It’s not the pitch name (平板, etc.) you see now, which is a lot more useful and is actually accurate, unlike the old text. Also, seeing the new version now, keeping the number makes sense too. You make a good point that people learn differently, and for some the number may be more useful than the diagram.

I know this wasn’t directed at me, but I thought you should know that private messaging is disabled. :disappointed:

I quickly tried to make it transparent, and the line went into the now-transparent circle, which made it look weird.

image

But setting it to the background color (#eee) looked fine.

image

This is the point I was making in my last post as well. I think trying to gather rules into some chart is likely to cause more harm than good, and will probably introduce more errors. Just providing the diagram, the name of the pattern, and the number seems perfect to me.

1 Like

@nasatitan Found a bug. When the pitch number is 1, the script is showing 尾高, whereas it should be showing 頭高. For example, .

I understand the argument for keeping it simple, but I don’t think it’s complete in its current state. Like in the case of 小学校, it was completely wrong by just following the chart (that we extended). By checking against digraphs it is now somewhat correct, but it’s still off compared to OJAD and https://www.wadoku.de

I’m not saying it has to be 100% correct all the time, because that’s unrealistic. But if there’s a programmable rule that can be applied across the board, I think that’s better than spreading misinformation. So I don’t know… it’s hard to define what’s out of scope when you know the average user is going to take the graph for the truth (or fail/forget to double check on their own). But if there’s no easy programmable rule then… yea I agree, it’s good as is.

edit: I will say tho its already super useful to me in its current state and like super happy to have this

1 Like

So long as the code for interpreting the pitch numbers is correct, then the graph will be correct. Your diagram for 小学校 is wrong because you have a bug related to digraphs. The only programmable rule you need is to interpret the pitch number and count digraphs as a single mora. Anything else will be flawed and have many errors.

EDIT: The think the correct diagram for 小学校 is:

image

I’m actually not a contributor on this script. I’m just giving advice where I can. :slight_smile:

I am willing to make (small) contributions if they want to invite me as a collaborator on the project.

Ah so train of thought: we should have never extended the graph because the bug is that small よ is getting counted toward the “kanaLength” (because the script is not using mora at all), so that bumps しょうがっこう to 6 kana, not 7. That’s why it’s getting only one high pitch instead of two omg BRB gotta update script

Okay, thanks. To help your terminology, I believe しょうがっこう is 7 kana and 6 mora.


Just as a reminder, you need to remove the small っ and ッ from the digraph arrays.

When they are included, 河童 (かっぱ) shows up incorrectly as
image

When I remove them, it shows up correctly as
image

For comparison:
image

Yup I meant in reality its 7 kana, but treated like 6 kana on the chart because the digraph is not counted on the chart.

Thanks for talking all this out, 小学校 is now correct. Digraphs now don’t count when looking up in the chart. Actually after I did that it still wasn’t working and I was like nooo this should work, then I came back here and saw this bug and that was the final puzzle piece. Take that 小学校 :face_with_symbols_over_mouth: ! Thanks for your help @seanblue!

yaaay

Glad I could help. :smile:

Uh, I got a new one. It shows up fine on the actual vocab page, but shows up wrong during reviews.

During review (after other reviews):

On item page:
image

If you are going to keep your global variables, I believe you need to do digraphCount = 0 in the getKanaInfo method, just like you are for kanaLength. This seems to fix the bug.

However, this illustrates the problem with global state. Rather than keeping global state, you might want to consider changing the getKanaInfo method to return an object with all the data you need, and then passing that object to other methods that need the data.

Also, here’s one where there is a duplicate diagram. I saw this before, but forgot to mention it. Seems to be another review issue since it shows up fine on the item page.

野郎
image


And a general problem, during reviews and on the item page. It shouldn’t be able to go back up after going down.

給料
image

Awesome thanks. You can ask Invertex to add you as a contributor. I got the きゅうりょう and きゅうよ patterns fixed. I think it reads pretty funky, bending the line and removing the dot on ゆ would make it way more clear how to pronounce these:

kyu

Edit: What’s happening is its just skipping over the digraph and extending the line. Not a bug so much as just a result of fitting the line to the word. Lerping the line from き to う would be an easy solution. Or just a straight line. Anyway I’m peacing out for now. :wave:t3:

1 Like

This seems to be how OJAD does it, so it’s probably fine.

image


Also, while looking through the code, I think the 7 kana array is wrong. Shouldn’t it be this?
/* 7 kana */[ [0,1,1,1,1,1,1,1], [1,0,0,0,0,0,0,0], [0,1,0,0,0,0,0,0], [0,1,1,0,0,0,0,0], [0,1,1,1,0,0,0,0], [0,1,1,1,1,0,0,0], [0,1,1,1,1,1,0,0], [0,1,1,1,1,1,1,0] ]

That doesn’t seem like an error. You can just ignore the particle dot if it’s not relevant to a particular word. Seems more error prone to conditionally remove it.

What about in the case of verb clauses and の? As in: 起きるのは