|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.context.Representation
de.fu_berlin.ties.context.AbstractRepresentation
de.fu_berlin.ties.context.SimpleRepresentation
public class SimpleRepresentation
A simple representation of an text in an element in an XML document. Instances of this class are thread-safe.
Field Summary |
---|
Fields inherited from class de.fu_berlin.ties.context.AbstractRepresentation |
---|
CONFIG_RECOGN_NUM, CONFIG_SPLIT_MAXIMUM, CONFIG_STORE_NTH |
Constructor Summary | |
---|---|
SimpleRepresentation()
Creates a new instance based on the standard configuration. |
|
SimpleRepresentation(int recogNum,
int splitMax,
int n,
String outCharset,
TextTokenizer textTokenizer)
Creates a new instance. |
|
SimpleRepresentation(TiesConfiguration config)
Creates a new instance based on the provided configuration. |
|
SimpleRepresentation(TiesConfiguration config,
String suffix)
Creates a new instance based on the provided configuration. |
Method Summary | |
---|---|
protected void |
addFeature(FeatureVector features,
String prefix,
String value)
Creates a feature and adds it to a feature vector. |
protected void |
addText(FeatureVector features,
String prefix,
String text)
Adds feature(s) representing text to a feature vector, using the instance tokenizer for splitting the text into tokens. |
protected FeatureVector |
doBuildContext(Element element,
String leftText,
String mainText,
String rightText,
PriorRecognitions priorRecognitions,
Map featureCache,
String logPurpose)
Builds the context representation of text in an element. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class de.fu_berlin.ties.context.AbstractRepresentation |
---|
buildContext, getSplitMaximum, getStoreN |
Methods inherited from class de.fu_berlin.ties.context.Representation |
---|
buildContext, buildContext, createRecognitionBuffer, getRecognitionNumber |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SimpleRepresentation() throws ProcessingException
ProcessingException
- if an error occurs while initializing this
instancepublic SimpleRepresentation(TiesConfiguration config) throws ProcessingException
config
- used to configure this instance
ProcessingException
- if an error occurs while initializing this
instancepublic SimpleRepresentation(TiesConfiguration config, String suffix) throws ProcessingException
config
- used to configure this instancesuffix
- this suffix can be appended to the used configuration
parameters to give values that are specific for this instance; may be
null
ProcessingException
- if an error occurs while initializing this
instancepublic SimpleRepresentation(int recogNum, int splitMax, int n, String outCharset, TextTokenizer textTokenizer)
recogNum
- the number of preceding recognitions to representsplitMax
- the maximum number of subsequences to keep when
a feature value must be split (at whitespace)n
- Each n-th context representation is stored if > 0;
otherwise no representation is storedoutCharset
- the output character set to use (only used to
store some configurations for inspection purposes, if n
> 0); if null
, the default charset of the current
platform is usedtextTokenizer
- the tokenizer to useMethod Detail |
---|
protected void addFeature(FeatureVector features, String prefix, String value)
prefix
and value
, separated
by a colon as separator character.
features
- the feature vector to append toprefix
- the prefix of the new featurevalue
- the main value of the new featureprotected void addText(FeatureVector features, String prefix, String text)
features
- the feature vector to append toprefix
- the prefix of the new feature(s)text
- to text to tokenize and addprotected FeatureVector doBuildContext(Element element, String leftText, String mainText, String rightText, PriorRecognitions priorRecognitions, Map featureCache, String logPurpose) throws ClassCastException
doBuildContext
in class AbstractRepresentation
element
- the element whose context should be representedleftText
- textual content to the left of (preceding)
mainText
, might be emptymainText
- the main textual content to represent, might be emptyrightText
- textual content to the right of (following)
mainText
, might be emptypriorRecognitions
- a buffer of the last Recognition
s from
the document, created by calling Representation.createRecognitionBuffer()
;
might be null
featureCache
- a cache of (local) feature, should be re-used
between all calls for the nodes in a single document (but must not be
re-used when building the context of nodes in different documents!)logPurpose
- the type of contexts of main interest to the caller
(e.g. "Token" or "Sentence"), used for logging
ClassCastException
- if the priorRecognitions
buffer
contains objects that aren't Recognition
spublic String toString()
toString
in class AbstractRepresentation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |