public class AnnotatorTester
extends java.lang.Object
| Constructor and Description |
|---|
AnnotatorTester(java.io.File descFile)
Constructor save the specified descriptor file path and initialize the
analysis engine.
|
AnnotatorTester(java.lang.String descFilePath)
Constructor save the specified descriptor file path and initialize the
analysis engine.
|
AnnotatorTester(java.lang.String descFilePath,
ResourceManager mgr)
Constructor save the specified descriptor file path and initialize the
analysis engine.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeDelegateParameterSetting(java.lang.String delegeteKey,
java.lang.String groupName,
java.lang.String paramName,
java.lang.Object paramValue)
change the parameter name for the given delegate analysis engine key
|
void |
changeParameterSetting(java.lang.String groupName,
java.lang.String paramName,
java.lang.Object paramValue)
change the parameter name for the given analysis engine
|
static void |
checkResult(CAS cas,
java.lang.String[] AnnotationTypes,
java.io.File refFile,
java.io.File testFile)
checkResult compares the analyzed document with the reference output.
|
CAS |
createCAS()
Creates a new fresh CAS instance which can be used for testing.
|
static AnalysisEngine |
doConfigurationTest(java.lang.String configDescFilePath)
does configuration parameter test
|
static CAS |
getCASfromXCAS(java.io.File tsFile,
java.io.File xcasFile)
create a CAS object from the given XCAS and typesystem files
|
CAS |
performTest(CAS cas)
performs a test on the initialized annotator.
|
CAS |
performTest(java.lang.String text,
java.lang.String language)
performs a test on the initialized annotator.
|
static CAS |
performTest(java.lang.String descFilePath,
java.lang.String text,
java.lang.String language)
performs a test with a special annotator configuration.
|
static java.lang.String |
readFileContent(java.io.File file,
java.lang.String encoding)
Reads the content form a file to a String with respect to the file
encoding.
|
public AnnotatorTester(java.lang.String descFilePath)
throws java.lang.Exception
descFilePath - descriptor file pathjava.lang.Exception - if an analysis engine initialize error occurs.public AnnotatorTester(java.io.File descFile)
throws java.lang.Exception
descFile - descriptor filejava.lang.Exception - if an analysis engine initialize error occurs.public AnnotatorTester(java.lang.String descFilePath,
ResourceManager mgr)
throws java.lang.Exception
descFilePath - descriptor file pathmgr - a ResourceManagerjava.lang.Exception - if an analysis engine initialize error occurs.public void changeParameterSetting(java.lang.String groupName,
java.lang.String paramName,
java.lang.Object paramValue)
throws ResourceConfigurationException
groupName - group name, if no group is available, pass nullparamName - parameter nameparamValue - parameter valueResourceConfigurationExceptionpublic void changeDelegateParameterSetting(java.lang.String delegeteKey,
java.lang.String groupName,
java.lang.String paramName,
java.lang.Object paramValue)
throws InvalidXMLException,
ResourceInitializationException,
java.io.IOException
delegeteKey - analysis engine keygroupName - group nameparamName - parameter nameparamValue - parameter valueInvalidXMLExceptionResourceInitializationExceptionjava.io.IOExceptionpublic static AnalysisEngine doConfigurationTest(java.lang.String configDescFilePath) throws java.lang.Exception
configDescFilePath - java.lang.Exceptionpublic CAS createCAS() throws java.lang.Exception
java.lang.Exceptionpublic CAS performTest(java.lang.String text, java.lang.String language) throws java.lang.Exception
text - a document textlanguage - the document text languagejava.lang.Exceptionpublic CAS performTest(CAS cas) throws java.lang.Exception
cas - a CAS for processingjava.lang.Exceptionpublic static CAS performTest(java.lang.String descFilePath, java.lang.String text, java.lang.String language) throws java.lang.Exception
descFilePath - Descriptor file pathtext - a document textlanguage - the document text languagejava.lang.Exceptionpublic static CAS getCASfromXCAS(java.io.File tsFile, java.io.File xcasFile) throws java.lang.Exception
tsFile - -
a typesystem filexcasFile - -
a xcas filejava.lang.Exceptionpublic static java.lang.String readFileContent(java.io.File file,
java.lang.String encoding)
throws java.lang.Exception
file - a file with the sourceencoding - file encodingjava.lang.Exceptionpublic static void checkResult(CAS cas, java.lang.String[] AnnotationTypes, java.io.File refFile, java.io.File testFile) throws java.lang.Exception
cas - a cas with the analyzed dataAnnotationTypes - respected annotation typesrefFile - reference outputtestFile - test file for the current outputjava.lang.ExceptionCopyright © 2013. All Rights Reserved.