public abstract class JavaCustomSemanticProcessor extends CustomDocumentProcessor
Modifier and Type | Class and Description |
---|---|
static class |
JavaCustomSemanticProcessor.InvalidAnnotationException
Exception thrown when a malformed annotation is pushed to the semantic pipe.
|
static class |
JavaCustomSemanticProcessor.InvalidTokenException
Exception thrown when a malformed token is pushed to the semantic pipe.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.HashSet<java.lang.String> |
contexts |
protected java.util.HashSet<java.lang.Integer> |
languages |
Constructor and Description |
---|
JavaCustomSemanticProcessor(CVComponentConfig config) |
Modifier and Type | Method and Description |
---|---|
protected void |
addDocumentAnnotation(Annotation annotation)
Attach an annotation to the currently processed document
|
abstract java.lang.String[] |
declareAnnotations()
Called at initialization to retrieve the annotation tags that are planned to be used during processing.
|
abstract void |
endDocument()
Called when there is no more input to process in the current document.
|
protected AnnotatedToken |
getNextToken()
Pump the next token from the input stream.
|
Referential |
getReferential() |
void |
init(MOTPipe p) |
protected Annotation |
newAnnotation(java.lang.String tag,
java.lang.String displayForm,
int nbTokens)
Allocate a new annotation with the provided tag, value and length.
|
abstract void |
newDocument()
Called when a new document is about to get processed.
|
void |
process(DocumentProcessingContext dContext,
ProcessableDocument doc)
Process a document.
|
abstract void |
processChunk(java.lang.String chunk,
int language,
java.lang.String context)
Called when a new input chunk is to be processed.
|
protected void |
pushToken(AnnotatedToken token)
Send a token to the output stream.
|
void |
release()
Called at end of analysis job
|
void |
setInputContexts(java.util.Collection<java.lang.String> c) |
getCondition, init, setCondition
protected java.util.HashSet<java.lang.Integer> languages
protected java.util.HashSet<java.lang.String> contexts
public JavaCustomSemanticProcessor(CVComponentConfig config) throws java.lang.Exception
java.lang.Exception
public abstract void newDocument()
public abstract void endDocument()
public abstract java.lang.String[] declareAnnotations()
public abstract void processChunk(java.lang.String chunk, int language, java.lang.String context) throws java.lang.Exception
text
- the chunk textlanguage
- the chunk languagecontext
- the chunk contextjava.lang.Exception
getNextToken(), newAnnotation(), pushToken()
protected final AnnotatedToken getNextToken()
protected final Annotation newAnnotation(java.lang.String tag, java.lang.String displayForm, int nbTokens) throws JavaCustomSemanticProcessor.InvalidAnnotationException
tag
- the new annotation tagvalue
- the new annotation valuenbTokens
- the new annotation lengthJavaCustomSemanticProcessor.InvalidAnnotationException
protected final void pushToken(AnnotatedToken token) throws JavaCustomSemanticProcessor.InvalidTokenException
token
- A token allocated through a call to newToken()JavaCustomSemanticProcessor.InvalidTokenException
newToken(), newAnnotation()
protected final void addDocumentAnnotation(Annotation annotation) throws JavaCustomSemanticProcessor.InvalidAnnotationException
annotation
- the annotation to attachJavaCustomSemanticProcessor.InvalidAnnotationException
newAnnotation()
public final void setInputContexts(java.util.Collection<java.lang.String> c)
public final Referential getReferential()
public final void init(MOTPipe p)
public final void release()
CustomDocumentProcessor
release
in interface DocumentProcessor
release
in class CustomDocumentProcessor
public final void process(DocumentProcessingContext dContext, ProcessableDocument doc) throws java.lang.Exception
DocumentProcessor
dContext
- Context to perform various operations related to processingdoc
- The document being processed.java.lang.Exception
Copyright © 2013 Dassault Systèmes, All Rights Reserved.