Why translation memory provider didn't support highlight function?

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

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

Screenshot of Studio Developers Q&A interface showing a comparison of text with highlighted differences. The left panel displays Chinese text with highlighted differences, and the right panel shows an English translation with a 90% match.

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

Screenshot of Studio Developers Q&A interface with a comparison of text. The left panel shows Chinese text with highlighted differences, and the right panel shows an English translation with a 94% match and additional comments.

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
Screenshot of code from Studio Developers Q&A. The code snippet is in a programming IDE, showing a method definition with parameters and a loop structure. Chinese characters are present in the comments.
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?


Generated Image Alt-Text
[edited by: RWS Community AI at 5:45 AM (GMT 0) on 15 Nov 2024]
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