|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ITextUnit
Interface for the basic unit of extraction from a filter and also the resource associated with the filter event TEXT_UNIT.
The TextUnit object holds the extracted source text, all its properties and annotations, and any target corresponding data.
If adjustments to the source are required for different target locales, these
can be made using the IVariantSources interface, accessible through
getVariantSources()
Where adjusted sources exist, methods in this interface should have their effects on the default source, however a specific implementation may provide a method to select one of the variant sources that methods would then use. The main source should always be used before such a method is called.
| Field Summary | |
|---|---|
static java.lang.String |
TYPE_CDATA
Resource type value for a cdata section. |
static java.lang.String |
TYPE_HEADER
Resource type value for a header. |
static java.lang.String |
TYPE_LIST_ELEMENT
Resource type value for a list. |
static java.lang.String |
TYPE_PARA
Resource type value for a paragraph. |
static java.lang.String |
TYPE_TITLE
Resource type value for a title. |
| Fields inherited from interface net.sf.okapi.common.IResource |
|---|
COPY_ALL, COPY_CONTENT, COPY_PROPERTIES, COPY_SEGMENTATION, COPY_SEGMENTED_CONTENT, CREATE_EMPTY |
| Method Summary | |
|---|---|
ITextUnit |
clone()
Clones this TextUnit. |
void |
createSourceSegmentation(ISegmenter segmenter)
Segments the default source content based on the rules provided by a given ISegmenter. |
TextContainer |
createTarget(LocaleId locId,
boolean overwriteExisting,
int creationOptions)
Creates or get the target for this TextUnit. |
void |
createTargetSegmentation(ISegmenter segmenter,
LocaleId targetLocale)
Segments the specified target content based on the rules provided by a given ISegmenter. |
IAlignedSegments |
getAlignedSegments()
Creates a new IAlignedSegments object to access and
manipulate the segments of this text unit. |
TextContainer |
getSource()
Gets the source object for this text unit (a TextContainer object). |
Segment |
getSourceSegment(java.lang.String segId,
boolean createIfNeeded)
Gets the source segment for a given segment id. |
ISegments |
getSourceSegments()
Gets the segments for the source. |
TextContainer |
getTarget(LocaleId locId)
Gets the target object for this text unit for a given locale. |
Segment |
getTargetSegment(LocaleId trgLoc,
java.lang.String segId,
boolean createIfNeeded)
Gets the segment for a given segment id in a given target. |
ISegments |
getTargetSegments(LocaleId trgLoc)
Get the segments for a given target. |
IVariantSources |
getVariantSources()
Returns the variant sources (an IVariantSources object) for this text unit. |
boolean |
hasTarget(LocaleId locId)
Indicates if there is a target object for a given locale for this text unit. |
boolean |
hasVariantSources()
Indicates whether there are any variant sources used in this text unit. |
boolean |
isEmpty()
Indicates if the source text of this TextUnit is empty. |
void |
removeAllSegmentations()
Removes all segmentations (source and targets) in this text unit. |
void |
removeTarget(LocaleId locId)
Removes a given target object from this text unit. |
TextContainer |
setSource(TextContainer textContainer)
Sets the source object for this TextUnit. |
TextFragment |
setSourceContent(TextFragment content)
Sets the content of the source for this TextUnit. |
TextContainer |
setTarget(LocaleId locId,
TextContainer text)
Sets the target object for this text unit for a given locale. |
TextFragment |
setTargetContent(LocaleId locId,
TextFragment content)
Sets the content of the target for a given locale for this TextUnit. |
| Methods inherited from interface net.sf.okapi.common.resource.INameable |
|---|
createTargetProperty, getMimeType, getName, getProperty, getPropertyNames, getSourceProperty, getSourcePropertyNames, getTargetLocales, getTargetProperty, getTargetPropertyNames, getType, hasProperty, hasSourceProperty, hasTargetProperty, isTranslatable, preserveWhitespaces, removeProperty, removeSourceProperty, removeTargetProperty, setIsTranslatable, setMimeType, setName, setPreserveWhitespaces, setProperty, setSourceProperty, setTargetProperty, setType |
| Methods inherited from interface net.sf.okapi.common.IResource |
|---|
getAnnotation, getAnnotations, getId, getSkeleton, setAnnotation, setId, setSkeleton |
| Methods inherited from interface net.sf.okapi.common.resource.IReferenceable |
|---|
getReferenceCount, isReferent, setIsReferent, setReferenceCount |
| Field Detail |
|---|
static final java.lang.String TYPE_PARA
static final java.lang.String TYPE_LIST_ELEMENT
static final java.lang.String TYPE_TITLE
static final java.lang.String TYPE_HEADER
static final java.lang.String TYPE_CDATA
| Method Detail |
|---|
ITextUnit clone()
boolean isEmpty()
TextContainer getSource()
TextContainer object).
TextContainer setSource(TextContainer textContainer)
textContainer - the source object to set.
boolean hasVariantSources()
IVariantSources getVariantSources()
IVariantSources object) for this text unit.
TextContainer getTarget(LocaleId locId)
locId - the locale to query.
createTarget(LocaleId, boolean, int)
TextContainer setTarget(LocaleId locId,
TextContainer text)
If the target does not exists, one is created.
Any existing content for the given locale is overwritten.
To set a target object based on the source, use the
createTarget(LocaleId, boolean, int) method.
locId - the target locale.text - the target content to set.
void removeTarget(LocaleId locId)
locId - the target locale to remove.boolean hasTarget(LocaleId locId)
locId - the locale to query.
TextContainer createTarget(LocaleId locId,
boolean overwriteExisting,
int creationOptions)
If a variant source exists for the target locale, creationOptions apply to the variant source.
locId - the target locale.overwriteExisting - true to overwrite any existing target for the given locale.
False to not create a new target object if one already exists for the given locale.creationOptions - creation options:
TextFragment setSourceContent(TextFragment content)
content - the new content to set.
TextFragment setTargetContent(LocaleId locId,
TextFragment content)
If the target does not exists, one is created.
Any existing content for the given locale is overwritten.
To set a target object based on the source, use the
createTarget(LocaleId, boolean, int) method.
locId - the locale to set.content - the new content to set.
IAlignedSegments getAlignedSegments()
IAlignedSegments object to access and
manipulate the segments of this text unit.
IAlignedSegments object.ISegments getSourceSegments()
ISegments getTargetSegments(LocaleId trgLoc)
trgLoc - the locale of the target to retrieve.
void removeAllSegmentations()
void createSourceSegmentation(ISegmenter segmenter)
segmenter - the segmenter to use to create the segments.
void createTargetSegmentation(ISegmenter segmenter,
LocaleId targetLocale)
segmenter - the segmenter to use to create the segments.targetLocale - LocaleId of the target we want to segment.
Segment getSourceSegment(java.lang.String segId,
boolean createIfNeeded)
If the segment does not exists, one is created if createIfNeeded is true.
segId - the id of the segment to retrieve.createIfNeeded - true to append a segment at the end of the content
and return it if the segment does not exist yet.
False to return null when the segment does not exists.
Segment getTargetSegment(LocaleId trgLoc,
java.lang.String segId,
boolean createIfNeeded)
If the target does not exists, one is created.
If the segment does not exists, one is created if createIfNeeded is true.
trgLoc - the target locale to look up.segId - the id of the segment to retrieve.createIfNeeded - true to append a segment at the end of the target content and
return it if the segment does not exist yet. False to return null when the segment
does not exists.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||