This directory contains example code that illustrate how to use the UIMA C++ Framework.
cd $UIMACPP_HOME/examples
make -C src -f all.mak
export LD_LIBRARY_PATH=`pwd`/src:$LD_LIBRARY_PATH
export PATH=`pwd`/src:$PATH
cd %UIMACPP_HOME%\examples
devenv src\uimacpp-examples.sln /build release
export PATH=%CD%\src;$PATH
These components can be run using either in the native C++ environment using the runAECpp
program or run from Java using the runAE
utility or integrated into a CPE. The UIMA C++ descriptors are located in the descriptors subdirectory.
DaveString
, that specifies the string to match. It illustrates how to use the CAS APIs to create annotations and add them to the index.
To run this annotator in C++:
runAECpp descriptors/DaveDetector.xml data/example.txt <yourOutputDir>
runAECpp -xmi descriptors/DaveDetector.xml data/tcas.xmi <yourOutputDir>
runAECpp -xmi descriptors/DaveDetector.xml data/sofa.xmi <yourOutputDir> -s EnglishDocument
runAECpp -xmi descriptors/SofaExampleAnnotator.xml data/sofa.xmi <yourOutputDir>
sofastreamhandler.hpp
to provide stream access to data located using the file:
URI scheme. It enables a UIMA component to access remote Sofa data referenced with a file:
URI.
This example may be used as a model for building handlers for custom URI schemes.
The shared library SofaStreamHandlerFile
must be registered with the framework as follows:
set UIMACPP_STREAMHANDLERS=file:SofaStreamHandlerFile %UIMACPP_STREAMHANDLERS%
export UIMACPP_STREAMHANDLERS="file:SofaStreamHandlerFile $UIMACPP_STREAMHANDLERS"
Handlers for several URI schemes may be registered separated by a blank. There can be only one handler per URI scheme.
SofaDataAnnotator
described below illustrates reading Sofa data as a stream.
runAECpp -xmi descriptors/SofaDataAnnotator.xml data/sofa.xmi <yourOutputDir>
file:
URL, register the example sofaStreamFileHandler
handler for the file
URI scheme as described in the section above. and run:
runAECpp -xmi descriptors/SofaDataAnnotator.xml data/filetcas.xmi <yourOutputDir>
SimpleTextSegmenter
breaks down the input document into segments based on a delimiter and creates a Sofa for each segment in a new CAS. The delimiter to use can be specified by setting the value of the configuration parameter DelimiterString
in the descriptor.
To run this annotator in C++:
runAECpp -xmi descriptors/SimpleTextSegmenter.xml data/docforsegmenter.xmi <yourOutputDir>
OutputDirectory
. The XCasWriterCasConsumer
can be inserted at any point in a aggregate or CPE flow to dump the contents of CAS and is useful for debugging.
To run this annotator in C++:
runAECpp -xmi descriptors/XCasWriterCasConsumer.xml data/tcas.xmi <yourOutputDir>
runAECpp -xmi descriptors/XCasWriterCasConsumer.xml data/sofa.xmi <yourOutputDir>
runAECpp -xmi descriptors/XCasWriterCasConsumer.xml <yourOutputDir>/tcas.xmi
runAECpp -xmi descriptors/XCasWriterCasConsumer.xml <yourOutputDir>/sofa.xmi
runAECpp -xmi descriptors/XCasWriterCasConsumer.xml <yourOutputDir>/filetcas.xmi
ExampleApplication descriptors/DaveDetector.xml data
SofaExampleApplication descriptors/SofaExampleAnnotator.xml