SearchSegment method is called multiple times for the same text

Hello.

I'm developing a addin for Trados2022.

====================================================================

ITranslationProviderLanguageDirection::SearchSegment method is called multiple times for the same text

when open a document on the editor.

I'm having trouble to spend time to translate the same text  in multiple times.

What should I do about this?

Should I keep results cache of translation results?

================================================

The "SearchSegment " is called from When ITranslationProviderLanguageDirection::SearchTranslationUnitsMasked.

When open a document, the "SearchTranslationUnitsMasked" is called multiple times, too.

In the case there are 3 texts on document in editor...

text1, text2, text3

The "SearchTranslationUnitsMasked" was called 4 times with texts as argument(segments) like below.

text1, text2

text1

text1

text2, text3

This means "SearchSegment" is called multiple time for the same text.

emoji
Parents
  • Hi  , I have taken some time today to review this issue reported.

    It might be that you have the Enable LookAhead option active, which is forcing studio to perform additional calls to your provider.  The option can be found from here 'File->Options->Editor->Automation->Enable LookAhead'.  Please deactivate this feature and confirm if you have the same issue.

    Please also make reference to here, to understand better what is meant by the mask parameter.

    SearchResults[] SearchSegmentsMasked(SearchSettings settings, Segment[] segments, bool[] mask)

    Performs a search for an array of segments, specifying a mask which specifies which segments should actually be searched (only those for which the corresponding mask bit is true are searched). If the mask is null, the method behaves identically to SearchSegments(SearchSettings, Segment[]). Passing a mask only makes sense in document search contexts (IsDocumentSearch set to true).

    emoji
Reply
  • Hi  , I have taken some time today to review this issue reported.

    It might be that you have the Enable LookAhead option active, which is forcing studio to perform additional calls to your provider.  The option can be found from here 'File->Options->Editor->Automation->Enable LookAhead'.  Please deactivate this feature and confirm if you have the same issue.

    Please also make reference to here, to understand better what is meant by the mask parameter.

    SearchResults[] SearchSegmentsMasked(SearchSettings settings, Segment[] segments, bool[] mask)

    Performs a search for an array of segments, specifying a mask which specifies which segments should actually be searched (only those for which the corresponding mask bit is true are searched). If the mask is null, the method behaves identically to SearchSegments(SearchSettings, Segment[]). Passing a mask only makes sense in document search contexts (IsDocumentSearch set to true).

    emoji
Children
No Data