AsposeAI Keywords detection

The AsposeAI class integrates external AI models (e.g., from Hugging Face) into OCR recognition results for keyword and numeric value search in OCR-recognized text.

Constructor

public AsposeAI();
public AsposeAI(ILogger? logger);

You can also pass optional logging and customization callbacks.

🔤 KeywordsAIProcessor Class – Postprocessor Module

  • Implements: IOcrAIPostProcessor
  • Description: A built-in module that performs AI-powered keyword and numeric value search.
  • Usage: Register using AsposeAI.SetPostProcessor(new KeywordsAIProcessor())

🔗 API References

  • AsposeAI
    Core class to load, configure, and apply AI models (e.g., for keywords detection) to OCR results.

  • KeywordsAIProcessor
    Built-in AI postprocessor that uses a language model to keyword and numeric value search in OCR-recognized text

   ILogger logger = new ConsoleLogger(); // can be null
   AsposeAIModelConfig modelConfig = new AsposeAIModelConfig
   {
       AllowAutoDownload = true,
       DirectoryModelPath = "D://test",
   };

   AsposeAI ai = new AsposeAI(logger);
   KeywordsAIProcessor processor = new KeywordsAIProcessor()
   processor.SetKeywords(new string[] {"Total", "Subtotal" });
   ai.SetPostProcessor(processor, modelConfig);
   ai.RunPostprocessor(res);

   Console.WriteLine("JSON RESULT\n");
   Console.WriteLine(processor.GetResult()[0].Result)
   ai.Dispose();

Live demo

AI keywords
Burger King R
#501
1500 Johnston St
LafayetteLA 70503
0RDER66
TAKE OUT
WHOPPER 4.99
WHOPPER JR 1.99
SUBTOTAL 6.98
9% TAX 0.63
TOTAL 7.6
CREDIT CARD 7.61
CHANGE 0.00
Check on reverse for fur ther orders.
Fr+ May 42018 11:32 AM
[
  {
    "keyword": "Total",
    "value": "7.6",
    "number": "7.6"
  },
  {
    "keyword": "Subtotal",
    "value": "6.98",
    "number": "6.98"
  }
]

🐞 Logging & error handling

Pass ILogger to constructor to track loading and inference.