Examples of DictionaryAnnotatorConfigException


Examples of org.apache.uima.annotator.dict_annot.impl.DictionaryAnnotatorConfigException

      // parse the dictionary file and extract the content
      DictionaryDocument dictionaryDoc;
      try {
         dictionaryDoc = DictionaryDocument.Factory.parse(dictionaryFile);
      } catch (Exception ex) {
         throw new DictionaryAnnotatorConfigException(
               "dictionary_annotator_error_parsing_dictionary_file",
               new Object[] { dictionaryFile.getAbsolutePath() }, ex);
      }

      // get dictionary document
View Full Code Here

Examples of org.apache.uima.annotator.dict_annot.impl.DictionaryAnnotatorConfigException

      // parse the dictionary file and extract the content
      DictionaryDocument dictionaryDoc;
      try {
         dictionaryDoc = DictionaryDocument.Factory.parse(dictionaryFileStream);
      } catch (Exception ex) {
         throw new DictionaryAnnotatorConfigException(
               "dictionary_annotator_error_parsing_dictionary_file",
               new Object[] { dictionaryFilePath }, ex);
      }

      // validate input file
      ArrayList<XmlError> validationErrors = new ArrayList<XmlError>();
      XmlOptions validationOptions = new XmlOptions();
      validationOptions.setErrorListener(validationErrors);

      boolean isValid = dictionaryDoc.validate(validationOptions);

      // output the errors if the XML is invalid.
      if (!isValid) {
         Iterator<XmlError> iter = validationErrors.iterator();
         StringBuffer errorMessages = new StringBuffer();
         while (iter.hasNext()) {
            errorMessages.append("\n>> ");
            errorMessages.append(iter.next());
         }
         throw new DictionaryAnnotatorConfigException(
               "dictionary_annotator_error_xml_validation", new Object[] {
                     dictionaryFilePath, errorMessages.toString() });
      }

      // get dictionary document
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.