Homophone explorer

Homophone Explorer



Homophone explorer (HPX, name suggestions welcome :P) extends Wanikani by adding a Homophones section on all your vocabulary pages and review and lesson sessions. I don’t know about you but when I was doing reviews or lessons, I would hear a word pronounced and think to myself, ‘I swear this meant something else.’ So here’s a little something to help with that. Of course, you could just search a dictionary or wanikani with the reading, but this is just a faster way to view homophones when you are already on the vocab page or blitzing through your queue in my opinion. If you have SRS progress on an item, HPX will show that too.

Functionality

HPX downloads the every vocabulary item into your cache (userscript manager storage) and compares each of these with the readings (yes it works with words with multiple readings). Since it downloads the entire list to your cache, it is much faster than searching wanikani or looking it up elsewhere. The cache updates every 60 minutes by default. 

Note: HPX may conflict with some reorder scripts (depending on implementation), although I have not run into any. If you run into any problems please let me know.

Download

This userscript requires your favourite userscript manager. I use Tampermonkey for chrome. You can download HPX from Github or greasyfork

GitHub: https://gist.github.com/Konatopic/8b1a6f6dbf9ea66ee4f50c2d35908518
Greasyfork: https://greasyfork.org/en/scripts/20150-homophone-explorer

Disclaimer:
I apologise in advance to any Javascript developers out there for butchering their language. :stuck_out_tongue:

Change log

v0.9.1
  • Changed URL for account settings page to correctly look for API
  • Removed localStorage as a method of searching for API as it is unreliable
14 Likes

Very helpful!
I don’t seem to have any issues with the reorder script (so far)
Love it, thank you!

I’ll save this one for later, I’m sure it will come handy.

THE HELL WITH THESE DOUBLE POSTINGS DAMMIT

Tagging, somehow, this for later. :slight_smile:

I installed this awhile ago but I never have been able to make it work. I disabled other scripts but still no dice. (I’m on the latest version of Firefox.)

I love the idea of it, though! I’d also love a synonym explorer. Moreso than the homonyms, the words with the same meanings confuse me for some reason, unless I learn them on the same level.


I can’t wait to try this out, but you know what would also be insanely helpful? A freaking synonym explorer. I swear if one more vocab means “hypothesis” I’m gonna kick a dog.

5 Likes
South said... I can't wait to try this out, but you know what would also be insanely helpful? A freaking synonym explorer. I swear if one more vocab means "hypothesis" I'm gonna kick a dog.
 Better kick a cat, they can at least land on all four feet right after.

Also just gotta mark this thread before going to bed and install the script.
I really like the idea, it'll be great to have.

Quick edit before I do: It doesn't seem to work for me either (win7x64 firefox).
RayderBlitz said...
South said... I can't wait to try this out, but you know what would also be insanely helpful? A freaking synonym explorer. I swear if one more vocab means "hypothesis" I'm gonna kick a dog.
 Better kick a cat
 Don't. They can be helpful sometimes.

Overall reaction: F*CKING GENIUS. Surprised it didn't have any major traction when it came out ;p
If it don't work, I'll make it work.

EDIT: yea well, like most scripts developed on Chrome, it doesn't seem to work on Firefox, and I have no idea why.

Not sure, if this script is supported anymore but I keep getting an error that keeps trying to reload every 3 seconds which is due to an 401 (Unauthorized) Get command

I have two screenshots that may be of help.

1st screenshot – Error on vocabulary page.

2nd screenshot – Detailed error from console when running page (chrome) — some sites have no authorization errors, while others do…
56%20AM

Any help is appreciated!

1 Like

Hi thanks for the report. I’ll take it a look at it when I get some time.

1 Like

@Partholingo It seems the error is caused by an incorrect cached API key. I have also made a change in the script to look for the API in the correct places.

Could you please reinstall the script from GreasyFork. Then on any vocab page, click on the Reload API Key button then the Update cache now button. That should fix the issue. If it doesn’t, please let me know.

Thanks again for reporting the bug.

1 Like

Thanks for looking into it. I think it is fine now. That particular example that I gave doesn’t seem to have homophones, that may be why it was throwing an error. I did what you mentioned [reload API, update cache]. Now it has a running counter of time since last update and then below says No homophones found.

I looked up one that I know that has a homophone such as 人口 「人工」, and it looks ok to me. It still has the running counter of last updated time, but I think that’s by design.

Thanks for the quick update!

Not working for me with TamperMonkey on Firefox (57.0.4 (64-bit)) on Arch Linux.

The first vocab I open says:
“Updating cache with Wanikani servers. Please stay on the page…”
but then nothing happens for minutes.
I also have this in the console log:
“TypeError: vocabList[vocabIndex] is null eval line 3 > Function:307:13”

When I close or reload the page the section is just empty and I have in the console:

HPX initializing; Using jQuery version: 1.12.4. Caution: minified library may be incomplete userscript.html:63
Loading data from cache userscript.html:358
INIT userscript.html:702
Comparison vocab detected as 人口 userscript.html:744
Creating homophones list using comparator: 人口 userscript.html:285
Found 1 comparison readings found for 人口: “じんこう” userscript.html:275
ERROR: Execution of script ‘Homophone Explorer’ failed! vocabList[vocabIndex] is null userscript.html:4
createHomophoneList@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:307:13
HPX/<@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:97:13
dispatch@https://cdn.wanikani.com/assets/default-v2/application-61c1b3e6f7e09bf9553fb481ff6bad02c39e22bfdc47a5358326c609e20af76f.js:2:21544
add/g.handle@https://cdn.wanikani.com/assets/default-v2/application-61c1b3e6f7e09bf9553fb481ff6bad02c39e22bfdc47a5358326c609e20af76f.js:2:18274
trigger@https://cdn.wanikani.com/assets/default-v2/application-61c1b3e6f7e09bf9553fb481ff6bad02c39e22bfdc47a5358326c609e20af76f.js:2:20712
trigger/<@https://cdn.wanikani.com/assets/default-v2/application-61c1b3e6f7e09bf9553fb481ff6bad02c39e22bfdc47a5358326c609e20af76f.js:2:28173
each@https://cdn.wanikani.com/assets/default-v2/application-61c1b3e6f7e09bf9553fb481ff6bad02c39e22bfdc47a5358326c609e20af76f.js:1:17254
each@https://cdn.wanikani.com/assets/default-v2/application-61c1b3e6f7e09bf9553fb481ff6bad02c39e22bfdc47a5358326c609e20af76f.js:1:15183
trigger@https://cdn.wanikani.com/assets/default-v2/application-61c1b3e6f7e09bf9553fb481ff6bad02c39e22bfdc47a5358326c609e20af76f.js:2:28152
getComparisonVocab@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:747:9
INIT@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:514:13
updateView@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:712:23
UIPage/this.setStatus@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:705:13
HPX@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:124:5
checkJQuery/<@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:54:19
checkJQuery@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:53:10
tms_ad6ec7bf_19aa_4674_b1a5_9773387578d0@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:51:11
g</<@eval:2:479
anonymous/<@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:4:1
anonymous/<@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:3:55
anonymous@moz-extension://e94e9fa6-f189-4676-b3b6-64f067c467b0/userscript.html?id=ad6ec7bf-19aa-4674-b1a5-9773387578d0:3:2
g</<@eval:2:479
E_c@eval:3:293
ka@eval line 1 > Function:61:378
create@eval line 1 > Function:72:334
e@eval line 1 > Function:16:154

And in review when opening the details for a vocab the info is loading forever (never seen it finish, after having installed Homophone explorer)
I have other scripts installed, namely the Framework and Pitch Info (which shows up below the loading animation, unlike the homophones section).

Reloading the API key works and then I have this:
“Last updated: …” (can’t copy because it keeps changing every second)
Reloading the page there is an empty section again (no message, no homophones (for population/artificial).

Oooh that doesn’t look good. Thanks for reporting it. I will have an in depth look at it in the next few days.

Not too big an issue, but it looks like the background colours don’t work -

There was another script that had this issue, which had an easy fix, but I don’t know if that has any relevance here…

But nonetheless, this should be really helpful for me, so thanks :smiley:

So I have no idea how this looked before, but if you replace lines 651-656 with the following code it should at least be readable again.

            t.spanItemBadge = $('<span>',{'class':'item-badge', lang:'ja'});
            t.anchor = $('<a>',{href:'/vocabulary/'+encodeURIComponent(homophones[readingsIndex].vocabs[i].character)});
            t.spanCharacter = $('<span>',{'class':'vocabulary-icon', lang:'ja', text:homophones[readingsIndex].vocabs[i].character});
            t.ulWrapper = $('<ul>');
            t.liReading = $('<li>',{lang:'ja', style:'color:#666666', text:homophones[readingsIndex].vocabs[i].kana});
            t.liMeaning = $('<li>',{style:'color:#666666', text:homophones[readingsIndex].vocabs[i].meaning});
2 Likes

oh my god, this add-on is so great

I can’t even… this is like essential, I would totally recommend everyone to install it

just make sure you follow advice of the guy above to make it work ^

finally I can connect the dots in my head

First of all I want to thank you for creating and maintaining this user script.

Request: Can you make the font clear/easy to read? It’s white on white here. Not all WaniKaniers prefer WK dark theme.

1 Like

Hello,

I am getting this error now: " Cannot find your API Key. Please try again later."
(Using FF 66.0.3, TamperMonkey 4.9.5921)

When I look at the FF console, I see :

what should I investigate next ?

ps : debugged a bit, it seems the following call is failing :
$.ajax({ method: ‘GET’, url: SETTINGS_URL, dataType: ‘html’ });