Why translation memory provider didn't support highlight function?

之前有人提出了这个问题,这里显示的是代码,因此仍然没有不一致的显示。

我们都知道SDL本地文件TM支持高亮显示输入文本和返回源文本之间的差异,如下所示:

Howerver, Our plugin which implements translation provider function can't display the difference, the result is:

API上说是要计算返回的SearchResult 对象的
searchResult.ScoringResult.EditDistance属性值。

My implementation function is:

private EditDistance getEditDistance(CultureInfo cultureInfo, String text, String source)
{
TokenizerSetup setup = new TokenizerSetup();
setup.Culture = cultureInfo;
TokenizerParameters parameters = new TokenizerParameters(setup, null);
Tokenizer tokenizer = new Tokenizer(parameters);
List<Token> textTokenList = tokenizer.Tokenize(text);
List<Token> sourceTokenList = tokenizer.Tokenize(source);
EditDistanceComputer<Token> editDistanceComputer = new EditDistanceComputer<Token>(null);
return editDistanceComputer.ComputeEditDistance(sourceTokenList, textTokenList);
}
Executed, but still no effect
I noticed that the call service implementation sentence match interface has a SearchSettings object, there is a read-only property IsConcordanceSearch, the value is always false, can not show whether the difference is related to this value, if there is any way to make it true What?
Parents
  • Hi   and  ,

    We've found a way to show differences between TUs in third party TM providers. It involves a bit of reflection, but we've hidden that away.
    Long story short:
    - we've created a sample project that shows just how simple it is to use in your own project - github.com/.../SimpleTranslationProvider
    - the key class is "ComputeSearchResults" that pretty much abstracts away all the complexity
    - to see how to use it, please check out MyTranslationProviderLanguageDirection.SearchSegments
    - obviously, we've made the code public, so you can extend/tweak it to your liking

    The core idea is you have an original text (in the source language), and a resulting text (what actually got translated). The code we've provided properly computes the differences between them, so that the differences are shown in the UI.

    To quickly see everything in action, just run the sample project:
    - Open the sample project from Trados Studio 2022
    - go to Project Settings >> ... Translation Memory and create a Translation Provider, and Automated Translation, select "Use", and select "smtiti".
    - Open the SecondSample.docx.sdlxliff file
    - Select with the 1st, 2nd, and 4th segments
    - Do note that in our simple sample, you should ignore the translation itself. Please focus on what needs to be done on the source segments

    Finally, I'd love to hear your thoughts! Please let me know if this works for you.

    Best,
    John

    emoji
Reply
  • Hi   and  ,

    We've found a way to show differences between TUs in third party TM providers. It involves a bit of reflection, but we've hidden that away.
    Long story short:
    - we've created a sample project that shows just how simple it is to use in your own project - github.com/.../SimpleTranslationProvider
    - the key class is "ComputeSearchResults" that pretty much abstracts away all the complexity
    - to see how to use it, please check out MyTranslationProviderLanguageDirection.SearchSegments
    - obviously, we've made the code public, so you can extend/tweak it to your liking

    The core idea is you have an original text (in the source language), and a resulting text (what actually got translated). The code we've provided properly computes the differences between them, so that the differences are shown in the UI.

    To quickly see everything in action, just run the sample project:
    - Open the sample project from Trados Studio 2022
    - go to Project Settings >> ... Translation Memory and create a Translation Provider, and Automated Translation, select "Use", and select "smtiti".
    - Open the SecondSample.docx.sdlxliff file
    - Select with the 1st, 2nd, and 4th segments
    - Do note that in our simple sample, you should ignore the translation itself. Please focus on what needs to be done on the source segments

    Finally, I'd love to hear your thoughts! Please let me know if this works for you.

    Best,
    John

    emoji
Children
No Data