Table of Contents

Class TextTranslation

Namespace
LMKit.Translation
Assembly
LM-Kit.NET.dll

Provides methods for translating text between languages and detecting the language of provided content.

public sealed class TextTranslation
Inheritance
TextTranslation
Inherited Members

Remarks

The TextTranslation class leverages advanced language models to perform text translation and language detection. It preserves the original layout and formatting of the input content while processing and translating. Language detection is supported for both plain text and for content stored in Attachment objects (such as images).

Constructors

TextTranslation(LM)

Initializes a new instance of the TextTranslation class with the specified language model.

Properties

Confidence

Gets the confidence score from the most recent language detection operation.

Model

Gets the LM instance associated with this TextTranslation object.

Methods

DetectLanguage(Attachment, IEnumerable<Language>, CancellationToken)

Synchronously detects the language of the content provided via an Attachment.

DetectLanguage(string, IEnumerable<Language>, CancellationToken)

Detects the language of the specified text synchronously.

DetectLanguageAsync(Attachment, IEnumerable<Language>, CancellationToken)

Asynchronously detects the language of the content provided via an Attachment.

DetectLanguageAsync(string, IEnumerable<Language>, CancellationToken)

Asynchronously detects the language of the specified text.

GetTrainingData(TrainingDataset, int, bool, int?)

Retrieves training data for fine-tuning language detection models from the specified dataset.

Translate(string, Language, CancellationToken)

Translates the specified text into the target language synchronously while preserving the original layout.

TranslateAsync(string, Language, CancellationToken)

Asynchronously translates the specified text into the target language while preserving its original formatting.

Events

AfterTextCompletion

Occurs after a text completion operation (translation or language detection) has been performed.