Skip to content

Instantly share code, notes, and snippets.

@mahimrocky
Created December 12, 2018 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahimrocky/79dd44df006e795ea480ae004cd637d1 to your computer and use it in GitHub Desktop.
Save mahimrocky/79dd44df006e795ea480ae004cd637d1 to your computer and use it in GitHub Desktop.
Preparing and open token
public void openTokenzition() {
InputStream is;
TokenizerModel tm;
try {
is = getAssets().open("en-token.bin");
tm = new TokenizerModel(is);
tokenizer = new TokenizerME(tm);
} catch (IOException e) {
e.printStackTrace();
}
}
public void openNameFinder() {
InputStream is;
TokenNameFinderModel tokenNameFinderModel;
try {
is = getAssets().open("en-ner-person.bin");
tokenNameFinderModel = new TokenNameFinderModel(is);
nameFinderME = new NameFinderME(tokenNameFinderModel);
} catch (IOException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment