![]() |
|
Exporting koohii.com stories to Rikaichan dictionary? - Printable Version +- kanji koohii FORUM (http://forum.koohii.com) +-- Forum: Learning Japanese (http://forum.koohii.com/forum-4.html) +--- Forum: Learning resources (http://forum.koohii.com/forum-9.html) +--- Thread: Exporting koohii.com stories to Rikaichan dictionary? (/thread-10975.html) |
Exporting koohii.com stories to Rikaichan dictionary? - Stansfield123 - 2013-07-11 Hi. As you might know, this site's (and individual user's) stories can be exported into a .csv file. Can anyone think of a relatively straight forward way to then turn that csv file into a Kanji dictionary for Rikaichan (like the ones available as Firefox add-ons). I'd be happy to work on it, just need some help on how those dictionaries (and Firefox add-ons) are actually set up, where the files are on my computer, etc. I know some web programming, but I know nothing about Firefox specifically. It would be great if, instead of just a keyword, my actual story would show up when Shift-hovering over a Kanji. Sometimes I forgot the story, and I have to then fire up this site, and look it up. Way too much work to do while reading something. But it's an essential part of my process. Exporting koohii.com stories to Rikaichan dictionary? - Stansfield123 - 2013-07-12 Ok, so I figured out that the dictionary entries are stored in a .sqlite database file. I opened up the file (with a sql editor), but all I see are three columns: Kanji, Kana, and Entry, which contain 215.000 rows. But they seem to all be words, readings and translations, not individual Kanji info. No sign of where the Kanji information is stored (the various indexes, and the associated meanings, which are displayed when you Shift hover over a Kanji). If anyone knows, it would be greatly appreciated. Exporting koohii.com stories to Rikaichan dictionary? - ryuudou - 2013-07-12 You can ask cb4960 in the Rikaisama thread. Exporting koohii.com stories to Rikaichan dictionary? - cb4960 - 2013-07-12 The kanji database is here: chrome\rikaichan.jar\content\kanji.dat For Rikaisama, the full installed path looks something like this: C:\Users\chris\AppData\Roaming\Mozilla\Firefox\Profiles\uwcku02c.default\extensions\{697F6AFE-5321-4DE1-BFE6-4471C3721BD4}\chrome\rikaichan.jar\content\kanji.dat Exporting koohii.com stories to Rikaichan dictionary? - Stansfield123 - 2013-07-13 Thanks. That'll work great. I'll just throw something together in C++ to add the stories from the csv file. Exporting koohii.com stories to Rikaichan dictionary? - Stansfield123 - 2013-07-17 Sooooh, I did it. Barely. I wish I hadn't used C++, especially not a Microsoft compiler. I'll post the code which worked for me, but to say that it's a hackjob is an understatement. It barely works, I did no testing, I didn't even try to plan for contingencies. Any quirk in the input will surely break it. But, if you wanna give it a shot and compile it, go ahead. I compiled it in Visual C++ 2010 Express, running on XP. It's kinda important, because newlines are different on different systems, and it took quite a bit of experimenting to figure out how to add the newlines to prevent Rikaisama from crashing (that was the only snag in the whole operation, to be honest; for some reason, the thing only works if I add the newlines with std::endl; doing the same exact thing with +'/n' for instance causes the whole add-on to crash). Here's the code. One file, because hackjob: https://docs.google.com/document/d/1crgl0zuAhC-HpjwohmFAuCYoyBjC7jxp-U2INfGtzig/edit?usp=sharing Input files are my_stories.csv and kanji.dat, hard coded (like I said, it's a hackjob). You should either leave them exactly as they are, or, if you edit my_stories.csv, save it as ANSI. Editing and saving as Utf-8 doesn't work for some reason (it should, but it doesn't, and I'm too lazy to look into it). Luckily, the encoding doesn't matter, because I'm only using English text and numbers from that file. kanji.dat should be obtained from the path in the post above, and left untouched. There are two output files: test_stories.txt and test.txt. test_stories.txt is just a file the code dumps the Heisig nr, keywords and stories into, to make sure I read them in right. If it's empty or incomplete, it means reading the stories didn't work, and you should either try and fix the code/source file or don't bother continuing. test.txt is the new kanji.dat. Rename it that, and copy/paste it back into the old one's place (with Firefox closed). Then start up Firefox and Rikaisama. It will either show the stories in curly brackets next to the Heisig keyword, when you Shift hover over a Kanji, or crash. If it crashes, wait for a dialog box and kill the script. Hope you remembered to save the old kanji.dat. If you did, close Firefox and copy it back in its place. No harm, no foul. P.S. If anyone wants it, I can fix up the interface a little and share an .exe file. But compiling a C++ file is very easy. Exporting koohii.com stories to Rikaichan dictionary? - Stansfield123 - 2014-04-18 Update: there is a bug. The Kanji dictionary only works with html formatted documents. If you open up a .txt file in Firefox, you can use Rikaisama just fine with the word and name dictionaries, but the Kanji dictionary I added won't work. I have no idea why. But you can easily convert plain text to html, here for instance: http://www.textfixer.com/html/convert-text-html.php (make sure it adds <p> tags not just <br> tags, and deselect the "encode..." option). It's probably a good idea to do it even if you don't have my dictionary, because html looks better in Firefox (also, with light novels, there are pictures, which won't show up in a plain text file). Exporting koohii.com stories to Rikaichan dictionary? - psychopatate - 2014-04-19 I totally agree with what you said on another post, that reviewing Kanji stories this way is WAY more practical than firing up the site. I had to completely pause my study of Japanese since last summer, and this summer I'm expecting I'll have to review many of the stories and that's such a pain... I can't wait to start reading actual novels ! I would appreciate it so much if this becomes a very real program ! I just looked up the world "compile" and it seems a bit scary for now so I'll either wait for summer and get everything done then, or ask you to *complete the favor you've offered*- to translate from my mother tongue and create the .exe file .... the first option makes me worry because I'll probably need help and I can't guarantee you'll still be around then... What do you advise ?
Exporting koohii.com stories to Rikaichan dictionary? - Stansfield123 - 2014-04-19 I can share the .exe file, it's no bother. This is the .exe file: http://www.filedropper.com/addstories Mirror: http://snk.to/f-cdc8y3fn This is the kanji.dat file I have (if it doesn't work with this kanji.dat file - maybe your system has a different version), you can find your kanji.dat file here, C:\Users\chris\AppData\Roaming\Mozilla\Firefox\Profiles\uwcku02c.default\extensions\{697F6AFE-5321-4DE1-BFE6-4471C3721BD4}\chrome\rikaichan.jar\content\kanji.dat (on Windows XP): http://www.filedropper.com/kanji The my_stories.csv file you'll have to download yourself, from this site, koohii.com. I'll share mine too, just in case it's useful with testing things out, but make sure to use yours: http://www.filedropper.com/mystories You need to have the input files (kanji.dat and my_stories.csv, named exactly this way) in the same directory as add_stories.exe, and it will hopefully produce the two correct output files: test_stories.txt and test.txt, in the same directory. It is working for me (it runs in a console, and, after a few seconds, produces the message "Lines in the file: 12618 Press any key to continue..." and the two output files). Copy test.txt in the directory above, rename it kanji.dat to replace the original (don't forget to save a backup of the original, in case this fails), and you should be good to go. I can't guarantee that it will work for you, and there isn't much I can do to help if it doesn't, sorry. Exporting koohii.com stories to Rikaichan dictionary? - psychopatate - 2014-04-20 Thank you ^^ ! I downloaded the "add_stories.exe" file and ran it, it gave a "msvcr100d.dll is missing from your system" error, so I downloaded a "msvcr100d.dll" file from a website and copied it into System32 Windows folder, then launched "add_stories.exe" and it worked perfectly and produced the two required files ! I copied "test.txt" and renamed it to "kanji.dat" and tried Rikaisama/Rikaichan with the Shift button, but the story didn't show up ? I'm thinking it could be the bug you mentioned above, but I'm not sure how to check that :/ Or could it be that I'm running on Windows 7 ? Can you upload an html file that the Kanji Dictionary worked on ? -filedropper didn't allow me to download btw, could be my location- Exporting koohii.com stories to Rikaichan dictionary? - Stansfield123 - 2014-04-20 psychopatate Wrote:Thank you ^^ !It should work for any website with Japanese text on it (they're all html). If it doesn't, it could be because of Windows 7. I don't really know much about Windows programming, sorry. Exporting koohii.com stories to Rikaichan dictionary? - psychopatate - 2014-04-21 YAHOO, IT WORKED !!!!!!! cb4960, amazing extension :') -Why it wasn't working when I posted my reply ? I had uncompressed rikaichan.jar to work inside the folder and after I was finished, I forgot to recompress the edited rikaichan folder into rikaichan.zip and then rename it into rikaichan.jar so the original rikaichan.jar was the one Rikaichan was working with. -Recently : I did above-mentioned operation, it didn't work :| for some reason the whole rikaichan smiley disappeared from Firefox ! So, since I had everything backed up, I recopied the original rikaichan.jar into its place and re-launched Firefox and the smiley was there. I closed Firefox and opened rikaichan.jar with WinRar, deleted the kanji.dat file from it "the original one here" and added my newly-created kanji.dat file and saved it. The file size dropped a lot, I really can't guess why, but when I launched Firefox the smiley was there and when I tried the shift-hover over a Japanese Wikipedia page, the story showed up next to the keyword ! ^^ BUT Rikaisama wouldn't work anymore.... So, same "WinRar > delete kanji.dat> add new kanji.dat> save file" operation to ANOTHER rikaichan.jar file in the OTHER folder with the really long name with numbers in here : C:\Users\Test\AppData\Roaming\Mozilla\Firefox\Profiles\g0u4lfpb.default\extensions One of the folders is for Rikaichan, and the other is for Rikaisama *has subfolders like "audio" and "edict" while the other doesn't * and now I have a working Rikaisama that displays the story next to the keyword This is awesome ! Thank you so much ! I'm sure I won't be the only one to need this ! You should name it something, this add-on.... like, Story-Hover-Popper ?? Thanks a ton for this ! Exporting koohii.com stories to Rikaichan dictionary? - Stansfield123 - 2014-04-22 The way I look at it, this thing is so poorly made that it doesn't deserve a name. But I'm glad you managed to get some use out of it. Exporting koohii.com stories to Rikaichan dictionary? - psychopatate - 2014-04-22 This thing that's poorly made happens to be a very valuable godsend for me ! ^^ Thanks ! |