Classify document by path

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Classify document by path with IAB-2 taxonomy and return 2 best results

Classifying of the document could be performed with the next steps

  • Call Classify method for “document.pdf” file in the current (".") directory with IAB-2 taxonomy and return 2 best results.
  • Handle possible ApiException
try
{
    var response = classifier.Classify("document.pdf", ".", 3, Taxonomy.Iab2);
    Console.WriteLine(response.BestClassName, response.BestClassProbability);
}
catch (ApiException e)
{
    Console.WriteLine(e.Message);
}

Precisely classify document by path with Documents taxonomy and return 4 best results

  • Call Classify method for “document.doc” file in the current (".") directory with Documents taxonomy, set precision/recall balance to “Precision” and return 4 best results.
  • Handle possible ApiException
try
{
    var response = classifier.Classify("document.doc", ".", 4, Taxonomy.Documents, PrecisionRecallBalance.Precision);
    Console.WriteLine(response.BestClassName, response.BestClassProbability);
}
catch (ApiException e)
{
    Console.WriteLine(e.Message);
}

Classify password-protected document

Classifying of the password-protected document could be performed with the next step

  • Call Classify method for “document.doc” file in the current (".") directory with password parameter.
  • Handle possible ApiException
try
{
    response = classifier.Classify("password-protected.docx", dataFolderPath, password: "password");
    Console.WriteLine(response.BestClassName, response.BestClassProbability);
}
catch (ApiException e)
{
    Console.WriteLine(e.Message);
}