Search in sources :

Example 1 with NamedEntity

use of zemberek.ner.NamedEntity in project zemberek-nlp by ahmetaa.

the class UseNer method main.

public static void main(String[] args) throws IOException {
    // assumes you generated a model in my-model directory.
    Path modelRoot = Paths.get("my-model");
    TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
    PerceptronNer ner = PerceptronNer.loadModel(modelRoot, morphology);
    String sentence = "Ali Kaan yarın İstanbul'a gidecek.";
    NerSentence result = ner.findNamedEntities(sentence);
    List<NamedEntity> namedEntities = result.getNamedEntities();
    for (NamedEntity namedEntity : namedEntities) {
        System.out.println(namedEntity);
    }
}
Also used : Path(java.nio.file.Path) NerSentence(zemberek.ner.NerSentence) NamedEntity(zemberek.ner.NamedEntity) PerceptronNer(zemberek.ner.PerceptronNer) TurkishMorphology(zemberek.morphology.TurkishMorphology)

Aggregations

Path (java.nio.file.Path)1 TurkishMorphology (zemberek.morphology.TurkishMorphology)1 NamedEntity (zemberek.ner.NamedEntity)1 NerSentence (zemberek.ner.NerSentence)1 PerceptronNer (zemberek.ner.PerceptronNer)1