Class TextTranslation
- Namespace
- LMKit.Translation
- Assembly
- LM-Kit.NET.dll
Provides functionality to handle the translation of plain text and language detection. This class offers efficient and streamlined methods to manage multilingual content conversion and linguistic analysis.
public sealed class TextTranslation
- Inheritance
-
TextTranslation
- Inherited Members
Remarks
The TextTranslation class utilizes language models to perform translation and language detection on given text inputs. It preserves the structure and formatting of the original content during translation.
Constructors
- TextTranslation(LLM)
Initializes a new instance of the TextTranslation class.
Properties
- Confidence
Gets the confidence score of the last language detection process, expressed as a floating-point value ranging from 0 to 1. A score closer to 1 indicates a higher confidence level in the categorization accuracy, while a score closer to 0 suggests lower confidence. This metric can be used to evaluate and filter predictions based on their reliability.
- Model
Gets the LLM instance associated with this TextTranslation object.
Methods
- DetectLanguage(string, IEnumerable<Language>, CancellationToken)
Detects the language of the specified plain text.
- DetectLanguageAsync(string, IEnumerable<Language>, CancellationToken)
Asynchronously detects the language of the specified plain text.
- GetTrainingData(TrainingDataset, int, bool, int?)
Retrieves training data for fine-tuning a language detection model from the specified dataset.
- Translate(string, Language, CancellationToken)
Converts plain text into a specified target language while maintaining the original layout.
- TranslateAsync(string, Language, CancellationToken)
Asynchronously converts plain text into a specified target language while maintaining the original layout.
Events
- AfterTextCompletion
Occurs after a text completion operation is performed.