public class AltTranslationsAnnotation extends Object implements IAnnotation, Iterable<AltTranslation>
When used, this annotation is designed to be attached to the segments or the container of the targets.
| Constructor and Description |
|---|
AltTranslationsAnnotation()
Creates a new empty AltTranslationsAnnotation object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(AltTranslation alt)
Adds an existing
AltTranslation object to this annotation. |
AltTranslation |
add(LocaleId sourceLocId,
LocaleId targetLocId,
TextFragment originalSource,
TextFragment alternateSource,
TextFragment alternateTarget,
MatchType type,
int combinedScore,
String origin)
Adds a new entry to the list of alternate translations.
|
AltTranslation |
add(LocaleId sourceLocId,
LocaleId targetLocId,
TextFragment originalSource,
TextFragment alternateSource,
TextFragment alternateTarget,
MatchType type,
int combinedScore,
String origin,
int fuzzyScore,
int qualityScore)
Adds a new entry to the list of alternate translations.
|
void |
downgradeIdenticalBestMatches(boolean forceSort,
int threshold)
Downgrades, and possibly removes, all the 100% best matches that are identical.
|
String |
getCurrentToolId() |
AltTranslation |
getFirst()
Gets the first entry in the list of alternate translations.
|
AltTranslation |
getLast()
Gets the last entry in the list of alternate translations.
|
boolean |
hasSeveralBestMatches(boolean forceSort)
Indicates if a) there are several matches of 100% with identical rank
and at least two of them have different translations.
|
boolean |
isEmpty()
Indicates if the list of alternate translation is empty.
|
Iterator<AltTranslation> |
iterator()
Creates a new iterator for the entries in this annotations.
|
void |
setCurrentToolId(String toolId) |
int |
size()
Gets the number of entries in this annotation.
|
void |
sort()
Sorts the list of
AltTranslations in the order defined by AltTranslation.compareTo(AltTranslation). |
String |
toString()
Gets a human readable representation of this annotation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic AltTranslationsAnnotation()
public void add(AltTranslation alt)
AltTranslation object to this annotation.alt - the AltTranslation object to add.public AltTranslation add(LocaleId sourceLocId, LocaleId targetLocId, TextFragment originalSource, TextFragment alternateSource, TextFragment alternateTarget, MatchType type, int combinedScore, String origin)
sourceLocId - the locale of the source.targetLocId - the locale of the target.originalSource - the original source content.alternateSource - the source content corresponding to the alternate translation.alternateTarget - the content of alternate translation.type - the type of alternate translation.combinedScore - the combined score for this alternate translation (must be between 0 and 100).origin - an optional identifier for the origin of this alternate translation.AltTranslation object created and added to this annotation.public AltTranslation add(LocaleId sourceLocId, LocaleId targetLocId, TextFragment originalSource, TextFragment alternateSource, TextFragment alternateTarget, MatchType type, int combinedScore, String origin, int fuzzyScore, int qualityScore)
sourceLocId - the locale of the source.targetLocId - the locale of the target.originalSource - the original source content.alternateSource - the source content corresponding to the alternate translation.alternateTarget - the content of alternate translation.type - the type of alternate translation.combinedScore - the combined score for this alternate translation (must be between 0 and 100).origin - an optional identifier for the origin of this alternate translation.fuzzyScore - - fuzzy score (string distance) between the original source and alternate translation sourcequalityScore - - optional quality score from the TM or MT engineAltTranslation object created and added to this annotation.public Iterator<AltTranslation> iterator()
iterator in interface Iterable<AltTranslation>public AltTranslation getFirst()
public AltTranslation getLast()
public boolean isEmpty()
public int size()
public void sort()
AltTranslations in the order defined by AltTranslation.compareTo(AltTranslation).public boolean hasSeveralBestMatches(boolean forceSort)
forceSort - true to force the entries to be sorted. If set to false, the
code assumes the entries have been sorted already.public void downgradeIdenticalBestMatches(boolean forceSort,
int threshold)
A set of matches may have entries that have the same source but different targets, they are not duplicated. Some callers may need to treat exact matches like that as fuzzy matches to avoid triggering automated processes.
This methods examine the set of alternate translations here and downgrade by 1% the score of any top entry fall into that category.
forceSort - true to re-sort the annotations. If you set this option to false the entries
are expected to be already properly sorted to have the best matches first.threshold - threshold under which the matches should be removed.public String getCurrentToolId()
public void setCurrentToolId(String toolId)
public String toString()
IAnnotationtoString in interface IAnnotationtoString in class ObjectCopyright © 2021. All rights reserved.