DocumentLab-x64 1.3.0

OCR using Tesseract, ImageMagick and EmguCV and an advanced query language. See the GitHub page for language documentation.

Requires NuGet 4.7.0.0 or higher.

Install-Package DocumentLab-x64 -Version 1.3.0
dotnet add package DocumentLab-x64 --version 1.3.0
<PackageReference Include="DocumentLab-x64" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DocumentLab-x64 --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DocumentLab-x64, 1.3.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install DocumentLab-x64 as a Cake Addin
#addin nuget:?package=DocumentLab-x64&version=1.3.0

// Install DocumentLab-x64 as a Cake Tool
#tool nuget:?package=DocumentLab-x64&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Getting started

You can write scripts in the query language or use the C# API. The C# fluent interface is easier to get started quickly. The raw text scripting interface allows more versatility and configurability in a production context.

Definitions

  • Pattern: A description of how information is presented in a document as well as which data to capture
    • e.g: Text(Total amount) Right [Amount]
  • Table: A description of which table column labels to match in a document and which text types are represented in each column
    • e.g: Table 'ItemNo': [Number(Item number)] 'Description': [Text(Description)] 'Price': [Amount(...
  • Query: A named set of patterns prioritized first to last
    • e.g: IncoiceNumber: *pattern 1*; *pattern 2*; ... *pattern n*;
  • Script: A collection of queries to execute in one go. Output properties will have the query name

From here...

Quick examples

Below are a few select examples with comments on how DocumentLab can be used.

C# Fluent Query Example

using (var dl = new Document((Bitmap)Image.FromFile("pathToSomeImage.png")))
{
  // Here we ask DocumentLab to specifically find a date value for the specified possible labels
  string dueDate = dl.Query().FindValueForLabel(TextType.Date, "Due date", "Payment date");

  // Here we ask DocumentLab to specifically find a date value for the specified label in a specific direction 
  string customerNumber = dl.Query().GetValueForLabel(Direction.Right, "Customer number");

  // We can build patterns using predicates, directions and capture operations that return the value matched in the document
  // Patterns allow us to recognize and capture data by contextual information, i.e., how we'd read for example receiver information from an invoice
  string receiverName = dl
    .Query()
    .Match("PostCode") // Text classification using contextual data files can be referenced by string
    .Up()
    .Match("Town")
    .Up()
    .Match("City")
    .Up()
    .Capture(TextType.Text); // All text type operations can also use the statically defined text type enum
} 

Script example

  • Your document has a label "Customer number:" and a value to the right of it
    • Query: CustomerNumber: Text(Customer number) Right [Text];
    • Match text labels with implicit starts with and Levensthein distance 2 comparison
  • Your document has a label "Invoice date" and a date below it
    • Query: InvoiceDate: Text(Invoice date) Down [Date];
    • You can capture a variety of text types. Even if the document contains additional text at the capture you'll only get back a standardized ISO date.
  • Want to capture invoice receiver info in one query?
    • Query: Receiver: 'Name': [Text] Down 'Address': [StreetAddress] Down 'City': [Town] Down 'PostalCode': [PostalCode];
    • Json output will name properties according to the query predicate naming parameters
  • You want to capture all amounts in a document?
    • Query: AllAmounts: Any [Amount];
    • When we use any, results are returned in a json array

Getting started

You can write scripts in the query language or use the C# API. The C# fluent interface is easier to get started quickly. The raw text scripting interface allows more versatility and configurability in a production context.

Definitions

  • Pattern: A description of how information is presented in a document as well as which data to capture
    • e.g: Text(Total amount) Right [Amount]
  • Table: A description of which table column labels to match in a document and which text types are represented in each column
    • e.g: Table 'ItemNo': [Number(Item number)] 'Description': [Text(Description)] 'Price': [Amount(...
  • Query: A named set of patterns prioritized first to last
    • e.g: IncoiceNumber: *pattern 1*; *pattern 2*; ... *pattern n*;
  • Script: A collection of queries to execute in one go. Output properties will have the query name

From here...

Quick examples

Below are a few select examples with comments on how DocumentLab can be used.

C# Fluent Query Example

using (var dl = new Document((Bitmap)Image.FromFile("pathToSomeImage.png")))
{
  // Here we ask DocumentLab to specifically find a date value for the specified possible labels
  string dueDate = dl.Query().FindValueForLabel(TextType.Date, "Due date", "Payment date");

  // Here we ask DocumentLab to specifically find a date value for the specified label in a specific direction 
  string customerNumber = dl.Query().GetValueForLabel(Direction.Right, "Customer number");

  // We can build patterns using predicates, directions and capture operations that return the value matched in the document
  // Patterns allow us to recognize and capture data by contextual information, i.e., how we'd read for example receiver information from an invoice
  string receiverName = dl
    .Query()
    .Match("PostCode") // Text classification using contextual data files can be referenced by string
    .Up()
    .Match("Town")
    .Up()
    .Match("City")
    .Up()
    .Capture(TextType.Text); // All text type operations can also use the statically defined text type enum
} 

Script example

  • Your document has a label "Customer number:" and a value to the right of it
    • Query: CustomerNumber: Text(Customer number) Right [Text];
    • Match text labels with implicit starts with and Levensthein distance 2 comparison
  • Your document has a label "Invoice date" and a date below it
    • Query: InvoiceDate: Text(Invoice date) Down [Date];
    • You can capture a variety of text types. Even if the document contains additional text at the capture you'll only get back a standardized ISO date.
  • Want to capture invoice receiver info in one query?
    • Query: Receiver: 'Name': [Text] Down 'Address': [StreetAddress] Down 'City': [Town] Down 'PostalCode': [PostalCode];
    • Json output will name properties according to the query predicate naming parameters
  • You want to capture all amounts in a document?
    • Query: AllAmounts: Any [Amount];
    • When we use any, results are returned in a json array

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.3.0 344 2/18/2020
1.2.0 234 1/4/2020
1.1.1 295 12/28/2019
1.1.0 385 12/27/2019
1.0.0 209 12/19/2019