Examples of DictionaryFileParser


Examples of org.apache.uima.annotator.dict_annot.dictionary.DictionaryFileParser

               MESSAGE_DIGEST, "dictionary_annotator_filter_feature_condition",
               new Object[] { buffer.toString() });
      }

      // create dictionary file parser
      DictionaryFileParser fileParser = new DictionaryFileParserImpl();

      // get UIMA datapath and tokenize it into its elements
      StringTokenizer tokenizer = new StringTokenizer(getContext()
            .getDataPath(), PATH_SEPARATOR);
      ArrayList<File> datapathElements = new ArrayList<File>();
      while (tokenizer.hasMoreTokens()) {
         // add datapath elements to the 'datapathElements' array list
         datapathElements.add(new File(tokenizer.nextToken()));
      }

      // parse dictionary files
      ArrayList<Dictionary> dicts = new ArrayList<Dictionary>();
      for (int i = 0; i < dictionaryFileNames.length; i++) {
         // try to resolve the relative file name with classpath or datapath
         DictionaryFile file = resolveRelativeFilePath(dictionaryFileNames[i],
               datapathElements);

         // if the current dictionary file wasn't found, throw an exception
         if (file == null) {
            throw new DictionaryAnnotatorConfigException(
                  "dictionary_annotator_resource_not_found",
                  new Object[] { dictionaryFileNames[i] });
         } else {
            // log concept file path
            this.logger.logrb(Level.CONFIG, "DictionaryAnnotator",
                  "initialize", MESSAGE_DIGEST,
                  "dictionary_annotator_dictionary_file", new Object[] { file
                        .getFilePath() });

            // parse dictionary file
            Dictionary dict = fileParser.parseDictionaryFile(
                  file.getFilePath(), file.getStream(), new HashMapDictionaryBuilder());
            // add dictionary to the dictionary list
            dicts.add(dict);
         }
      }
View Full Code Here

Examples of org.apache.uima.annotator.dict_annot.dictionary.DictionaryFileParser

      this.logger.logrb(Level.CONFIG, "DictionaryAnnotator", "initialize", MESSAGE_DIGEST,
              "dictionary_annotator_filter_feature_condition", new Object[] { buffer.toString() });
    }

    // create dictionary file parser
    DictionaryFileParser fileParser = new DictionaryFileParserImpl();

    // get UIMA datapath and tokenize it into its elements
    StringTokenizer tokenizer = new StringTokenizer(getContext().getDataPath(), PATH_SEPARATOR);
    ArrayList<File> datapathElements = new ArrayList<File>();
    while (tokenizer.hasMoreTokens()) {
      // add datapath elements to the 'datapathElements' array list
      datapathElements.add(new File(tokenizer.nextToken()));
    }

    // parse dictionary files
    ArrayList<Dictionary> dicts = new ArrayList<Dictionary>();
    for (int i = 0; i < dictionaryFileNames.length; i++) {
      // try to resolve the relative file name with classpath or datapath
      DictionaryFile file = resolveRelativeFilePath(dictionaryFileNames[i], datapathElements);

      // if the current dictionary file wasn't found, throw an exception
      if (file == null) {
        throw new DictionaryAnnotatorConfigException("dictionary_annotator_resource_not_found",
                new Object[] { dictionaryFileNames[i] });
      } else {
        // log concept file path
        this.logger.logrb(Level.CONFIG, "DictionaryAnnotator", "initialize", MESSAGE_DIGEST,
                "dictionary_annotator_dictionary_file", new Object[] { file.getFilePath() });

        // parse dictionary file
        Dictionary dict = fileParser.parseDictionaryFile(file.getFilePath(), file.getStream(),
                new HashMapDictionaryBuilder());
        // add dictionary to the dictionary list
        dicts.add(dict);
      }
    }
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.