Class AltTranslationsAnnotation

    • Constructor Detail

      • AltTranslationsAnnotation

        public AltTranslationsAnnotation()
        Creates a new empty AltTranslationsAnnotation object.
    • Method Detail

      • add

        public 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.
        Parameters:
        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.
        Returns:
        the AltTranslation object created and added to this annotation.
      • add

        public 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.
        Parameters:
        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 source
        qualityScore - - optional quality score from the TM or MT engine
        Returns:
        the AltTranslation object created and added to this annotation.
      • getFirst

        public AltTranslation getFirst()
        Gets the first entry in the list of alternate translations.
        Returns:
        the first alternate translation entry or null if the list is empty.
      • getLast

        public AltTranslation getLast()
        Gets the last entry in the list of alternate translations.
        Returns:
        the last alternate translation entry or null if the list is empty.
      • isEmpty

        public boolean isEmpty()
        Indicates if the list of alternate translation is empty.
        Returns:
        true if the list is empty.
      • size

        public int size()
        Gets the number of entries in this annotation.
        Returns:
        the number of alternate translations available.
      • hasSeveralBestMatches

        public 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.
        Parameters:
        forceSort - true to force the entries to be sorted. If set to false, the code assumes the entries have been sorted already.
        Returns:
        true if the conditions above are true.
      • downgradeIdenticalBestMatches

        public void downgradeIdenticalBestMatches​(boolean forceSort,
                                                  int threshold)
        Downgrades, and possibly removes, all the 100% best matches that are identical.

        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.

        Parameters:
        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.
      • getCurrentToolId

        public String getCurrentToolId()
      • setCurrentToolId

        public void setCurrentToolId​(String toolId)
      • toString

        public String toString()
        Description copied from interface: IAnnotation
        Gets a human readable representation of this annotation.
        Specified by:
        toString in interface IAnnotation
        Overrides:
        toString in class Object
        Returns:
        a human readable representation of this annotation.