Am I the only one who feels that the recently retired messenger program from the company-thou-shall-not-name was a surprisingly nice piece of software compared to other software from that same company? While I’m not saying that it was perfect, its replacement, Skynet (or something similar), is “very bad” compared to it. I don’t want to use a stronger expression because I know that many zkanji users love that program.
Because I didn’t want to put up with Skynet, I decided to look for an alternative. The only alternative I found that was at least slightly acceptable is called Penguin. Well, it is not, but its name looks similar to this, even if it is pronounced differently. (I picked that alias because the authors of that program are friendlier with Linux than with Windows, and I didn’t want to be partial with Skynet either.) Now, I don’t dislike Pidgin (ok, I said it after all), unlike Skynet, so I started using it instead. Then I thought, wouldn’t it be nice to have a real open-source messenger program for Windows that even looks like a program written for Windows?
If you check out its website you will see, that the authors of Pidgin created an open-source library, called libpurple, which is used by Pidgin, and which could be the base for other programs. So after thinking a bit more I thought that it would be even nicer if I could have a hand in that future open-source messenger program that runs natively in Windows (and not with some terrible multi-OS interface). Unfortunately (or not), my hands are currently full with zkanji, but at least it won’t hurt to think.
Disclaimer: Sometimes I feel like writing about programming. And then I do. If it is not your cup of tea, don’t read this.
In case anyone is interested, I have uploaded the source files of my second “project” I wrote in C# as an exercise. There is no documentation for it and I have no idea what files make up a C# project, so I just packed everything in a ZIP file. To compile you will probably have to change a few paths, but apart from that nothing is necessary. Just download this SQLite port for C#, add the System.Data.SQLite DLL from it to the project and it should compile. I used Visual Studio 2010 express and it needs at least .NET 3.5 or maybe 4.0(?). Don’t expect anything serious, this is something I wrote in 2 days.
How to use (once it compiled):
- Download JMDict_e.gz and unpack the file as JMDict_e.xml to the “debug” or “release” folders created automatically for the project. (In other words, the data must be in the executable’s folder.)
- The data file is called JMDict_e without an extension, remember to add .xml!
- Run the program. This will create a database SQLite can use. (It will throw an exception when it’s done, don’t worry about it.)
- Close the program and run it again. You can browse the dictionary.
I have used many C# features that are not present in C++ and it’s possible that an experienced C# programmer would never do it like how I did. Still I’m proud of it as I have used some “advanced” programming features (i.e. reflection) after only spending a few days with the language. For example to describe table columns to my little SQLite wrapper, you just have to create a class containing some fields… Yes, it is nothing serious. Sorry for bringing it up… I have only uploaded it because I didn’t just want to delete the code after spending the whole weekend writing it.
My conclusion: (In the now traditional list format)
- I could learn this language to some extent if I spent a little more time on it.
- MS documentation sucks. It tells you how to use A to achieve B without explaining what A or B is. Good luck finding out information about those.
- MS documentation sucks.
- C# has a few intriguing features I have no idea how to use, but I suspect some great secrets are waiting to be discovered.
- I still don’t get it why anyone in their right mind would use interfaces apart from the compulsory built in types. Abstract classes always give greater freedom with additional features.
- It is clear why static cannot be virtual in C++, but in C# the class types are practically objects themselves (when using reflection) and functions can be easily invoked on them. Static virtual functions would have made my life so much easier…
- The compiler and program make up all kind of new types as they execute, which is very confusing for a beginner.
- No matter whether it is the built in database with ADO.NET or SQLite, both are very slow to make a dictionary like zkanji which has to look up tens of thousands of words each second. I couldn’t achieve more than 2-3000. Scrolling the dictionary had acceptable speed, but searching while typing simply didn’t work. I will try to rewrite the whole program, either by keeping some look-up data in memory all the time if it’s possible, or creating my own data handling classes, like I did in zkanji. (I could probably port the dictionary browsing code from C++ in a few hours but then I wouldn’t learn anything.)
- There is no point comparing Visual Studio with Rad Studio. Both are great in some things, terrible in others. (Is there a way to look up the result of function calls in the debugger in VS without having to step into them?)
- Intentionally trying to write complex code just to learn something is fun. (Only depends on your idea of fun, really.)
- I wish I had someone to ask about C# while coding. I have no idea if I did things the orthodox way or my solutions were so crazy no wonder it was a pain to make them work.
- You can see the keywords like “strongly typed” a lot while learning C#, because the documentation writers and forum posters are all proudly using them. I don’t say it’s bad or good or anything, C++ is “strongly typed” too after all, but they all sound like some ad slogan to me.
- I don’t hate C# more than C++, even if someone might think so from reading my blog. I just stopped complaining about C++ long ago.
I could probably make up more to write if I thought about it, but I’m tired and the only real conclusion I’m serious about is that I’m not satisfied with my own performance yet. (I bet I’ll get a lot of spam for this.) I think I haven’t used most of the central C# features, or not how they were intended to be used, and instead used others that people would only try as their last resort. Or maybe not, but there is no way for me to find out.
Many Japanese students probably know about WaKan, the program that started it all. At least that was the model when I started writing zkanji.
Not yet! (I admit the title might be a bit misleading.) But I could make zkanji talk with a great open-source project, called Open JTalk. You can test the output it creates at its demo page. Just enter Japanese text in the field next to 合成テキスト (Only enter short sentences because it can’t handle long ones.) and press the button below it. You don’t have to install add-ons (I don’t have what it asks for), the generated sound can be saved in wav format as well.
I think the speech it generates is great. It’s much better than other TTS engines I have heard before. (Google’s translator can speak too, and its sound quality is amazing but somehow it can’t put together words that well.) It is free to use, it has an open-source license. So why don’t I want use it in zkanji? Actually I’m not yet sure about this, but at the moment I think that it is not appropriate for use by students. While it can say short sentences really well, it doesn’t work as great with single words or longer text. When it says single words, the sound is a bit shaky, and even if we find a long sentence that it can say without problems, it doesn’t sound as natural as a human would speak.
I have found another problem with its integration into zkanji. You probably know that some words in Japanese, though written with the same kanji, might sound very differently in different context. The simplest example is 何 that can be said as なに(nani) and also as なん(nan). There is no way at the moment to tell Open JTalk to say one or the other. This little problem would prevent zkanji to say the selected word in the dictionary when its reading differs from the most used one, and can also cause problems when the engine doesn’t recognize the correct form of the word in sentences, when it reads example sentences.
If you have listened to the speech that Open JTalk generated, you will probably agree that it is doing a great job. In the future it might become almost as good as a human speaker, or at least good enough to be used for studying. I’m sure the authors would appreciate any help they can get, so if you’re a genius, head over there and make it even better!