Class AbstractMachineTranslationProviderLanguageDirection
Implements an abstract base class for machine translation providers, and provides overridable default implementations for the most common properties and methods of ITranslationProviderLanguageDirection.
Inherited Members
Namespace: SdlSdl.LanguagePlatformTranslationMemoryApi
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
Syntax
public abstract class AbstractMachineTranslationProviderLanguageDirection : ISubsegmentTranslationMemoryLanguageDirection, ITranslationProviderLanguageDirection
Constructors
AbstractMachineTranslationProviderLanguageDirection(AbstractMachineTranslationProvider, LanguagePair)
Constructor.
Declaration
protected AbstractMachineTranslationProviderLanguageDirection(AbstractMachineTranslationProvider translationProvider, LanguagePair languageDirection)
Parameters
Type | Name | Description |
---|---|---|
AbstractMachineTranslationProvider | translationProvider | The machine translation provider to which this language direction belongs. |
LanguagePair | languageDirection | The language direction. |
Properties
CanReverseLanguageDirection
See CanReverseLanguageDirection. The default implementation returns false
.
Declaration
public virtual bool CanReverseLanguageDirection { get; }
Property Value
Type | Description |
---|---|
bool |
LanguageDirection
Gets the current language direction of this instance.
Declaration
public LanguagePair LanguageDirection { get; }
Property Value
Type | Description |
---|---|
LanguagePair |
SourceLanguage
Gets the source language.
Declaration
public CultureCode SourceLanguage { get; }
Property Value
Type | Description |
---|---|
CultureCode |
SourceLanguageCode
Gets the source language code.
Declaration
public string SourceLanguageCode { get; }
Property Value
Type | Description |
---|---|
string |
TargetLanguage
Gets the target language.
Declaration
public CultureCode TargetLanguage { get; }
Property Value
Type | Description |
---|---|
CultureCode |
TargetLanguageCode
Gets the target language code.
Declaration
public string TargetLanguageCode { get; }
Property Value
Type | Description |
---|---|
string |
TranslationProvider
The translation provider to which this language direction belongs.
Declaration
public ITranslationProvider TranslationProvider { get; }
Property Value
Type | Description |
---|---|
ITranslationProvider |
Methods
AddOrUpdateTranslationUnits(TranslationUnit[], int[], ImportSettings)
See AddOrUpdateTranslationUnits(TranslationUnit[], int[], ImportSettings). The default implementation
simply returns null
.
Declaration
public virtual ImportResult[] AddOrUpdateTranslationUnits(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | |
int | previousTranslationHashes | |
ImportSettings | settings |
Returns
Type | Description |
---|---|
ImportResult |
AddOrUpdateTranslationUnitsMasked(TranslationUnit[], int[], ImportSettings, bool[])
See AddOrUpdateTranslationUnitsMasked(TranslationUnit[], int[], ImportSettings, bool[]). The default implementation
simply returns null
.
Declaration
public virtual ImportResult[] AddOrUpdateTranslationUnitsMasked(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | |
int | previousTranslationHashes | |
ImportSettings | settings | |
bool | mask |
Returns
Type | Description |
---|---|
ImportResult |
AddTranslationUnit(TranslationUnit, ImportSettings)
See AddTranslationUnit(TranslationUnit, ImportSettings). The default implementation
simply returns null
.
Declaration
public virtual ImportResult AddTranslationUnit(TranslationUnit translationUnit, ImportSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnit | |
ImportSettings | settings |
Returns
Type | Description |
---|---|
ImportResult |
AddTranslationUnits(TranslationUnit[], ImportSettings)
See AddTranslationUnits(TranslationUnit[], ImportSettings). The default implementation
simply returns null
.
Declaration
public virtual ImportResult[] AddTranslationUnits(TranslationUnit[] translationUnits, ImportSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | |
ImportSettings | settings |
Returns
Type | Description |
---|---|
ImportResult |
AddTranslationUnitsMasked(TranslationUnit[], ImportSettings, bool[])
See AddTranslationUnitsMasked(TranslationUnit[], ImportSettings, bool[]). The default implementation
simply returns null
.
Declaration
public virtual ImportResult[] AddTranslationUnitsMasked(TranslationUnit[] translationUnits, ImportSettings settings, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | |
ImportSettings | settings | |
bool | mask |
Returns
Type | Description |
---|---|
ImportResult |
CheckSettings(SearchSettings)
Verifies that the search settings are correct, and throws an exception if not. The
default implementation will check on null
, and whether the search mode
is consistent with an MT provider.
Declaration
protected virtual void CheckSettings(SearchSettings settings)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings |
CreateSearchResult(Segment, Segment)
Creates a search result from a pair of source and target language segments.
Declaration
protected virtual SearchResult CreateSearchResult(Segment searchSegment, Segment translation)
Parameters
Type | Name | Description |
---|---|---|
Segment | searchSegment | The search (source) segment |
Segment | translation | The result (target) segment |
Returns
Type | Description |
---|---|
SearchResult | A new search result, which contains a duplicate of the source segment, and the translation segment. The origin is set to MachineTranslation. |
CreateSearchResultFromTranslation(Segment, Segment)
Creates a result from the given source and translation segments.
Declaration
protected virtual SearchResults CreateSearchResultFromTranslation(Segment searchSegment, Segment translation)
Parameters
Type | Name | Description |
---|---|---|
Segment | searchSegment | The source segment for a which the translation was requested. |
Segment | translation | The translated segment. |
Returns
Type | Description |
---|---|
SearchResults | A SearchResults object representing the result of the translation. |
CreateSearchResultsFromTranslations(IList<Segment>, IList<Segment>)
Creates search results for the specified list of source segments and their translations.
Declaration
protected virtual IList<SearchResults> CreateSearchResultsFromTranslations(IList<Segment> searchSegments, IList<Segment> translations)
Parameters
Type | Name | Description |
---|---|---|
IListSegment | searchSegments | The source segments that have been translated. |
IListSegment | translations | The translations for the search segments. |
Returns
Type | Description |
---|---|
IListSearchResults | A list of SearchResults objects representing the results of the translation. |
SearchMultipleSegmentsInternal(SearchSettings, IList<Segment>)
Obtains the translation for a set of segments from the machine translation service and returns it in the TranslationProposal field of a SearchResults collection. Obtaining the translation should, but does not have to, result in only a single server round-trip.
This method is abstract and must be implemented by derived classes.
To create a search result from a segment, you can use CreateSearchResult(Segment, Segment).
Declaration
protected abstract IList<SearchResults> SearchMultipleSegmentsInternal(SearchSettings settings, IList<Segment> segments)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The search settings to apply |
IListSegment | segments | The segments to translate (must not be |
Returns
Type | Description |
---|---|
IListSearchResults | A collection of SearchResults data structures if the translation was
successful, and |
SearchSegment(SearchSettings, Segment)
See SearchSegment(SearchSettings, Segment). The default implementation validates the settings and then call SearchSingleSegmentInternal(SearchSettings, Segment) to obtain the result.
Declaration
public virtual SearchResults SearchSegment(SearchSettings settings, Segment segment)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
Segment | segment |
Returns
Type | Description |
---|---|
SearchResults |
SearchSegment(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment)
See SearchSegment(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment). The default implementation
simply returns null
.
Declaration
public virtual SegmentAndSubsegmentSearchResults SearchSegment(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment segment)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
SubsegmentSearchSettings | subsegmentSettings | |
SubsegmentSearchCondition | condition | |
Segment | segment |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults |
SearchSegments(SearchSettings, Segment[])
See SearchSegments(SearchSettings, Segment[]). The default implementation validates the settings and then call SearchMultipleSegmentsInternal(SearchSettings, IList<Segment>) to obtain the result.
Declaration
public virtual SearchResults[] SearchSegments(SearchSettings settings, Segment[] segments)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
Segment | segments |
Returns
Type | Description |
---|---|
SearchResults |
SearchSegments(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment[])
See SearchSegments(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment[]). The default implementation
simply returns null
.
Declaration
public virtual SegmentAndSubsegmentSearchResults[] SearchSegments(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment[] segments)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
SubsegmentSearchSettings | subsegmentSettings | |
SubsegmentSearchCondition | condition | |
Segment | segments |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults |
SearchSegmentsMasked(SearchSettings, Segment[], bool[])
See SearchSegmentsMasked(SearchSettings, Segment[], bool[]). The default implementation collects the non-masked segments and calls SearchMultipleSegmentsInternal(SearchSettings, IList<Segment>) to obtain the result.
Declaration
public virtual SearchResults[] SearchSegmentsMasked(SearchSettings settings, Segment[] segments, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
Segment | segments | |
bool | mask |
Returns
Type | Description |
---|---|
SearchResults |
SearchSegmentsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment[], bool[])
See SearchSegmentsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment[], bool[]). The default implementation
simply returns null
.
Declaration
public virtual SegmentAndSubsegmentSearchResults[] SearchSegmentsMasked(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment[] segments, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
SubsegmentSearchSettings | subsegmentSettings | |
SubsegmentSearchCondition | condition | |
Segment | segments | |
bool | mask |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults |
SearchSingleSegmentInternal(SearchSettings, Segment)
Obtains the translation for a single segment from the machine translation service and returns it in the TranslationProposal field of a SearchResults. Obtaining the translation may be through a round-trip to the server.
This method is abstract and must be implemented by derived classes.
To create a search result from a segment, you can use CreateSearchResult(Segment, Segment).
Declaration
protected abstract SearchResults SearchSingleSegmentInternal(SearchSettings settings, Segment segment)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The search settings to apply |
Segment | segment | The segment to translate (must not be |
Returns
Type | Description |
---|---|
SearchResults | A SearchResults data structure if the translation was
successful, and |
SearchText(SearchSettings, string)
See SearchText(SearchSettings, string). The default implementation
creates a new segment from the provided segment
and calls
SearchSingleSegmentInternal(SearchSettings, Segment) to obtain the result.
Declaration
public virtual SearchResults SearchText(SearchSettings settings, string segment)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
string | segment |
Returns
Type | Description |
---|---|
SearchResults |
SearchTranslationUnit(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit)
See SearchTranslationUnit(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit). The default implementation
simply returns null
.
Declaration
public virtual SegmentAndSubsegmentSearchResults SearchTranslationUnit(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit translationUnit)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
SubsegmentSearchSettings | subsegmentSettings | |
SubsegmentSearchCondition | condition | |
TranslationUnit | translationUnit |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults |
SearchTranslationUnit(SearchSettings, TranslationUnit)
See SearchTranslationUnit(SearchSettings, TranslationUnit). The default implementation
returns SearchSegment(SearchSettings, Segment), called for the source segment of translationUnit
.
Note that a result is computed and returned although SupportsSearchForTranslationUnits is
false
by default.
Declaration
public virtual SearchResults SearchTranslationUnit(SearchSettings settings, TranslationUnit translationUnit)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
TranslationUnit | translationUnit |
Returns
Type | Description |
---|---|
SearchResults |
SearchTranslationUnits(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit[])
See SearchTranslationUnits(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit[]). The default implementation
simply returns null
.
Declaration
public virtual SegmentAndSubsegmentSearchResults[] SearchTranslationUnits(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit[] translationUnits)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
SubsegmentSearchSettings | subsegmentSettings | |
SubsegmentSearchCondition | condition | |
TranslationUnit | translationUnits |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults |
SearchTranslationUnits(SearchSettings, TranslationUnit[])
See SearchTranslationUnits(SearchSettings, TranslationUnit[]). The default implementation collects the source segment of the provided translation units and then calls SearchSegments(SearchSettings, Segment[]) to obtain the result.
Declaration
public virtual SearchResults[] SearchTranslationUnits(SearchSettings settings, TranslationUnit[] translationUnits)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
TranslationUnit | translationUnits |
Returns
Type | Description |
---|---|
SearchResults |
SearchTranslationUnitsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit[], bool[])
See SearchTranslationUnitsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit[], bool[]). The default implementation
simply returns null
.
Declaration
public virtual SegmentAndSubsegmentSearchResults[] SearchTranslationUnitsMasked(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit[] translationUnits, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
SubsegmentSearchSettings | subsegmentSettings | |
SubsegmentSearchCondition | condition | |
TranslationUnit | translationUnits | |
bool | mask |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults |
SearchTranslationUnitsMasked(SearchSettings, TranslationUnit[], bool[])
See SearchTranslationUnitsMasked(SearchSettings, TranslationUnit[], bool[]). The default implementation collects the source segments of the translation units and then calls SearchSegmentsMasked(SearchSettings, Segment[], bool[]) to obtain the result.
Declaration
public virtual SearchResults[] SearchTranslationUnitsMasked(SearchSettings settings, TranslationUnit[] translationUnits, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
TranslationUnit | translationUnits | |
bool | mask |
Returns
Type | Description |
---|---|
SearchResults |
SubsegmentSearchSegment(SubsegmentSearchSettings, Segment)
See SubsegmentSearchSegment(SubsegmentSearchSettings, Segment). The default implementation
simply returns null
.
Declaration
public virtual SubsegmentSearchResultsCollection SubsegmentSearchSegment(SubsegmentSearchSettings settings, Segment segment)
Parameters
Type | Name | Description |
---|---|---|
SubsegmentSearchSettings | settings | |
Segment | segment |
Returns
Type | Description |
---|---|
SubsegmentSearchResultsCollection |
SubsegmentSearchSegments(SubsegmentSearchSettings, Segment[])
See SubsegmentSearchSegments(SubsegmentSearchSettings, Segment[]). The default implementation
simply returns null
.
Declaration
public virtual SubsegmentSearchResultsCollection[] SubsegmentSearchSegments(SubsegmentSearchSettings settings, Segment[] segments)
Parameters
Type | Name | Description |
---|---|---|
SubsegmentSearchSettings | settings | |
Segment | segments |
Returns
Type | Description |
---|---|
SubsegmentSearchResultsCollection |
SupportedSubsegmentMatchTypes()
See SupportedSubsegmentMatchTypes(). The default implementation
simply returns null
.
Declaration
public virtual List<SubsegmentMatchType> SupportedSubsegmentMatchTypes()
Returns
Type | Description |
---|---|
ListSubsegmentMatchType |
Translate(Segment)
A convenience method which returns a single translation for the input segment, using default settings.
Declaration
public virtual Segment Translate(Segment segment)
Parameters
Type | Name | Description |
---|---|---|
Segment | segment |
Returns
Type | Description |
---|---|
Segment |
Translate(string)
A convenience method which returns a single translation for the input string, using default settings.
Declaration
public virtual string Translate(string text)
Parameters
Type | Name | Description |
---|---|---|
string | text |
Returns
Type | Description |
---|---|
string |
UpdateTranslationUnit(TranslationUnit)
See UpdateTranslationUnit(TranslationUnit). The default implementation
simply returns null
.
Declaration
public virtual ImportResult UpdateTranslationUnit(TranslationUnit translationUnit)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnit |
Returns
Type | Description |
---|---|
ImportResult |
UpdateTranslationUnits(TranslationUnit[])
See UpdateTranslationUnits(TranslationUnit[]). The default implementation
simply returns null
.
Declaration
public virtual ImportResult[] UpdateTranslationUnits(TranslationUnit[] translationUnits)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits |
Returns
Type | Description |
---|---|
ImportResult |