Package org.apache.uima.analysis_engine.annotator

Examples of org.apache.uima.analysis_engine.annotator.AnnotatorConfigurationException


        scopes.add(new Integer(RIGHT_SCOPE));
      } else if (scopeStrings[i].equals("ALL")) {
        scopes.add(new Integer(ALL_SCOPE));
      } else {
        Exception e = new Exception("Invalid scope value: " + scopeStrings[i]);
        throw new AnnotatorConfigurationException(e);
      }
    }
    iv_logger.info("SCOPE ORDER: " + scopes);
  }
View Full Code Here


         indexDirAbsPath = indexDir.getAbsolutePath();

         try {
            logger.info( "Using lucene index: " + indexDir.getAbsolutePath() );
         } catch ( Exception e ) {
            throw new AnnotatorConfigurationException( e );
         }

         // For the sample dictionary, we use the following lucene index.
         //indexPath = "lookup/snomed-like_codes_sample";
View Full Code Here

    try {
      // read annotator name from configuration parameter 'AnnotatorName'
      this.name = secureGetConfigParameterValue(context, "AnnotatorName", "defaultName");
    } catch (AnnotatorContextException e) {
      throw new AnnotatorConfigurationException(e);
    }

  }
View Full Code Here

    try {
      String[] mappingStrings = null;

      mappingStrings = (String[]) aContext.getConfigParameterValue(MAPPINGS_PARAM);
      if (mappingStrings == null) {
        throw new AnnotatorConfigurationException();
      }
      loadMappings(mappingStrings);

      String modelDirName = (String) aContext.getConfigParameterValue(MODEL_DIR_PARAM);

      File modelDir = new File(modelDirName);
      if (!modelDir.isDirectory()) {
        throw new AnnotatorConfigurationException();
      }
      File[] modelFiles = modelDir.listFiles(new modelFileFilter());
      numNefs = modelFiles.length;
      nameFinders = new NameFinder[numNefs];
      nameFinderLabels = new String[numNefs];
      neAnnotationMakers = new Constructor[numNefs];
      for (int i = 0; i < numNefs; i++) {
        String modelName = modelFiles[i].getName();
        System.out.print("Loading model: " + modelName + "...");
        nameFinders[i] = new NameFinder(new SuffixSensitiveGISModelReader(modelFiles[i]).getModel());
        int nameStart = modelName.lastIndexOf(System.getProperty("file.separator")) + 1;
        int nameEnd = modelName.indexOf('.', nameStart);
        if (nameEnd == -1) {
          nameEnd = modelName.length();
        }
        nameFinderLabels[i] = modelName.substring(nameStart, nameEnd);
        Constructor annotationMaker;
        if ((annotationMaker = (Constructor) labelMap.get(nameFinderLabels[i])) == null) {
          throw new AnnotatorConfigurationException();
        }
        neAnnotationMakers[i] = annotationMaker;
        System.out.println("done");
      }
View Full Code Here

    // populate the mappings hash table (key: entity label,CAS Annotation Type
    // Constructor)
    for (int i = 0; i < mappingStrings.length; i++) {
      String[] mappingPair = mappingStrings[i].split(",");
      if (mappingPair.length < 2)
        throw new AnnotatorConfigurationException();

      String modelName = mappingPair[0];
      String className = mappingPair[1];

      Constructor annotationConstructor;
      // get the name of the JCAS type with this name
      Class annotationClass;
      try {
        annotationClass = Class.forName(className);
        // get the constructor for that JCAS type
        annotationConstructor = annotationClass.getConstructor(new Class[] { JCas.class });
      } catch (Exception e) {
        throw new AnnotatorConfigurationException(e);
      }
      labelMap.put(modelName, annotationConstructor);
    }
  }
View Full Code Here

    try {
      String[] mappingStrings = null;

      mappingStrings = (String[]) aContext.getConfigParameterValue(MAPPINGS_PARAM);
      if (mappingStrings == null) {
        throw new AnnotatorConfigurationException();
      }
      loadMappings(mappingStrings);

      String modelDirName = (String) aContext.getConfigParameterValue(MODEL_DIR_PARAM);

      File modelDir = new File(modelDirName);
      if (!modelDir.isDirectory()) {
        throw new AnnotatorConfigurationException();
      }

      // set parameter defaults
      boolean useTagDictionary = false;
      boolean caseSensitiveTagDictionary = false;
View Full Code Here

    // populate the mappings hash table (key: parse tag,CAS Annotation Type
    // Constructor)
    for (int i = 0; i < mappingStrings.length; i++) {
      String[] mappingPair = mappingStrings[i].split(",");
      if (mappingPair.length < 2)
        throw new AnnotatorConfigurationException();

      String parseTag = mappingPair[0];
      String className = mappingPair[1];

      Constructor annotationConstructor;
      // get the name of the JCAS type with this name
      Class annotationClass;
      try {
        annotationClass = Class.forName(className);
        // get the constructor for that JCAS type
        annotationConstructor = annotationClass.getConstructor(new Class[] { JCas.class });
      } catch (Exception e) {
        throw new AnnotatorConfigurationException(e);
      }
      parseTagMap.put(parseTag, annotationConstructor);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.analysis_engine.annotator.AnnotatorConfigurationException

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.