So it changes the pitch after the word, too? When I input odaka words in the page you gave me
it seems to go back to L.
I tried putting in the sentence: 地面から花を摘み取った. It created a rollercoaster. I guess it’s possible for some of the words to be nakadaka but I made sure that 花 is odaka.
It’s weird, it seems like the Wanikani script is only working for me now during lessons and reviews only, I can’t look them up and see the pitch.
I tried searching for that! Would you mind linking it? Thanks!
In standard Japanese 橋 (はし bridge) and 端 (はし edge) are both low-high, but 橋 is odaka, so if you have 橋を then it’s low-high-low and if you have 端を it’s low-high-high.
And of course, 箸 (はし chopsticks) is high-low, so that’s not going to be confused for anything. And it also helps that people usually say お箸 anyway.
Same issue with pitch information not showing up on the vocab page here.
I’m taking a very brief look at it. I think the relevant bit is here (lines 217-222 on the GitHub version):
//Check for Vocab page element
var vocabIcon = document.getElementsByClassName('vocabulary-icon')[0];
if (vocabIcon != null) {
tmpVocab = $(vocabIcon.getElementsByTagName('span')[0]).html();
tmpSessionElem = document.getElementsByClassName('vocabulary-reading')[0];
}
I think what’s going on is the script expects to find an element with the vocabulary-icon class which has a <span> child element containing the vocab item, but the format of the page now has the vocabulary-icon class applied to directly to the <span> element. My JavaScript/DOM knowledge isn’t very good, but I think if you change that one line to something like tmpVocab = vocabIcon.html();, (i.e., get the content of the vocabulary-icon-classed element directly), it might start working again.
Thanks for the summary! I recently learned about the pitch differences of certain words (飴 vs 雨 for example), but the fact that it changes what comes afterwards is still a new concept for me.
The link that was given to me (http://www.gavo.t.u-tokyo.ac.jp/ojad/eng/phrasing/index) seems to ignore this though… sometimes. If I input what you said, 端を vs 橋を, I can hear the difference. But if I input the sentence [ 私は ( 橋 / 端 ) の上に立つ ], it gives me the same result when I change out 橋 and 端 - I certainly can’t hear any difference. Now funny enough the voice on Google Translate will give me a different pitch when I switch out those words in that sentence. I guess Google Translate is better at telling the pitch?
Ojad still seems to be the best place to look up what pitch it is for a specific word. Either that or Google Translate. One of them gives the proper graph, and the other does the correct voice pitch.
Too bad it only works on Wanikani during lessons or reviews, currently.
Oh I’m sorry then, I must not have paid enough attention! Maybe I expected the above curve to keep going and not drop again.
Anyway, thank you and Seanblue for your help. I think all of this will come naturally with time,
I just wanted to clear up some of the things that have been on my mind lately.
I’ve locally tested and verified the fix I mentioned above and submitted a pull request.
If anyone wants to make the same change in their local copy, the fixed line should actually be:
tmpVocab = vocabIcon.innerHTML;
Edit: Looks like the author has applied the change in the master version of the script, so you should be able to update from there. You may need to click the manual reinstall button.
I have Greasyfork setup to auto update from the git repo, so any pull requests that get merged will go out to people automatically So everyone feel free to submit pull requests whenever on the repo.
Just went to a vocab page recently, and saw that the script is working just like before again! Huzzah! Thank you @NLeseul! This will certainly save a lot of time.
Is pitch info intended to show up in reviews with this script? It’s not showing up in Lessons or Reviews. I tried replacing the script with the latest version on Github to no effect. It is showing up properly on the kanji/vocab’s page, contrary to the above post which (insofar as I can tell) had the reverse issue of me.
Might be easier to understand the daka pitch accents as “with a downstep” and heiban as “without a downstep”.
Atamadaka (head-high) downsteps on the first mora, nakadaka (middle-high) goes up on mora 2 then downsteps somewhere before the end of the word, and odaka (tail-high) goes up on mora 2 then downsteps onto the next word.
Heiban goes high on mora 2 but never really builds up to that downstep. That’s not to say there isn’t some pitch variation in there, just that it’s not as pronounced so by comparison with downsteppy words it’s “flat”.
The difference in pitch rise between a nakadaka word and its heiban homophone is subtle but it’s there. If you feed a sentence like 橋の端に箸がある (はし[2]のはし[0]にはし[1]がある, there’s chopsticks[1] at the end[0] of the bridge[2]) into OJAD’s prosody tutor the nakadaka accent is a bit higher.
I really like this script, but I have had one problem recently: The script expects the font used for the reading to be fixed pitch, whereas the WaniKani font-family list includes at least one proportional pitch font (TakaoPGothic). This causes the pitch circles not to line up with their corresponding kana.
The only way to really handle this properly (other than WaniKani changing their styling to only select fixed pitch fonts) would be to get the text metrics for each character in the font being used, and using that to draw the pitch info graph.
Something like the following function can be used to get the text metrics using the styling WK is using:
function textMetrics(text) {
let container = document.createElement('div');
container.style.visibility = 'hidden';
let children = [];
text.split("").forEach(chr => {
let charDiv = document.createElement('div');
charDiv.style.position = 'absolute';
charDiv.style.left = -1000;
charDiv.style.top = -1000;
charDiv.lang = 'ja';
charDiv.innerText = chr;
container.appendChild(charDiv);
children.push(charDiv);
});
document.body.appendChild(container);
let metrics = children.map(child => {
return {width: child.clientWidth, height: child.clientHeight}
})
document.body.removeChild(container)
return metrics
}
With the new audio launch, I had a problem that Viet suggests may originate with your script - as I go through my lessons, the readings become cumulative (I get a list of the reading(s) of each item I have looked at during the session).