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.
Inheritance
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemoryApi
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 |
---|---|
System.Boolean |
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 |
---|---|
Sdl.Core.Globalization.CultureCode |
SourceLanguageCode
Gets the source language code.
Declaration
public string SourceLanguageCode { get; }
Property Value
Type | Description |
---|---|
System.String |
TargetLanguage
Gets the target language.
Declaration
public CultureCode TargetLanguage { get; }
Property Value
Type | Description |
---|---|
Sdl.Core.Globalization.CultureCode |
TargetLanguageCode
Gets the target language code.
Declaration
public string TargetLanguageCode { get; }
Property Value
Type | Description |
---|---|
System.String |
TranslationProvider
The translation provider to which this language direction belongs.
Declaration
public ITranslationProvider TranslationProvider { get; }
Property Value
Type | Description |
---|---|
ITranslationProvider |
Methods
AddOrUpdateTranslationUnits(TranslationUnit[], Int32[], ImportSettings)
See AddOrUpdateTranslationUnits(TranslationUnit[], Int32[], ImportSettings). The default implementation
simply returns null
.
Declaration
public virtual ImportResult[] AddOrUpdateTranslationUnits(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit[] | translationUnits | |
System.Int32[] | previousTranslationHashes | |
ImportSettings | settings |
Returns
Type | Description |
---|---|
ImportResult[] |
AddOrUpdateTranslationUnitsMasked(TranslationUnit[], Int32[], ImportSettings, Boolean[])
See AddOrUpdateTranslationUnitsMasked(TranslationUnit[], Int32[], ImportSettings, Boolean[]). 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 | |
System.Int32[] | previousTranslationHashes | |
ImportSettings | settings | |
System.Boolean[] | 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, Boolean[])
See AddTranslationUnitsMasked(TranslationUnit[], ImportSettings, Boolean[]). 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 | |
System.Boolean[] | 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 |
---|---|---|
System.Collections.Generic.IList<Segment> | searchSegments | The source segments that have been translated. |
System.Collections.Generic.IList<Segment> | translations | The translations for the search segments. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<SearchResults> | 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 |
System.Collections.Generic.IList<Segment> | segments | The segments to translate (must not be |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<SearchResults> | 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[], Boolean[])
See SearchSegmentsMasked(SearchSettings, Segment[], Boolean[]). 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 | |
System.Boolean[] | mask |
Returns
Type | Description |
---|---|
SearchResults[] |
SearchSegmentsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment[], Boolean[])
See SearchSegmentsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment[], Boolean[]). 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 | |
System.Boolean[] | 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 | |
System.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[], Boolean[])
See SearchTranslationUnitsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit[], Boolean[]). 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 | |
System.Boolean[] | mask |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults[] |
SearchTranslationUnitsMasked(SearchSettings, TranslationUnit[], Boolean[])
See SearchTranslationUnitsMasked(SearchSettings, TranslationUnit[], Boolean[]). The default implementation collects the source segments of the translation units and then calls SearchSegmentsMasked(SearchSettings, Segment[], Boolean[]) to obtain the result.
Declaration
public virtual SearchResults[] SearchTranslationUnitsMasked(SearchSettings settings, TranslationUnit[] translationUnits, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | |
TranslationUnit[] | translationUnits | |
System.Boolean[] | 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 |
---|---|
System.Collections.Generic.List<SubsegmentMatchType> |
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 |
---|---|---|
System.String | text |
Returns
Type | Description |
---|---|
System.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[] |