Translator Class
Wordize.AI.Translator class. Provides methods for AIpowered document translation.
Translator class
Provides methods for AI-powered document translation.
public class Translator : Processor
Methods
| Name | Description |
|---|---|
| static Create(TranslatorContext) | Creates new instance of the translator processor. |
| Execute() | Execute the processor action. |
| Execute(CancellationToken) | Execute the processor action allowing canceling document processing task using specified cancellation token. |
| From(Stream) | Specifies input document for processing. |
| From(string) | Specifies input document for processing. |
| From(Stream, LoadOptions) | Specifies input document for processing. |
| From(string, LoadOptions) | Specifies input document for processing. |
| To(string) | Specifies output file for the processor. |
| To(List<Stream>, SaveFormat) | Specifies output Document streams list. |
| To(List<Stream>, SaveOptions) | Specifies output Document streams list. |
| To(Stream, SaveFormat) | Specifies output stream for the processor. |
| To(Stream, SaveOptions) | Specifies output stream for the processor. |
| To(string, SaveFormat) | Specifies output file for the processor. |
| To(string, SaveOptions) | Specifies output file for the processor. |
| static Translate(string, string, AiModel, Language) | Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating. |
| static Translate(Stream, Stream, SaveFormat, AiModel, Language) | Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating. |
| static Translate(string, string, SaveFormat, AiModel, Language) | Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating. |
| static TranslateToImages(Stream, ImageSaveOptions, AiModel, Language) | Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating. |
| static TranslateToImages(string, ImageSaveOptions, AiModel, Language) | Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating. |
Examples
Shows how to create standard OpenAiModel and perform document translation.
string apiKey = Environment.GetEnvironmentVariable("GPT4OMINI_API_KEY", EnvironmentVariableTarget.User);
AiModel model = OpenAiModel.Create(AiModelType.Gpt4OMini, apiKey);
Translator.Translate(MyDir + "SimpleAI.docx", ArtifactsDir + "Translate.docx", model, Language.Ukrainian);
See Also
- class Processor
- namespace Wordize.AI
- assembly Wordize