Reading Pos Tag Models In Android
I have tried doing POS tagging using openNLP POS Models on a normal Java application. Now I would like to implement it on Android platform. I am not sure what is the Android requir
Solution 1:
For what it's worth, if this is still an issue: I had a similar issue attempting to use the POS model in a different context (non-Android), and in my case it appeared to be the extraction failing from the bin file, not anything with the model itself. It appears to be local to the tags.tagdict file in the archive (as suggested here http://sharpnlp.codeplex.com/discussions/263620), so if you don't need that currently (and I didn't for my simple scenarios) then try removing it from the archive. (But leave the archive intact as it's expected to arrive in zip'd form.)
Solution 2:
Try this, it worked for me
System.setProperty("org.xml.sax.driver", "org.xmlpull.v1.sax2.Driver");
try {
AssetFileDescriptorfileDescriptor=
context.getAssets().openFd("en_pos_maxent.bin");
FileInputStreaminputStream= fileDescriptor.createInputStream();
POSModelposModel=newPOSModel(inputStream);
posTaggerME = newPOSTaggerME(posModel);
} catch (Exception e) {}
Post a Comment for "Reading Pos Tag Models In Android"