Wiki

Clone wiki

XLIFF Toolkit / Translation_Candidates

Translation Candidates

<Table of Content>

The library implements the Translation Candidates module. From a unit, you can call hasMatch() to see if the unit holds one or more matches. A call to getMatches() will return a Matches object (even if there are currently no matches). That object holds a list of Match objects which contains all the information about the corresponding <match> element in the document.

For example the following code loops through all matches for a given unit and do something with the translation candidates if the similarity score is above 75. Note that the various properties of a match are optional: you will get a null if the property requested is not specified and has no default value:

#!java
for ( Match match : unit.getMatches() ) {
   Double score = match.getSimilarity();
   if (( score != null ) && ( score > 75.0 )) {
      Fragment candidate = match.getTarget();
      // Do something...
   }
}

Updated