Using Unitex JNI

73 views
Skip to first unread message

Olivier GRACIANNE

unread,
Feb 26, 2019, 8:44:00 AM2/26/19
to Unitex-GramLab
Hello there,

(Forgive me if my english is a bit awkward.)

I'm trying to use the Unitex JNI in a Scala app in order to analyze small corpuses (a few lines each). I'd like to know if there is a way of getting the results of the analyses as the function call result, instead of stored in a flat file, because it would be far more fitted to what I need.

Thanks a lot,
G. Olivier

Gilles Vollant

unread,
Feb 26, 2019, 8:51:42 AM2/26/19
to Olivier GRACIANNE, unitex-...@googlegroups.com

You can call each individual function uing jni

 

Can you describe more your need whant what you currently do?

 

 

De : unitex-...@googlegroups.com [mailto:unitex-...@googlegroups.com] De la part de Olivier GRACIANNE
Envoyé : mardi 26 février 2019 14:44
À : Unitex-GramLab
Objet : [Unitex-GramLab] Using Unitex JNI

--
You received this message because you are subscribed to the Google Groups "Unitex-GramLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unitex-gramla...@googlegroups.com.
To post to this group, send email to unitex-...@googlegroups.com.
Visit this group at https://groups.google.com/group/unitex-gramlab.
To view this discussion on the web visit https://groups.google.com/d/msgid/unitex-gramlab/bf2513b8-6954-4332-a94e-5d622fc64dfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Olivier GRACIANNE

unread,
Feb 26, 2019, 9:15:55 AM2/26/19
to unitex-...@googlegroups.com
I already have a shell script which launches every necessary command from Normalize to Locate and Concord to get the concord files results, containing tokens and all the info about them.

Now I'm working on a Scala written tool, which must use the JNI to perform the work that was done by the binaries called by my shell script.

So instead of opening and closing files, I want to get each individual call to the JNI to work on a String/List of Strings (or assimilated data type) and return me the same data type, containing the results of the command call.

Is what I need a bit clearer now ?

Gilles Vollant

unread,
Feb 26, 2019, 9:22:17 AM2/26/19
to Olivier GRACIANNE, unitex-...@googlegroups.com

Olivier GRACIANNE

unread,
Feb 26, 2019, 9:28:13 AM2/26/19
to unitex-...@googlegroups.com
Not to everything yet. So I'll have a look to these resources and see if it suits my needs.
Thanks a lot.

Olivier GRACIANNE

unread,
Feb 26, 2019, 9:41:25 AM2/26/19
to Unitex-GramLab
Back from the reading.
So Unitex is doing all the work on it's VFS. Do have a documentation about how it is implemented ?

Gilles Vollant

unread,
Feb 26, 2019, 10:51:34 AM2/26/19
to Olivier GRACIANNE, Unitex-GramLab

https://unitex-library.readthedocs.io/en/latest/vfs.html

 

 

De : unitex-...@googlegroups.com [mailto:unitex-...@googlegroups.com] De la part de Olivier GRACIANNE
Envoyé : mardi 26 février 2019 15:41


À : Unitex-GramLab
Objet : Re: [Unitex-GramLab] Using Unitex JNI

 

Back from the reading.

Olivier GRACIANNE

unread,
Feb 26, 2019, 11:33:38 AM2/26/19
to unitex-...@googlegroups.com
This is a 'how to use' documentation. I would like to have a 'how it is made' doc too. Is there one ?

By the way, I couldn't find the description of the function 'combineUnitexFileComponentWithQuote', used in the demo, in the documentation you gave me (https://unitex-library.readthedocs.io/en/latest/). Did I miss it or is there an other doc ?

Thanks a lot for your help !

Gilles Vollant

unread,
Feb 26, 2019, 4:59:55 PM2/26/19
to Olivier GRACIANNE, Unitex-GramLab

If you read french, read http://www.smartversion.com/unitex-contribution/

 

About the idea of vfs

http://www.smartversion.com/unitex-contribution/Unitex_A_NLP_engine_from_the_lab_to_the_iPhone.pdf

 

I can gave source of these function:

 

                /**

                * combine several path items and a filename to create a full filename

                */

                public static final String combineUnitexFileComponent(

                                               String... FilePathNameItems) {

                               String retStr = "";

                               String pSep = pathSeparator;

                               boolean isFirst = true;

                               for (String strItem : FilePathNameItems) {

                                               if (isFirst)

                                                               retStr = strItem;

                                               else

                                                               retStr = retStr + pSep + strItem;

                                               isFirst = false;

                               }

                               return retStr;

                }

 

                /**

                * combine several path items and a filename to create a full filename with

                * quote

                */

                public static final String combineUnitexFileComponentWithQuote(

                                               String... FilePathNameItems) {

                               String retStr = "";

                               String pSep = pathSeparator;

                               boolean isFirst = true;

                               for (String strItem : FilePathNameItems) {

                                               if (isFirst)

                                                               retStr = strItem;

                                               else

                                                               retStr = retStr + pSep + strItem;

                                               isFirst = false;

                               }

                               return "\"" + retStr + "\"";

                }

 

De : unitex-...@googlegroups.com [mailto:unitex-...@googlegroups.com] De la part de Olivier GRACIANNE
Envoyé : mardi 26 février 2019 17:34


À : Unitex-GramLab
Objet : Re: [Unitex-GramLab] Using Unitex JNI

 

This is 'hwo to use' documentation. I would to have a 'how it is made' doc too. Is there one ?

 

By the way, I couldn't find the description of the function 'combineUnitexFileComponentWithQuote', used in the demo, in the documentation you gave me (https://unitex-library.readthedocs.io/en/latest/). Did I miss it or is there an other doc ?

 

Thanks a lot for your help !.

--
You received this message because you are subscribed to the Google Groups "Unitex-GramLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unitex-gramla...@googlegroups.com.
To post to this group, send email to unitex-...@googlegroups.com.
Visit this group at https://groups.google.com/group/unitex-gramlab.

Olivier GRACIANNE

unread,
Feb 27, 2019, 4:44:27 AM2/27/19
to Unitex-GramLab
Thanks a lot for your help and for the resources. You  did gain me a precious time.

I'll may need to have a look deep in the code implementing the VFS layer. So my last question is : do you know where I can find a deeply explained documentation of it, or where I can find the code itself (couldn't find it out yet digging in my Unitex src folder) ?

Olivier GRACIANNE

unread,
Mar 1, 2019, 11:20:42 AM3/1/19
to Unitex-GramLab
Bonjour

Je reviens vers ce forum car je fais face actuellement à un bug que je ne parviens ni à expliquer ni à solutionner.

L'utilisation de la couche VFS de la JNI passe par l'appel à la fonction `unitexAbstractPathExists('path")` pour connaître le préfixe d'adressage du VFS.

Toutefois cet appel lève une exception de type `UnsatisfiedLinkError`. J'ai consulté le code source, la fonction C++ est bel et bien présente et correctement nommé (pour être adressée à travers une JNI), ce qui est indiqué comme étant les premières sources d'erreur de ce genre.
De plus, je sais que la librairie dynamique est correctement chargée, quand le jar de la JNI est référencé (j'ai forcé le référencement en faisant un `Class.forName("fr.umlv.unitex.jni.UnitexJni")` qui ne pose aucun soucis mais n'a rien changé à mon problème initial).

Toute idée pouvant m'aider à trouver une solution est la bienvenue, et je vous remercie d'avance pour votre aide.

Gilles Vollant

unread,
Mar 2, 2019, 2:38:14 AM3/2/19
to Olivier GRACIANNE, Unitex-GramLab

Cette fonction est bien présente dans les sources jni au même titre que les autres

 

UnitexLibAndJni\fr_umlv_unitex_jni_UnitexJni.h

UnitexLibAndJni\fr_umlv_unitex_jni_UnitexJni.cpp

UnitexLibAndJni\fr\umlv\unitex\jni\UnitexJni.java

 

Que donnent les autres fonctions ?

 

Par contre, je n’ai pas d’experience avec un .jar, j’ai toujours utilisé directement le .so / .dylib / .dll de la jni

 

De : unitex-...@googlegroups.com [mailto:unitex-...@googlegroups.com] De la part de Olivier GRACIANNE
Envoyé : vendredi 1 mars 2019 17:21


À : Unitex-GramLab
Objet : Re: [Unitex-GramLab] Using Unitex JNI

 

Bonjour

--

You received this message because you are subscribed to the Google Groups "Unitex-GramLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unitex-gramla...@googlegroups.com.
To post to this group, send email to unitex-...@googlegroups.com.
Visit this group at https://groups.google.com/group/unitex-gramlab.

Olivier GRACIANNE

unread,
Mar 5, 2019, 6:47:03 AM3/5/19
to Unitex-GramLab
Problème résolu. Mon problème venait de ma mécompréhension du référencement du .jar.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages