Package org.apache.uima.util

Examples of org.apache.uima.util.XMLParser


  }

  public static AnalysisEngine getAE(File analysisEngineDescriptorFile) throws ResourceInitializationException {
    try {
      XMLInputSource xmlInputSource = new XMLInputSource(analysisEngineDescriptorFile);
      XMLParser xmlParser = UIMAFramework.getXMLParser();
      ResourceSpecifier resourceSpecifier = xmlParser.parseResourceSpecifier(xmlInputSource);
      AnalysisEngine analysisEngine = UIMAFramework.produceAnalysisEngine(resourceSpecifier);
      return analysisEngine;
    } catch (IOException ioe) {
      throw new ResourceInitializationException(ioe);
    } catch (InvalidXMLException ixe) {
View Full Code Here


  }

  public static CollectionReader getCR(File collectionReaderDescriptorFile) throws ResourceInitializationException {
    try {
      XMLInputSource xmlInputSource = new XMLInputSource(collectionReaderDescriptorFile);
      XMLParser xmlParser = UIMAFramework.getXMLParser();
      ResourceSpecifier resourceSpecifier = xmlParser.parseResourceSpecifier(xmlInputSource);
      CollectionReader collectionReader = UIMAFramework.produceCollectionReader(resourceSpecifier);
      return collectionReader;
    } catch (IOException ioe) {
      throw new ResourceInitializationException(ioe);
    } catch (InvalidXMLException ixe) {
View Full Code Here

import java.io.IOException;

public class ConvertXMIAssertionsToi2b2Format {

  private static CAS getTypeSystemFromDescriptor(String descriptor) throws InvalidXMLException, IOException, ResourceInitializationException, CASException {
    XMLParser xmlParser = UIMAFramework.getXMLParser();
    AnalysisEngineDescription tsDesc = xmlParser.parseAnalysisEngineDescription(new XMLInputSource(descriptor));
    return CasCreationUtils.createCas(tsDesc);
  }
View Full Code Here

public class Converti2b2AnnotationsToCTAKES {
  private static Logger logger = Logger.getLogger(Converti2b2AnnotationsToCTAKES.class);
 
  private static CAS getTypeSystemFromDescriptor(String descriptor) throws InvalidXMLException, IOException, ResourceInitializationException, CASException {
    XMLParser xmlParser = UIMAFramework.getXMLParser();
    AnalysisEngineDescription tsDesc = xmlParser.parseAnalysisEngineDescription(new XMLInputSource(descriptor));
    return CasCreationUtils.createCas(tsDesc);
  }
View Full Code Here

      // load the text from the URI, run the preprocessor, then run the
      // Knowtator XML reader
      AggregateBuilder builder = new AggregateBuilder();
      builder.add(UriToDocumentTextAnnotator.getDescription());
      File preprocessDescFile = new File("desc/analysis_engine/RelationExtractorPreprocessor.xml");
      XMLParser parser = UIMAFramework.getXMLParser();
      XMLInputSource source = new XMLInputSource(preprocessDescFile);
      builder.add(parser.parseAnalysisEngineDescription(source));
      builder.add(AnalysisEngineFactory.createPrimitiveDescription(
          ViewCreatorAnnotator.class,
          ViewCreatorAnnotator.PARAM_VIEW_NAME,
          GOLD_VIEW_NAME));
      builder.add(AnalysisEngineFactory.createPrimitiveDescription(CopyDocumentTextToGoldView.class));
View Full Code Here

            descriptorsDirectory);

    // create the aggregate
    System.err.println("Assembling relation extraction aggregate");
    AggregateBuilder builder = new AggregateBuilder();
    XMLParser parser = UIMAFramework.getXMLParser();
    XMLInputSource source = new XMLInputSource(preprocessDescFile);
    builder.add(parser.parseAnalysisEngineDescription(source));
    builder.add(modifierExtractorDesc);
    builder.add(degreeOfRelationExtractorDesc);
    builder.add(locationOfRelationExtractorDesc);
    AnalysisEngineDescription aggregateDescription = builder.createAggregateDescription();
    writeDesc(descriptorsDirectory, "RelationExtractorAggregate", aggregateDescription);
View Full Code Here

   * @throws IOException
   * @throws InvalidXMLException
   */
  public static AnalysisEngineDescription loadDescription(String pathToDescription) throws IOException, InvalidXMLException {
    File file = new File(pathToDescription);
    XMLParser parser = UIMAFramework.getXMLParser();
    XMLInputSource source = new XMLInputSource(file);
    AnalysisEngineDescription desc = parser.parseAnalysisEngineDescription(source);
    return desc;
  }
View Full Code Here

  private static AnalysisEngineDescription findDescription(
      Class<? extends JCasAnnotator_ImplBase> cls) throws Exception {
    File directory = new File("desc/analysis_engine");
    File file = new File(directory, cls.getSimpleName() + ".xml");
    XMLParser parser = UIMAFramework.getXMLParser();
    XMLInputSource source = new XMLInputSource(file);
    return parser.parseAnalysisEngineDescription(source);
  }
View Full Code Here

   * test will most likely fail and will need to be updated.  There's an unused method below that
   * can be used to write a new set of POS tags when the old ones become obsolete.
   */
  public void testMobyDick() {
    try {
      XMLParser xmlParser = UIMAFramework.getXMLParser();
      XMLInputSource xmlInputSource = new XMLInputSource("desc/HmmTaggerAggregate.xml");
      AnalysisEngine taggerEngine = UIMAFramework.produceAnalysisEngine(xmlParser
          .parseResourceSpecifier(xmlInputSource));
      String text = null;
      try {
        text = FileUtils.file2String(new File("../uimaj-core/src/test/resources/data/moby.txt"),
            "utf-8");
View Full Code Here

    // }

  }

  private static final JCas createTestCas() {
    XMLParser parser = UIMAFramework.getXMLParser();
    File descriptorFile = JUnitExtension.getFile("desc/simpleServerTestDescriptor.xml");
    File textFile = JUnitExtension.getFile("test.txt");
    String text = null;
    try {
      text = FileUtils.file2String(textFile, "utf-8");
    } catch (IOException e1) {
      e1.printStackTrace();
      assertTrue(false);
    }
    AnalysisEngineDescription aeDesc = null;
    try {
      aeDesc = (AnalysisEngineDescription) parser.parse(new XMLInputSource(descriptorFile));
    } catch (InvalidXMLException e) {
      e.printStackTrace();
      assertTrue(false);
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.uima.util.XMLParser

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.