I want to use the Stanford POS-tagger in my android project.
I added the pos-tagger .jar files to my android project in Android Studio:
I can import the library correctly:
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
But an error occurs when I use the function tagString:
MaxentTagger tagger = new MaxentTagger("model/english-left3words-distsim.tagger");
String tagged = tagger.tagString("Hello World");//--->>ERROR
Log.i("tags",tagged);
When compiling, I am getting the error:
Error:(34, 31) error: cannot access Function class file for java.util.function.Function not found Error:Execution failed for task
':app:compileDebugJavaWithJavac'. Compilation failed; see the compiler error output for details.
How can I use the stanford pos-tagger in my Android project correctly?
Are you compiling with Java 8? Recent versions of CoreNLP require Java 8; the error you're seeing is likely from the compiler not finding the newly introduced Function
class.