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
Object
AbstractMachineTranslationProviderLanguageDirection
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
public abstract class AbstractMachineTranslationProviderLanguageDirection : ISubsegmentTranslationMemoryLanguageDirection, ITranslationProviderLanguageDirection
Constructors
Declaration
protected AbstractMachineTranslationProviderLanguageDirection(AbstractMachineTranslationProvider translationProvider, LanguagePair languageDirection)
Parameters
Properties
Declaration
public virtual bool CanReverseLanguageDirection { get; }
Property Value
Gets the current language direction of this instance.
Declaration
public LanguagePair LanguageDirection { get; }
Property Value
Gets the source language.
Declaration
public CultureCode SourceLanguage { get; }
Property Value
Type |
Description |
CultureCode |
|
Gets the source language code.
Declaration
public string SourceLanguageCode { get; }
Property Value
Gets the target language.
Declaration
public CultureCode TargetLanguage { get; }
Property Value
Type |
Description |
CultureCode |
|
Gets the target language code.
Declaration
public string TargetLanguageCode { get; }
Property Value
The translation provider to which this language direction belongs.
Declaration
public ITranslationProvider TranslationProvider { get; }
Property Value
Methods
Declaration
public virtual ImportResult[] AddOrUpdateTranslationUnits(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings)
Parameters
Returns
Declaration
public virtual ImportResult[] AddOrUpdateTranslationUnitsMasked(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings, bool[] mask)
Parameters
Returns
Declaration
public virtual ImportResult AddTranslationUnit(TranslationUnit translationUnit, ImportSettings settings)
Parameters
Returns
Declaration
public virtual ImportResult[] AddTranslationUnits(TranslationUnit[] translationUnits, ImportSettings settings)
Parameters
Returns
Declaration
public virtual ImportResult[] AddTranslationUnitsMasked(TranslationUnit[] translationUnits, ImportSettings settings, bool[] mask)
Parameters
Returns
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
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.
|
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
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 |
IList<Segment> |
searchSegments |
The source segments that have been translated.
|
IList<Segment> |
translations |
The translations for the search segments.
|
Returns
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
|
IList<Segment> |
segments |
The segments to translate (must not be null )
|
Returns
Type |
Description |
IList<SearchResults> |
A collection of SearchResults data structures if the translation was
successful, and null otherwise.
|
Declaration
public virtual SearchResults SearchSegment(SearchSettings settings, Segment segment)
Parameters
Returns
Declaration
public virtual SegmentAndSubsegmentSearchResults SearchSegment(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment segment)
Parameters
Returns
Declaration
public virtual SearchResults[] SearchSegments(SearchSettings settings, Segment[] segments)
Parameters
Returns
Declaration
public virtual SegmentAndSubsegmentSearchResults[] SearchSegments(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment[] segments)
Parameters
Returns
Declaration
public virtual SearchResults[] SearchSegmentsMasked(SearchSettings settings, Segment[] segments, bool[] mask)
Parameters
Returns
Declaration
public virtual SegmentAndSubsegmentSearchResults[] SearchSegmentsMasked(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment[] segments, bool[] mask)
Parameters
Returns
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 null )
|
Returns
SearchText(SearchSettings, String)
Declaration
public virtual SearchResults SearchText(SearchSettings settings, string segment)
Parameters
Returns
Declaration
public virtual SegmentAndSubsegmentSearchResults SearchTranslationUnit(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit translationUnit)
Parameters
Returns
Declaration
public virtual SearchResults SearchTranslationUnit(SearchSettings settings, TranslationUnit translationUnit)
Parameters
Returns
Declaration
public virtual SegmentAndSubsegmentSearchResults[] SearchTranslationUnits(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit[] translationUnits)
Parameters
Returns
Declaration
public virtual SearchResults[] SearchTranslationUnits(SearchSettings settings, TranslationUnit[] translationUnits)
Parameters
Returns
Declaration
public virtual SegmentAndSubsegmentSearchResults[] SearchTranslationUnitsMasked(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit[] translationUnits, bool[] mask)
Parameters
Returns
Declaration
public virtual SearchResults[] SearchTranslationUnitsMasked(SearchSettings settings, TranslationUnit[] translationUnits, bool[] mask)
Parameters
Returns
Declaration
public virtual SubsegmentSearchResultsCollection SubsegmentSearchSegment(SubsegmentSearchSettings settings, Segment segment)
Parameters
Returns
Declaration
public virtual SubsegmentSearchResultsCollection[] SubsegmentSearchSegments(SubsegmentSearchSettings settings, Segment[] segments)
Parameters
Returns
Declaration
public virtual List<SubsegmentMatchType> SupportedSubsegmentMatchTypes()
Returns
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
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
Declaration
public virtual ImportResult UpdateTranslationUnit(TranslationUnit translationUnit)
Parameters
Returns
Declaration
public virtual ImportResult[] UpdateTranslationUnits(TranslationUnit[] translationUnits)
Parameters
Returns
Implements