borexxx / simplenlg

Automatically exported from code.google.com/p/simplenlg
0 stars 0 forks source link

Initialising simplenlg takes very long time (factory, lexicon, realiser) @ Android #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. initiate factory, lexicon, realiser), like this:
        lexicon = new XMLLexicon();
        factory = new NLGFactory(lexicon); 
        realiser = new Realiser();

at least on Android 2.3+ (tablet or mobile) it will take about 10-20 seconds

What version of the product are you using? On what operating system?
2. I use simpleNLG 4.2 French  modification

3. It would be very helpful to be able to save the state (on of solutions would 
require implementing Parcelable, that don't seem to be super straightforward on 
complex data structures) and load it again directly into memory or to have the 
performance improved.

Original issue reported on code.google.com by Vidmanta...@gmail.com on 17 Dec 2011 at 10:03

GoogleCodeExporter commented 8 years ago
SimpleNLG hasn't yet been tested on mobile platforms. The delay is likely due 
to the size of the lexicon file (the xml lexicon) which is loaded into memory. 
If you're using the French modification, however, it would probably be best to 
contact the developer for that version first, because the French simpleNLG is 
still under development and doesn't yet form part of the main simpleNLG package.

Original comment by bertug...@gmail.com on 2 Jan 2012 at 11:31

GoogleCodeExporter commented 8 years ago
by rewiting the lexicon loading into XmlPull I was able to obtain around 30% 
increase in performance and that decreased the memory use greatly too.

If one is interested you could find the mod: 
https://github.com/vidma/aac-speech-android/blob/master/source/libs/simplenlg/le
xicon/XMLLexiconFast.java inherit this class and for french use 
https://github.com/vidma/aac-speech-android/blob/master/source/libs/simplenlg/le
xicon/french/XMLLexiconFast.java as main lexicon class

However, the other 70% is due to loading of specific word forms/variants (for 
both english/french lexicons, based on simplenlg 4.2).

Original comment by Vidmanta...@gmail.com on 7 Feb 2012 at 3:54

GoogleCodeExporter commented 8 years ago
How do you make simpleNLG work on android?
I do make one small android app and put simplenlg libraries.
But it didn't work.
I just keep getting failure message of initializing.
Please Tell me how were you doing that.

Original comment by yours...@gmail.com on 2 Jan 2014 at 11:55

GoogleCodeExporter commented 8 years ago
first, I'm using a bilingual French+English fork of simplenlg with minor 
modifications of mine (to improve the loading speed/reduce memory usage).

https://github.com/vidma/aac-speech-android/tree/master/source/libs/simplenlg

you can see how it's used here: 
https://github.com/vidma/aac-speech-android/blob/master/source/src/com/epfl/andr
oid/aac_speech/nlg/Pic2NLG.java#L45

you shall use the debugging (catlog etc) so see the actual cause... it's quite 
probable that new simplenlg (plus your app) uses more RAM than old android 
could provide, or whatever... 
all I know this fork is working fine, and the loading time is not to long.

if you hit RAM issue really hard, you could consider creating a separate 
service accepting intents from the main app to perform simplenlg related tasks 
and returning text.

Original comment by Vidmanta...@gmail.com on 2 Jan 2014 at 12:21