public class ITSContent extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
REF_PREFIX |
static String |
STANDOFFMARKER
Marker used in a skeleton part to indicate where standoff markup can be inserted when merging.
|
| Constructor and Description |
|---|
ITSContent(CharsetEncoder encoder,
boolean isHTML5,
boolean isXLIFF)
Creates an ITSContent object with a given character set encoder.
|
| Modifier and Type | Method and Description |
|---|---|
static Map<String,String> |
annotatorsRefToMap(String data)
Extract a map of the ITS annotatorsRef value in its string format.
|
void |
clearStandoff()
Clears the standoff markup.
|
static String |
getAnnotatorRef(String dataCategory,
INameable nameable)
Gets the ITS annotator reference for a given data category on a given object.
|
static String |
getAnnotatorRef(String dataCategory,
String pairs)
Gets the ITS annotator reference for a given data category from a given annotators list.
|
static String |
getAnnotatorsRef(IWithAnnotations nameable)
Gets the value of the ITS AnnotatorsRef information if it is present.
|
CharsetEncoder |
getEncoder() |
List<GenericAnnotations> |
getStandoff()
Gets the current standoff markup.
|
boolean |
hasStandoff()
Indicates if this object has at least standoff item.
|
static boolean |
isExtendedMatch(String langRanges,
String langTag)
Indicates if a given language tag matches at least one item of a list of extended language ranges.
|
boolean |
isHTML5() |
boolean |
isXLIFF() |
static String |
mapToAnnotatorsRef(Map<String,String> map)
Creates an ITS annotatorsRef value in a string form from a map.
|
void |
outputAnnotations(GenericAnnotations anns,
StringBuilder output,
boolean inline,
boolean mrk,
boolean mtypeNeeded,
LocaleId trgLocId)
Generates the markup for the ITS attributes for a given annotation set.
|
static String |
updateAnnotatorsRef(String oldValues,
String newValues)
Updates a set of annotator references with new values.
|
String |
writeAttributeProvenance(GenericAnnotation ann) |
String |
writeAttributesLQI(GenericAnnotation ann)
Writes the data attributes for a given LQI annotation (not locQualityIssuesRef).
|
String |
writeStandoffLQI()
Output the standoff markup for this object and clear it afterward.
|
String |
writeStandoffLQI(List<GenericAnnotations> annotations)
Output all the Localization Quality issue annotation groups in a given list.
|
String |
writeStandoffProvenance(List<GenericAnnotations> annotations) |
public static final String STANDOFFMARKER
public static final String REF_PREFIX
public ITSContent(CharsetEncoder encoder, boolean isHTML5, boolean isXLIFF)
encoder - the character set encoder to use (can be null for UTF-8)isHTML5 - true to generate markup for HTML5, false for XML.isXLIFF - true if the XML output is XLIFF, false for generic ITS.
This parameter is ignored if isHTML5 is true.public static boolean isExtendedMatch(String langRanges, String langTag)
Based on the algorithm described at: http://tools.ietf.org/html/rfc4647#section-3.3.2
langRanges - the list of extended language ranges (with optional '!' prefix for 'exclude')langTag - the language tag.public static Map<String,String> annotatorsRefToMap(String data)
data - the string with the annotatorsRef value to process (can be null).mapToAnnotatorsRef(Map)public static String mapToAnnotatorsRef(Map<String,String> map)
map - the map holding the key/values pairs.annotatorsRefToMap(String)public static String getAnnotatorsRef(IWithAnnotations nameable)
nameable - the object to query.getAnnotatorRef(String, INameable)public static String getAnnotatorRef(String dataCategory, INameable nameable)
dataCategory - the data category identifier.nameable - the nameable object where to look for the annotator.getAnnotatorsRef(IWithAnnotations),
getAnnotatorRef(String, String)public static String getAnnotatorRef(String dataCategory, String pairs)
dataCategory - the data category identifier.pairs - the list of annotator reference pairs to look up.getAnnotatorRef(String, INameable)public static String updateAnnotatorsRef(String oldValues, String newValues)
oldValues - the set of old values (can be null).newValues - the set of new values (can be null).public String writeStandoffLQI()
this.writeStandoffLQI(this.getStandoff()); then this.clearStandoff()public String writeStandoffLQI(List<GenericAnnotations> annotations)
annotations - the list of annotation set to process.public String writeAttributesLQI(GenericAnnotation ann)
ann - the annotation to output.public String writeStandoffProvenance(List<GenericAnnotations> annotations)
public String writeAttributeProvenance(GenericAnnotation ann)
public void outputAnnotations(GenericAnnotations anns, StringBuilder output, boolean inline, boolean mrk, boolean mtypeNeeded, LocaleId trgLocId)
anns - the annotations set (can be null).output - the buffer where to append the output.inline - true if the element is an inline element.mrk - true if the element is an XLIFF mrk element.mtypeNeeded - true if the mtype attribute should be output (if needed), false to not output it.trgLocId - target locale (can be null). This is use with mrk and Locale Filter.public List<GenericAnnotations> getStandoff()
public boolean hasStandoff()
public void clearStandoff()
public CharsetEncoder getEncoder()
public boolean isHTML5()
public boolean isXLIFF()
Copyright © 2021. All rights reserved.