LG not finding dictionaries

24 views
Skip to first unread message

J_Y_C

unread,
Oct 29, 2010, 9:44:19 AM10/29/10
to link-grammar
I am trying to use the Java libraries on windows, and when I try to
run the LGService with the params:

-verbose -threads 10 2122 C:\JavaLibs\link-grammar-java\en\

I get:

java.lang.UnsatisfiedLinkError:
org.linkgrammar.LinkGrammar.setDictionariesPath(Ljava/lang/String;)V
at org.linkgrammar.LinkGrammar.setDictionariesPath(Native
Method)
at org.linkgrammar.LGService.main(LGService.java:553)

The path is definitely the correct path to the libraries, and I've
tried using forward slashes, single and double backslashes in the
path. Any advice would be greatly appreciated.

Bartosz Browarski

unread,
Oct 29, 2010, 9:58:34 AM10/29/10
to link-g...@googlegroups.com


2010/10/29 J_Y_C <4che...@gmail.com>
Try changing the dictionary path so that it points to the .dict file. Like: \en\4.0.dict 

Hope this helps.

Regards
Brovar

J_Y_C

unread,
Oct 29, 2010, 10:31:22 AM10/29/10
to link-grammar
Thanks for your reply.

When I specify the .dict file directly, I get:

Dictionary path C:\JavaLibs\link-grammar-java\en\4.0.dict not a
directory.

Looking in JGService.java line 537, it definitely wants that path to
refer to a directory.



On Oct 29, 9:58 am, Bartosz Browarski <bartosz.browar...@gmail.com>
wrote:
> 2010/10/29 J_Y_C <4chen...@gmail.com>

Borislav Iordanov

unread,
Oct 29, 2010, 11:23:14 AM10/29/10
to link-g...@googlegroups.com
I think what you are missing is the path to the native linkgrammar
libraries - the DLLs, link-grammar.dll and link-grammar-java.dll. You
put in your windows PATH env variable or on the java command line like
this:

java ... -Djava.library.path=c:\JavaLibs\link-grammar-java\native

where c:\JavaLibs\link-grammar-java\native points to the location of the DLLs.

Boris

> --
> You received this message because you are subscribed to the Google Groups "link-grammar" group.
> To post to this group, send email to link-g...@googlegroups.com.
> To unsubscribe from this group, send email to link-grammar...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/link-grammar?hl=en.
>
>

--
http://www.kobrix.com - HGDB graph database, Java Scripting IDE, NLP
http://kobrix.blogspot.com - news and rants

"Frozen brains tell no tales."

-- Buckethead

J_Y_C

unread,
Oct 29, 2010, 4:11:10 PM10/29/10
to link-grammar
You are correct, I missed the link-grammar-java.dll file. Now I
believe that it has access to all the files, though it is still not
working properly.

I am running the file LGService with the above parameters, and it
indicates that it is waiting for clients.

Then, I added a main method to the LGRemoteClient class with the
following contents:

LGRemoteClient client = new LGRemoteClient();
client.setPort(2122);
client.setHostname("localhost");
try {
ParseResult res = client.parse("The Quick Brown Fox");

System.out.println(res.getText());
} catch (InterruptedException ex) {

Logger.getLogger(LGRemoteClient.class.getName()).log(Level.SEVERE,
null, ex);
}

The LGRemoteClient the complains:
Exception in thread "main" java.lang.RuntimeException: Parser returned
no response.

And the server complains:
java.lang.UnsatisfiedLinkError:
org.linkgrammar.LinkGrammar.getDictVersion()Ljava/lang/String;
at org.linkgrammar.LinkGrammar.getDictVersion(Native Method)
at org.linkgrammar.LGService.getAsJSONFormat(LGService.java:
362)
at org.linkgrammar.LGService.handleClient(LGService.java:456)
at org.linkgrammar.LGService.access$000(LGService.java:63)
at org.linkgrammar.LGService$2.run(LGService.java:561)
at java.util.concurrent.Executors
$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask
$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

At that particular spot in the code, it appears to be building th JSON
object in a string buffer, so I made an output of the buffer before
the crash happens,
and this is what is in the buffer before the crash:
{"tokens":["LEFT-WALL","the","Quick","Brown","Fox","RIGHT-
WALL"],"numSkippedWords":5,"entity":[],"pastTense":[],"linkages":
[{"words":["LEFT-WALL","[the]","[Quick]","[Brown]","[Fox]","RIGHT-
WALL"], "disjuncts":
[null,"¤ô0004\f008A!","¤ô0004\f008A!","¤ô0004\f008A!","¤ô0004\f008A!",null],
"andCost":0, "disjunctCost":0, "linkageCost":0, "numViolations":0,
"constituentString":"(S The Quick Brown Fox)\n", "links":
[]}],"version":"link-grammar-
@LINK_MAJOR_VERSION@.@LINK_MINOR_VERSION@.@LINK_MICRO_VERSION@"


Does this help? Am I calling the service wrong?



On Oct 29, 11:23 am, Borislav Iordanov <borislav.iorda...@gmail.com>
wrote:
> --http://www.kobrix.com- HGDB graph database, Java Scripting IDE, NLPhttp://kobrix.blogspot.com- news and rants

Borislav Iordanov

unread,
Oct 29, 2010, 4:32:47 PM10/29/10
to link-g...@googlegroups.com
Hi,

1) Normally, you'd have your own Java client program that uses the
LGRemoteClient class rather than modifying it.
2) I believe the _new_ link error might be due to an incompatibility
b/w the JNI bindings and the DLLs that you have, since from your
tracing it appears that DLLs have been loaded, but the failure is on a
particular native method call. I have no idea why that incompatibility
might be....is it an official build or have you build it yourself?

Boris

> For more options, visit this group at http://groups.google.com/group/link-grammar?hl=en.
>
>

--
http://www.kobrix.com - HGDB graph database, Java Scripting IDE, NLP
http://kobrix.blogspot.com - news and rants

J_Y_C

unread,
Oct 30, 2010, 7:19:13 AM10/30/10
to link-grammar
Thanks for your reply.

1. Yes, once I have this configured properly I will be moving it to my
own application, but while configuring I just used the LGRemoteClient
class to hold my main method. There is no reason that should make a
difference, I could move it into a LGConfigTesting class, but the
main() would still be the same. My main concern is the determine if I
am using the classes as it would appear I am to. It would appear that
I am indeed using them correctly.

2. Yes, it appears to be happening when
org.linkgrammar.LinkGrammar.getDictVersion() gets called and the
output appended to the JSON text being built. I have been trying,
unsuccessfully, to build it on windows. So far, I have tried the build
and failed using Cygwin, Msys, and VS2010. I downloaded the dlls
reference from here:
https://svn.kobrix.com/disco/trunk/native/windows/

...in this thread:

http://groups.google.com/group/link-grammar/browse_thread/thread/263b2a1be16425a2

I guess this was really just a shot in the dark, and I now realize
that there is a .jar file of the java class files that do not make
that dll call at that location.

I would greatly prefer to just do my own build, so I can know what it
is exactly, but I just can't get this to compile on my Vista machine.

I am going to try this .jar file for now, until I can get my own 4.7.1
built...


On Oct 29, 4:32 pm, Borislav Iordanov <borislav.iorda...@gmail.com>
wrote:
> >> --http://www.kobrix.com-HGDB graph database, Java Scripting IDE, NLPhttp://kobrix.blogspot.com-news and rants

J_Y_C

unread,
Oct 30, 2010, 10:43:48 AM10/30/10
to link-grammar
Using the .jar file included with the .dll referenced, I was able to
get both the client and server to work.

I would rather get the compilation to work, I just got tired of having
compilation problems, and wanted to move on.

It would appear that I am not the only one having problems getting it
to compile on windows. I had to add the proper regex classes to msys
to get past the ./configure step, but I just can't get the make to
work.

Thanks for your guidance on this. I think I am probably just getting
impatient, and need to make a more concerted effort to get it to
compile.

Is there somewhere that I can find pre-compiled .dll's of the most
recent versions?



On Oct 30, 7:19 am, J_Y_C <4chen...@gmail.com> wrote:
> Thanks for your reply.
>
> 1. Yes, once I have this configured properly I will be moving it to my
> own application, but while configuring I just used the LGRemoteClient
> class to hold my main method. There is no reason that should make a
> difference, I could move it into a LGConfigTesting class, but the
> main() would still be the same. My main concern is the determine if I
> am using the classes as it would appear I am to.  It would appear that
> I am indeed using them correctly.
>
> 2. Yes, it appears to be happening when
> org.linkgrammar.LinkGrammar.getDictVersion() gets called and the
> output appended to the JSON text being built. I have been trying,
> unsuccessfully, to build it on windows. So far, I have tried the build
> and failed using Cygwin, Msys, and VS2010. I downloaded the dlls
> reference from here:https://svn.kobrix.com/disco/trunk/native/windows/
>
> ...in this thread:
>
> http://groups.google.com/group/link-grammar/browse_thread/thread/263b...
> > >> --http://www.kobrix.com-HGDBgraph database, Java Scripting IDE, NLPhttp://kobrix.blogspot.com-newsand rants

Borislav Iordanov

unread,
Oct 30, 2010, 5:16:05 PM10/30/10
to link-g...@googlegroups.com
It shouldn't be "that" hard to get it to compile under Windows. I've
done it many times with MSVC++ (the DLLs that you got are the ones
that I've compiled some time ago) and there's always something, but
it's usually manageable. The code is mostly standard C + the regex
library. Since development happens under Linux, usually newer version
introduce a call to a function MS doesn't, but has an equivalent so
you need to find it, #IFDEF etc....:)

Boris

> For more options, visit this group at http://groups.google.com/group/link-grammar?hl=en.
>
>

--
http://www.kobrix.com - HGDB graph database, Java Scripting IDE, NLP

http://kobrix.blogspot.com - news and rants

J_Y_C

unread,
Oct 30, 2010, 5:31:28 PM10/30/10
to link-grammar
Thanks again for your guidance. I am a little green on C, but I have
no problem with it. I think I will just have to do my DD.

Thank a mil.

On Oct 30, 5:16 pm, Borislav Iordanov <borislav.iorda...@gmail.com>
wrote:
> --http://www.kobrix.com- HGDB graph database, Java Scripting IDE, NLP ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages