public class AnnotatorTester extends Object
Constructor and Description |
---|
AnnotatorTester(File descFile)
Constructor save the specified descriptor file path and initialize the
analysis engine.
|
AnnotatorTester(String descFilePath)
Constructor save the specified descriptor file path and initialize the
analysis engine.
|
AnnotatorTester(String descFilePath,
ResourceManager mgr)
Constructor save the specified descriptor file path and initialize the
analysis engine.
|
Modifier and Type | Method and Description |
---|---|
void |
changeDelegateParameterSetting(String delegeteKey,
String groupName,
String paramName,
Object paramValue)
change the parameter name for the given delegate analysis engine key
|
void |
changeParameterSetting(String groupName,
String paramName,
Object paramValue)
change the parameter name for the given analysis engine
|
static void |
checkResult(CAS cas,
String[] AnnotationTypes,
File refFile,
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(String configDescFilePath)
does configuration parameter test
|
static CAS |
getCASfromXCAS(File tsFile,
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(String text,
String language)
performs a test on the initialized annotator.
|
static CAS |
performTest(String descFilePath,
String text,
String language)
performs a test with a special annotator configuration.
|
static String |
readFileContent(File file,
String encoding)
Reads the content form a file to a String with respect to the file
encoding.
|
public AnnotatorTester(String descFilePath) throws Exception
descFilePath
- descriptor file pathException
- passthru
if an analysis engine initialize error occurs.public AnnotatorTester(File descFile) throws Exception
descFile
- descriptor fileException
- passthru
if an analysis engine initialize error occurs.public AnnotatorTester(String descFilePath, ResourceManager mgr) throws Exception
descFilePath
- descriptor file pathmgr
- a ResourceManagerException
- if an analysis engine initialize error occurs.public void changeParameterSetting(String groupName, String paramName, Object paramValue) throws ResourceConfigurationException
groupName
- group name, if no group is available, pass nullparamName
- parameter nameparamValue
- parameter valueResourceConfigurationException
- passthrupublic void changeDelegateParameterSetting(String delegeteKey, String groupName, String paramName, Object paramValue) throws InvalidXMLException, ResourceInitializationException, IOException
delegeteKey
- analysis engine keygroupName
- group nameparamName
- parameter nameparamValue
- parameter valueInvalidXMLException
- passthruResourceInitializationException
- passthruIOException
- passthrupublic static AnalysisEngine doConfigurationTest(String configDescFilePath) throws Exception
configDescFilePath
- Exception
- passthrupublic CAS createCAS() throws Exception
Exception
- passthrupublic CAS performTest(String text, String language) throws Exception
text
- a document textlanguage
- the document text languageException
- passthrupublic CAS performTest(CAS cas) throws Exception
cas
- a CAS for processingException
- passthrupublic static CAS performTest(String descFilePath, String text, String language) throws Exception
descFilePath
- Descriptor file pathtext
- a document textlanguage
- the document text languageException
- passthrupublic static CAS getCASfromXCAS(File tsFile, File xcasFile) throws Exception
tsFile
- -
a typesystem filexcasFile
- -
a xcas fileException
- passthrupublic static String readFileContent(File file, String encoding) throws Exception
file
- a file with the sourceencoding
- file encodingException
- passthrupublic static void checkResult(CAS cas, String[] AnnotationTypes, File refFile, File testFile) throws Exception
cas
- a cas with the analyzed dataAnnotationTypes
- respected annotation typesrefFile
- reference outputtestFile
- test file for the current outputException
- passthruCopyright © 2006–2023 The Apache Software Foundation. All rights reserved.