Package edu.stanford.nlp.ie

Examples of edu.stanford.nlp.ie.AbstractSequenceClassifier


      for(int j = 2; j < args.length; j++) {
    classifierMods[j-2] = args[j].trim();
      }

      int numClassifiers = 0;
      AbstractSequenceClassifier classifier = null; //CRFClassifier.getClassifierNoExceptions(serializedClassifier);
      for(String classMod : classifierMods) { if(classMod != null) { numClassifiers++; } }
      switch (numClassifiers) {
          case 1:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0]);
        break;
          case 2:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1]);
        break;
          case 3:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1], classifierMods[2]);
        break;
          case 4:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1], classifierMods[2], classifierMods[3]);
        break;
          case 5:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1], classifierMods[2], classifierMods[3], classifierMods[4]);
        break;
          case 6:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1], classifierMods[2], classifierMods[3], classifierMods[4],
                 classifierMods[5]);
        break;
          case 7:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1], classifierMods[2], classifierMods[3], classifierMods[4],
                 classifierMods[5], classifierMods[6]);
        break;
          case 8:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1], classifierMods[2], classifierMods[3], classifierMods[4],
                 classifierMods[5], classifierMods[6], classifierMods[7]);
        break;
          case 9:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1], classifierMods[2], classifierMods[3], classifierMods[4],
                 classifierMods[5], classifierMods[6], classifierMods[7], classifierMods[8]);
        break;
          case 10:
        classifier = new NERClassifierCombiner(true, false, classifierMods[0], classifierMods[1], classifierMods[2], classifierMods[3], classifierMods[4],
                 classifierMods[5], classifierMods[6], classifierMods[7], classifierMods[8], classifierMods[9]);
        break;
          default:
        System.out.println(usageStr);
        System.exit(-1);
      }



      Iterable<String> sents = IOUtils.readLines(args[0]);
      BufferedWriter outf = new BufferedWriter(new FileWriter(new File(args[1])));

      for (String sent : sents) {
          String[] parts = sent.split("\\s+");
          List<HasWord> wdList = new ArrayList<HasWord>(parts.length);
          for(String w : parts) {
              wdList.add(new MyWord(w));
          }
          List<CoreMap> tagging = classifier.classifySentence(wdList);
          String currNE = null;
          StringBuilder res = new StringBuilder();

          String wd, annot;
          int cursor = -1;
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.ie.AbstractSequenceClassifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.