Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Tomcollins

#1
Problems / Re: meikan hanzi
10. May 2008, 20:22:36
显示不出汉字
看不到汉字

@pinyin search: you have to switch the language to chinese and enter it like "xuesheng". As I try this, it works...
@font: if your mobile doesn't support chinese fonts you have to use bitmap fonts.
DFM_HanDeDict_3.1.2. has bitmapfont included.
If the bitmap-font is not loaded correctly, the settings dialog will not show this option.
So why does it not load proper on the Razzr V6?
I don't know.
But there is the possibility to switch on debugging output via the *.jad-file:
set log-level to 1 or 2.
And then see whats written on the screen of the mobile..

Sebastian
#2
Hi!

Unfortunately you have to use bitmapfont, when you do not have a bitmapfont installed. In addition I also advice to always use the b/w mode if you use bitmapfonts.
As for the "find exact match", I don't know why this is necessary. Maybe another sony ericcson bug.

To avoid bitmapfont one radical solution is to change the language of your operating system to chinese/english. Which means you have to flash the whole device. This can be done by this small-mobile-shops-around-the-corner. Then you don't need bitmapfonts anymore.
But I think this is not interesting for someone just using the chinese fonts sometimes when travelling in china.

@size: You can change the size of the bitmapfont if you created a bitmapfonts with several sizes. This can in principle be done by everyone.

greetings,
Sebastian
#3
This is a first attempt to create a Graphical User Interface for DictionaryGeneration and JarCreator. If one just doubleclicks the Builder a GUI should start. Started with arguments for the Generation, the Generation should perform. It is just a try, but it should work.
Have a try!!

Greetings,
Sebastian
#4
Problems / Re: "use bitmap font" doesn't work
23. January 2008, 00:48:08
Hi!

Hmmm. You Could try to turn "Colored display" off . I can just guess. Bitmapfonts might not be loading correctly.
If you want you can send me your version (or a smaller test-version) and I'll have a look at it.
http://dictionarymid.sourceforge.net/contact.html

Sebastian
#5
Problems / Re: Bitmap Font Setup
18. January 2008, 14:56:35
@truetype fonts:
Some time ago I searched for using ttf with java me. Seemed that ttf just isn't supported by java me in general. If there's any news on that, that would be easy to implement and a much better solution in many aspects....

@bitmapfont versions: the versions you mentioned are not compatible, (as you already recognized).

Sebastian
#6
the cedict class is taking input with pinyin in brackets, the input looks like:
安康 安康 [01an1 kang1],good health

To solve all the problems you would probably need your own update class (or maybe normation class which removes the numbers). Maybe you can find someone to do that...

I added the source code of the cedict-update-class

/*
DictionaryForMIDs - a free multi-language dictionary for mobile devices.
Copyright (C) 2005, 2006  Gert Nuber (dict@kugihan.de), Erik Peterson (http://www.mandarintools.com/)

GPL applies - see file COPYING for copyright statement.
*/

package de.kugihan.dictionaryformids.dfmbuilder.dictgen.dictionaryupdate;

import java.util.Vector;

import de.kugihan.dictionaryformids.general.DictionaryException;
import de.kugihan.dictionaryformids.general.Util;

public class DictionaryUpdateCEDICTChi extends DictionaryUpdate {

/*
* The input looks like
* 安康 安康 [01an1 kang1],good health
* [01 is the start content delimiter
*/

// replaces the pronounciation part which is pinyin with tone numbers in the source
// with accented pinyin, by using Erik Peterson's conversion routines
public String updateDictionaryExpression(String dictionaryExpression) throws DictionaryException {
String updatedExpression;
int startBracket = dictionaryExpression.indexOf('[');
int endBracket = dictionaryExpression.toString().indexOf(']');
if ((startBracket != -1) && (endBracket > startBracket)) {
String pronounciationToneNumbers = dictionaryExpression.substring(startBracket + 3, endBracket);  // + 3 because of [01
String pronounciationAccented = addTones(pronounciationToneNumbers);
updatedExpression = dictionaryExpression.substring(0, startBracket) +
    "[" +
    pronounciationAccented +
    "]";
updatedExpression = DictionaryUpdateLib.setContentPronounciation(updatedExpression, 1);
}
else {
updatedExpression = dictionaryExpression;
}
return updatedExpression;
}

// Creates the keyWordVector for
// a) the pronounciation part which is in square brackets:
//    - one time with tone numbers
//    - one time without tone numbers
//    - one time in the accented version using Erik's conversion routines 
// b) for the Chinese expression
public Vector createKeyWordVector(String expression, String expressionSplitString) {

Vector keyWordVector = new Vector();

int startBracket = expression.indexOf('[');
int endBracket = expression.toString().indexOf(']');

String chineseExpression;
if ((startBracket != -1) && (endBracket > startBracket)) {
String pronounciationExpression = expression.substring(startBracket + 3, endBracket);
chineseExpression = expression.substring(0, startBracket);
DictionaryUpdateLib.addKeyWordExpressions(pronounciationExpression, keyWordVector);
String pronounciationWithoutNumbers = removeNumbers(pronounciationExpression);
DictionaryUpdateLib.addKeyWordExpressions(pronounciationWithoutNumbers, keyWordVector);
String pronounciationAccented = addTones(pronounciationExpression);
DictionaryUpdateLib.addKeyWordExpressions(pronounciationAccented, keyWordVector);
}
else {
chineseExpression = expression;
}
DictionaryUpdateLib.addKeyWordExpressions(chineseExpression, keyWordVector);

return keyWordVector;
}

protected String removeNumbers(String expression) {
StringBuffer output = new StringBuffer();
for (int pos = 0; pos < expression.length(); ++pos) {
char character = expression.charAt(pos);
if (! Character.isDigit(character)) {
output.append(character);
}
}
return output.toString();
}


/*
* The code below comes from Erik Peterson (http://www.mandarintools.com/)
*/
    public static String addTones(String withnumbers) {
    StringBuffer scratch = new StringBuffer(withnumbers);
    int index, oldindex;
    String source, target;
    String oldtail[];
    String newtail[];
    String vowelnums[];
    String voweltones[];
    oldtail = new String[] {"ng1", "ng2", "ng3", "ng4", "ng5",
    "n1", "n2", "n3", "n4", "n5",
    "r1", "r2", "r3", "r4", "r5",
    "ao1", "ao2", "ao3", "ao4", "ao5",
    "ai1", "ai2", "ai3", "ai4", "ao5",
    "ei1", "ei2", "ei3", "ei4", "ei5",
    "ou1", "ou2", "ou3", "ou4", "ou5"};

    newtail = new String[] {"1ng", "2ng", "3ng", "4ng", "5ng",
    "1n", "2n", "3n", "4n", "5n",
    "1r", "2r", "3r", "4r", "5r",
    "a1o", "a2o", "a3o", "a4o", "a5o",
    "a1i", "a2i", "a3i", "a4i", "a5i",
    "e1i", "e2i", "e3i", "e4i", "e5i",
    "o1u", "o2u", "o3u", "o4u", "o5u"};

    vowelnums = new String[] {"a1", "a2", "a3", "a4", "a5", "e1", "e2",
    "e3", "e4", "e5",
      "i1", "i2", "i3", "i4", "i5", "o1", "o2", "o3", "o4", "o5",
      "u1", "u2", "u3", "u4", "u5",
      "u:1", "u:2", "u:3", "u:4", "u:5", "u:",
      "v1", "v2", "v3", "v4", "v5", "v"};
    voweltones = new String[]  {"\u0101", "\u00e1", "\u01ce", "\u00e0", "a",
        "\u0113", "\u00e9", "\u011b", "\u00e8", "e",
        "\u012b", "\u00ed", "\u01d0", "\u00ec", "i",
        "\u014d", "\u00f3", "\u01d2", "\u00f2", "o",
        "\u016b", "\u00fa", "\u01d4", "\u00f9", "u",
        "\u01d6", "\u01d8", "\u01da", "\u01dc", "\u00fc", "\u00fc",
        "\u01d6", "\u01d8", "\u01da", "\u01dc", "\u00fc", "\u00fc"};

    // Move to lower case
    withnumbers = withnumbers.toLowerCase();

    // Switch tone number from end of syllable to next to appropriate vowel
    source = withnumbers;
    target = withnumbers;  // Have to set it here to satisfy compiler
    for (int i=0; i < oldtail.length; i++) {
        oldindex = index = 0;
        target = "";
        index = source.indexOf(oldtail[i], oldindex);
        while (index >= 0) {
    target = target + source.substring(oldindex, index);
    target = target + newtail[i];
    oldindex = index + oldtail[i].length();
    index = source.indexOf(oldtail[i], oldindex);
        }
        target = target + source.substring(oldindex, source.length());
        source = target;
    }

    // Replace vowel+tone number with vowel with a tone diacritic
    boolean foundvowel = false;
    for (int i=0; i < vowelnums.length; i++) {
        oldindex = index = 0;
        target = "";
        index = source.indexOf(vowelnums[i], oldindex);
        while (index >= 0) {
    target = target + source.substring(oldindex, index);
    target = target + voweltones[i];
    oldindex = index + vowelnums[i].length();
    index = source.indexOf(vowelnums[i], oldindex);
    foundvowel = true;
        }
        target = target + source.substring(oldindex, source.length());
        source = target;
    }

    if (!foundvowel) {
        target = withnumbers;
    }
    return target;
}
}


Sebastian
#7
Seems we don't have a normation Class for Pinyin yet (who has time?:)). We always did this with "update"-classes:
There are two for chinese entries with pinyin, but they may not fit for your problem since they require a very specific input.
The existing ones are:
DictionaryUpdateHanDeDictChi
DictionaryUpdateCEDICTChi

The fastest solution for your problem might be to enter something like "gai?" or "gai*", using wildcards. In options you can try switch on "* at the end".

Sebastian

infoText: Chinese-English dictionary from CEDICT: http://www.mandarintools.com/cedict.html
dictionaryAbbreviation: CEDICT
numberOfAvailableLanguages: 2
language1DisplayText: Chinese
language2DisplayText: English
language1FilePostfix: chi
language2FilePostfix: eng
dictionaryGenerationSeparatorCharacter: '\t'
indexFileSeparationCharacter: '\t'
searchListFileSeparationCharacter: '\t'
dictionaryFileSeparationCharacter: '\t'
dictionaryGenerationLanguage2ExpressionSplitString=/
dictionaryGenerationInputCharEncoding: UTF-8
language2NormationClassName: de.kugihan.dictionaryformids.translation.normation.NormationEng
language1DictionaryUpdateClassName: de.kugihan.dictionaryformids.dictgen.dictionaryupdate.DictionaryUpdateHanDeDictChi
language2DictionaryUpdateClassName: de.kugihan.dictionaryformids.dictgen.dictionaryupdate.DictionaryUpdateHanDeDictGer
indexCharEncoding: UTF-8
searchListCharEncoding: UTF-8
dictionaryCharEncoding: UTF-8
language1NumberOfContentDeclarations=3
language1Content01DisplayText: Simplified
language1Content01DisplaySelectable: true
language1Content02DisplayText: Traditional
language1Content02DisplaySelectable: true
language1Content03DisplayText: Pinyin_with_tones
language1Content03DisplaySelectable: true
#8
try: "fired*chicken"

see help for wildcard usage!

Sebastian
#9
Hi!

Sorry, but I don't know what the problem might be...

I can just tell you that you can use the bitmapfont in the "not-coloured" mode, that should be much faster.
And you can try this version
http://stud3.tuwien.ac.at/~e0225729/MID/DictionaryForMIDs_chieng_CEDICT.jar
for bigger font sizes. You can also create them by yourself or even search for the bug in the code, if you have the time to.

Your problem doesn't occur with bitmapfonts, but without, is that correct?
If I find something, I'll let you know.

Sebastian

#10
General discussions / Re: Review of Chinese Dictionary
24. September 2007, 00:13:58
I finally found the time to set up a new version. Please have a try (feedback appreciated):

http://stud3.tuwien.ac.at/~e0225729/MID/DictionaryForMIDs_3.1.2_ChiEng_CEDICT.zip

Really sorry for taking so long,
Sebastian
#12
Problems / Re: BITAMP Bug
23. September 2007, 23:55:42
I just did set up a new version. please have a try (feedback appreciated):

http://stud3.tuwien.ac.at/~e0225729/MID/DictionaryForMIDs_3.1.2_ChiEng_CEDICT.zip

(for the others: there you also find the word girl...)

Sebastian
#13
Problems / Re: BITAMP Bug
23. September 2007, 23:19:42
Hi!

We know the problem! It's because most of the mobiles don't support all the vowels with accents on them. So I think, the best solution is to build a new cedict-DFM with pinyin with normal latin chars with numbers behind the syllab. But someone has to do it. Actually I wanted to do that along time ago...
Maybe I find some time these days. You can give it a try too. Although it might be a little more complicated because you may have to change the languangeUpdateClass. If you wanna give it a try I could help you in creating a new version. for the basics --> see Setting up a new dictionary!

Sebastian
#14
Yeah. You're right about the "txt-format". Just write and save it like a text file and then rename the extension to ".properties".
And yes, ".properties" is the right extension.
If there's something else, don't hesitate to ask.

Sebastian
#15
I think I already came up with this before:
An option for a search in both indexes (languages) might be helpful in some cases!
Anybody who wants to do that?..

Sebastian