Example #1
0
 public static Tagger getNamePartTagger(String nerModel, String partModel) {
   Properties p = new Properties();
   p.put("namePartModelFileName", partModel);
   p.put("modelFileName", nerModel);
   BasicNERTagger t0 = new BasicNERTagger(p);
   NamePartTagger t1 = new NamePartTagger(p);
   // t0.loadModel(nerModel);
   // t1.loadModel(partModel);
   ChainOfTaggers t = new ChainOfTaggers();
   t.addTagger(t0);
   t.addTagger(t1);
   return t;
 }
Example #2
0
 public static void main(String[] args) {
   String nerModel = args[0];
   String partModel = args[1];
   Properties p = new Properties();
   p.put("namePartModelFileName", partModel);
   p.put("modelFileName", nerModel);
   BasicNERTagger t0 = new BasicNERTagger(p);
   NamePartTagger t1 = new NamePartTagger(p);
   // t0.loadModel(nerModel);
   // t1.loadModel(partModel);
   ChainOfTaggers t = new ChainOfTaggers();
   t.addTagger(t0);
   t.addTagger(t1);
   SimpleCorpus c = new SimpleCorpus(args[2], BasicNERTagger.defaultAttributeNames);
   Corpus tagged = t.tag(c);
   for (Context tc : tagged.enumerate()) {
     System.out.println(
         tc.getAttributeAt("word", 0)
             + "\t"
             + tc.getAttributeAt("tag", 0)
             + "\t"
             + tc.getAttributeAt("namePartTag", 0));
   }
 }