Class AsposeAI

Class AsposeAI

Namespace: Aspose.OCR
Assembly: Aspose.OCR.dll (25.7.0)

Main API for AI component from Aspose OCR library

public class AsposeAI : IDisposable

Inheritance

object AsposeAI

Implements

IDisposable

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

AsposeAI()

Initializes a new instance of the AsposeAI class with default settings. Automatic model downloads are enabled.

public AsposeAI()

AsposeAI(AsposeAIModelConfig)

Initializes a new instance of the AsposeAI class with the specified model configuration.

public AsposeAI(AsposeAIModelConfig customSettings)

Parameters

customSettings AsposeAIModelConfig

The custom model configuration to use. Aspose.OCR.AsposeAIModelConfig

AsposeAI(AsposeAIModelConfig, ILogger)

Initializes a new instance of the AsposeAI class with the specified model configuration and logger.

public AsposeAI(AsposeAIModelConfig customSettings, ILogger customLogger)

Parameters

customSettings AsposeAIModelConfig

The custom model configuration to use. Aspose.OCR.AsposeAIModelConfig

customLogger ILogger

The custom logger instance to use. Must inherit from the Aspose.AI.LLM.Abstractions.Interfaces.ILogger abstract class, and implement its abstract methods. Aspose.AI.LLM.Abstractions.Interfaces.ILogger

AsposeAI(ILogger)

Initializes a new instance of the AsposeAI class with a custom logger. Automatic model downloads are enabled.

public AsposeAI(ILogger customLogger)

Parameters

customLogger ILogger

The custom logger instance to use. Must inherit from the Aspose.AI.LLM.Abstractions.Interfaces.ILogger abstract class, and implement its abstract methods. Aspose.AI.LLM.Abstractions.Interfaces.ILogger

AsposeAI(bool, ILogger, AsposeLLMApiConfig, AsposeLLMModelConfig, AsposeLLMChatSessionConfig)

Initializes a new instance of the AsposeAI class with full customization options.

public AsposeAI(bool allowAutomaticDownloads, ILogger customLogger = null, AsposeLLMApiConfig apiConfig = null, AsposeLLMModelConfig modelConfig = null, AsposeLLMChatSessionConfig chatConfig = null)

Parameters

allowAutomaticDownloads bool

If true, models will be downloaded automatically if not available locally.

customLogger ILogger

The custom logger instance to use. Must inherit from the Aspose.AI.LLM.Abstractions.Interfaces.ILogger abstract class, and implement its abstract methods. Aspose.AI.LLM.Abstractions.Interfaces.ILogger

apiConfig AsposeLLMApiConfig

Optional configuration for the LLM API. Aspose.AI.LLM.Abstractions.Parameters.AsposeLLMApiConfig

modelConfig AsposeLLMModelConfig

Optional configuration for the model. Aspose.AI.LLM.Abstractions.Parameters.AsposeLLMModelConfig

chatConfig AsposeLLMChatSessionConfig

Optional configuration for chat session parameters. Aspose.AI.LLM.Abstractions.Parameters.AsposeLLMChatSessionConfig

Methods

AddPostProcessor(IOcrAIPostProcessor)

Adds an AI postprocessor to be applied to OCR results.

public void AddPostProcessor(IOcrAIPostProcessor processor)

Parameters

processor IOcrAIPostProcessor

An implementation of IOcrAIPostProcessor.

CorrectResult(OcrOutput)

Applies AI spell-check correction to the full OCR output.

public void CorrectResult(OcrOutput result)

Parameters

result OcrOutput

Recognition result to process.

CorrectResult(RecognitionResult)

Applies AI spell-check correction to a single recognition result (e.g., one image or page).

public void CorrectResult(RecognitionResult result)

Parameters

result RecognitionResult

RecognitionResult with corrected text.

Dispose()

Disposes internal resources used by the AsposeAI instance.

public void Dispose()

FreeResources()

Releases all AI-related resources and disposes loaded models.

public void FreeResources()

GetLocalPath()

Gets the currently configured local model directory path.

public string GetLocalPath()

Returns

string

The path to the local model directory.

IsInitialized()

Checks whether the AI engine has been initialized.

public bool IsInitialized()

Returns

bool

True if initialized; otherwise, false.

ListLocal()

Lists all local models available in the configured directory.

public List<string> ListLocal()

Returns

List < string &gt;

List of model names or paths.

RunPostprocessor(OcrOutput)

Applies all registered AI postprocessors to a structured OCR result.

public void RunPostprocessor(OcrOutput res)

Parameters

res OcrOutput

The OCR result to process.

RunPostprocessor(List<string>)

Applies all registered AI postprocessors to a list of recognized text strings.

public void RunPostprocessor(List<string> res)

Parameters

res List < string &gt;

The list of recognized strings. </string>