public class CTAKESUtils
extends java.lang.Object
CTAKESContentHandler
that relies on Apache cTAKES.
Apache cTAKES is built on top of Apache UIMA framework and OpenNLP toolkit.
Constructor and Description |
---|
CTAKESUtils() |
Modifier and Type | Method and Description |
---|---|
static AnalysisEngine |
getAnalysisEngine(java.lang.String aeDescriptor,
java.lang.String umlsUser,
java.lang.String umlsPass)
Returns a new UIMA Analysis Engine (AE).
|
static java.lang.String |
getAnnotationProperty(IdentifiedAnnotation annotation,
CTAKESAnnotationProperty property)
Returns the annotation value based on the given annotation type.
|
static JCas |
getJCas(AnalysisEngine ae)
Returns a new JCas () appropriate for the given Analysis Engine.
|
static void |
reset(AnalysisEngine ae,
JCas jcas)
Resets cTAKES objects, if created.
|
static void |
resetAE(AnalysisEngine ae)
Resets the AE (AnalysisEngine), releasing all resources held by the
current AE.
|
static void |
resetCAS(JCas jcas)
Resets the CAS (Common Analysis System), emptying it of all content.
|
static void |
serialize(JCas jcas,
CTAKESSerializer type,
boolean prettyPrint,
java.io.OutputStream stream)
Serializes a CAS in the given format.
|
public static AnalysisEngine getAnalysisEngine(java.lang.String aeDescriptor, java.lang.String umlsUser, java.lang.String umlsPass) throws java.io.IOException, InvalidXMLException, ResourceInitializationException, java.net.URISyntaxException
An Analysis Engine is a component responsible for analyzing unstructured information, discovering and representing semantic content. Unstructured information includes, but is not restricted to, text documents.
aeDescriptor
- pathname for XML file including an AnalysisEngineDescription
that contains all of the information needed to instantiate and
use an AnalysisEngine.umlsUser
- UMLS username for NLM databaseumlsPass
- UMLS password for NLM databasejava.io.IOException
- if any I/O error occurs.InvalidXMLException
- if the input XML is not valid or does not specify a valid
ResourceSpecifier.ResourceInitializationException
- if a failure occurred during production of the resource.java.net.URISyntaxException
- if URL of the resource is not formatted strictly according to
to RFC2396 and cannot be converted to a URI.public static JCas getJCas(AnalysisEngine ae) throws ResourceInitializationException
Important: It is highly recommended that you reuse CAS objects rather than creating new CAS objects prior to each analysis. This is because CAS objects may be expensive to create and may consume a significant amount of memory.
ae
- AnalysisEngine used to create an appropriate JCas object.ResourceInitializationException
- if a CAS could not be created because this AnalysisEngine's
CAS metadata (type system, type priorities, or FS indexes)
are invalid.public static void serialize(JCas jcas, CTAKESSerializer type, boolean prettyPrint, java.io.OutputStream stream) throws org.xml.sax.SAXException, java.io.IOException
jcas
- CAS (Common Analysis System) to be serialized.type
- type of cTAKES (UIMA) serializer used to write CAS.prettyPrint
- true
to do pretty printing of output.stream
- OutputStream
object used to print out information
extracted by using cTAKES.org.xml.sax.SAXException
- if there was a SAX exception.java.io.IOException
- if any I/O error occurs.public static java.lang.String getAnnotationProperty(IdentifiedAnnotation annotation, CTAKESAnnotationProperty property)
annotation
- IdentifiedAnnotation
object.property
- CTAKESAnnotationProperty
enum used to identify the
annotation type.public static void reset(AnalysisEngine ae, JCas jcas)
ae
- UIMA Analysis Enginejcas
- JCas objectpublic static void resetCAS(JCas jcas)
jcas
- JCas objectpublic static void resetAE(AnalysisEngine ae)
ae
- UIMA Analysis Engine"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"