Penalties in the Translation Provider API

I have a working MT engine plugin developed against the Translation Provider API. It's working in Trados 2017 and Trados 2019. I'm encountering the problem below in Trados 2017 (it may occur in 2019, haven't tried yet).

I would like to apply a penalty to the output of the MT engine. In "Project Settings" -> "Language Pairs" -> "Translation Memory and Automated Translation", I add a penalty setting. However, it's ignored when the engine populates an output segment in the editor view; the score is whatever score is set in the code in the language direction:

            int score = 90;
            tu.Origin = TranslationUnitOrigin.MachineTranslation;


            SearchResult searchResult = new SearchResult(tu);
            searchResult.ScoringResult = new ScoringResult();
            searchResult.ScoringResult.BaseScore = score;

There are two properties in the translation provider that look like they'd be useful:

public bool SupportsPenalties
{
    get { return false; }
}

public bool SupportsScoring

{
    get { return false; }
}

However, changing these values to true makes no difference whatsoever.

What's the proper way to have penalties for MT engines accounted for?

Thanks in advance.

Parents Reply
  • Did you try to check the settings from the project, if the penalty setup in the UI is identified on one of the setting group, like:

    private void UpdateProjectTMSettings(FileBasedProject project)
    {
          var settings = project.GetSettings();
          var tmSettings = settings.GetSettingsGroup<TranslationMemorySettings>();
          tmSettings.MultipleTranslationsPenalty.Value = 10;
          tmSettings.MissingFormattingPenalty.Value = 0;
          tmSettings.DifferentFormattingPenalty.Value = 0; 
          tmSettings.AutoLocalizationPenalty.Value = 0;
          tmSettings.TextReplacementPenalty.Value = 0;
          tmSettings.TranslationMaximumResults.Value = 99;

    project.UpdateSettings(settings);
    }

    In the above method, the translation memory penalties settings  are setup based on user's situation.

    With kind regards,

    Florentina Caputa

Children