Class AsposeAI
Namespace: Aspose.OCR
Assembly: Aspose.OCR.dll (25.8.0)
Main API for the AI component in the Aspose OCR library. Provides integration with AI-powered postprocessors such as spell-checking, table extraction, and layout correction.
public class AsposeAI : IDisposable
Inheritance
Implements
Inherited Members
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Remarks
⚠️ Disclaimer:
By using AI-powered features, you are solely responsible for ensuring compliance with any
applicable laws, licensing terms, third-party AI model usage policies, and data privacy regulations.
Aspose does not take responsibility for the accuracy, licensing, or reliability of external AI models.
Constructors
AsposeAI()
Initializes a new instance of the AsposeAI class with default settings. Automatic model downloads are enabled.
public AsposeAI()
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
Methods
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
The path to the local model directory.
IsInitialized()
Checks whether the AI engine has been initialized.
public bool IsInitialized()
Returns
True if initialized; otherwise, false.
ListLocal()
Lists all local models available in the configured directory.
public List<string> ListLocal()
Returns
List of model names or paths.
RunPostprocessor(OcrOutput, AITableDetectionMode)
Applies registered AI post-processor to the given structured OCR result. This may include spelling correction, table detection, table formatting, and other AI-powered enhancements depending on the configured processors.
public void RunPostprocessor(OcrOutput res, AITableDetectionMode mode = AITableDetectionMode.NONE)
Parameters
res
OcrOutput
The structured OCR result to process.
mode
AITableDetectionMode
Defines the table detection mode:
- Aspose.OCR.AI.AITableDetectionMode.NONE Does not explicitly detect tables; processes the entire image as a whole while improving overall layout and text formatting.
- Aspose.OCR.AI.AITableDetectionMode.AUTO Automatically detects tables, extracts them from the surrounding text, applies table layout formatting, and returns a structured table.
RunPostprocessor(List<string>)
Applies registered AI postprocessor to a list of recognized text strings.
public void RunPostprocessor(List<string> res)
Parameters
The list of recognized strings.
SetPostProcessor(IOcrAIPostProcessor, AsposeAIModelConfig)
Adds an AI postprocessor to be applied to OCR results.
If customSettings
is provided, the specified or default AI model will be loaded
and configured automatically before applying the postprocessor.
public void SetPostProcessor(IOcrAIPostProcessor processor, AsposeAIModelConfig customSettings = null)
Parameters
processor
IOcrAIPostProcessor
An implementation of Aspose.OCR.AI.IOcrAIPostProcessor that defines the logic for AI-based post-processing (e.g., spell-checking, table extraction, or layout correction).
customSettings
AsposeAIModelConfig
The custom AI model configuration to use. If provided, the model specified in Aspose.OCR.AsposeAIModelConfig will be automatically loaded and applied. </string>