Hello,
Finally managed to get LinkGrammar DLL's working in Java x64 environment, and faced with another problem...
Is there any way to switch dictionary/language through the Java interface?
Hi Linas,
Thank you for your quick response!
I just posted in another thread very brief tutorial describing how to build LinkGrammar x64 DLLs and how to use them in Java.
I tried "setDictionaryPath()" already and it doesn't work for switching languages because it requires path to "data" folder, but not to "data/en" folder for example. If you will try to pass something like "data/en" you will get error message saying that dictionary was not found.
It looks like that simple copying files from "ru" to "en" work (at least LinkGrammar.init() doesn't claim about missing dictionary)...
Thank you again,
Alex
--
You received this message because you are subscribed to the Google Groups "link-grammar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.
To post to this group, send email to link-g...@googlegroups.com.
Visit this group at http://groups.google.com/group/link-grammar?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Linas,
Just added following functions and methods to jni-client.c, jni-client.h and LinkGrammar.java
- setLanguage(String) switches between en, ru, etc.
- setLocale(String) switches between en_EN.UTF-8, ru_RU.UTF-8, etc.
And of course made corresponding changes in the init() function in jni-client.c
It works well for English dictionary (i.e. language=en and locale=en_EN.UTF-8), but it fails loading Russian one (i.e. language=ru and locale=ru_RU.UTF-8) with following error message
- link-grammar: Error parsing dictionary /ru/stem.dict.
Expecting ";" at the end of an entry.
line 6140, tokens = "ЕДК,0>" ";" "бессмысленно.e" "зачем.e" "здесь.e"
My first though was that it is caused by wrong locale (that is why the setLocale() method was implemented), but it is not,,,
Could you point me to any example how to switch languages using LinkGrammar directly (without Java wrap)?
tested it both for Win32 and x64 platforms using two different RegEx libraries ( http://gnuwin32.sourceforge.net/packages/regex.htm and http://www.airesoft.co.uk/pcre) for Win32 build.
The first error says "link-grammar: Error parsing dictionary /ru/stem.dict.
Expecting ";" at the end of an entry. line 6140..."
Hi Linas,
Thank you very much for your suggestions and comments!
I tried all of them without any success, then I sent it to my colleague, and he found the problem.
The Cyrillic "Р" symbol is represented by 1056 and 160 wchar_t values,
and it is treated as a delimiter in link_advance() at read-dic.c.
1. Dictionary reading issue
As it was discussed before, we had problems reading the Russian dictionary from Windows.
Alexey noticed that Visual Studio doesn't read hard-coded UTF-8 values correctly, like this one: "const wchar_t wqs[] = L"\"\'«»《》【】『』‘’`„“""; from tokenize.c. The reason is that its compiler simply doesn't understand them as UTF-8 values even when the source file encoding is set to UTF-8 directly.
Link Parser executable didn't work because the Windows console doesn't support UTF-8 by default.
Then, as I mentioned abive, we switched to Linux working on our project and everything works well there. Though, some of our colleagues are Windows persons unfortunately.
Also I added couple functions to jni_client enabling language choice and linkages count. You can find modified files attached.
I think it is better to use the same encoding for all platforms.
Now I faced with another issue, it looks like that your implementation and Sergey's one (http://slashzone.ru/parser/) work in different way (see the attachment).
By the way do you know any other teams which work with the Russian dictionary?
Recently I tried to get in touch with Sergey by email without success.
You was quite right, the problem was in the capitalized first letter.