Table of Contents

Class BatchParsingRules

Namespace
Textkernel.Tx.Batches
Assembly
Textkernel.Tx.SDK.dll

Rules to limit invalid parse transactions (and reduce parsing costs).

public class BatchParsingRules
Inheritance
BatchParsingRules
Inherited Members

Constructors

BatchParsingRules(int, IEnumerable<string>, IEnumerable<string>, Func<string, bool>)

Create a set of rules to limit invalid parse transactions (and reduce parsing costs).

public BatchParsingRules(int maxBatchSize, IEnumerable<string> disallowedFileTypes = null, IEnumerable<string> allowedFileTypes = null, Func<string, bool> shouldProcessFn = null)

Parameters

maxBatchSize int

The maximum amount of files allowed in a batch parse. If a directory contains more valid files, an error is thrown. This is important to keep users from unknowingly consuming large numbers of parsing credits.

disallowedFileTypes IEnumerable<string>

File types to skip. Use the DefaultDisallowedFileTypes unless you have a specific use case.

allowedFileTypes IEnumerable<string>

File types to exclusively allow. ANY value in here will mean the DisallowedFileTypes property is ignored and only types in this list are allowed.

shouldProcessFn Func<string, bool>

A custom function to decide whether or not a file should be parsed. It should return true to parse the file. This could be used, for example, to check if you have already parsed a particular file in your system before spending credits to parse it again. NOTE: If defined, this will be called only AFTER a file passes the other 'file type' checks.

Fields

DefaultDisallowedFileTypes

The default file types that will result in invalid parse transactions (and cost unnecessary credits)

public static ReadOnlyCollection<string> DefaultDisallowedFileTypes

Field Value

ReadOnlyCollection<string>

Properties

AllowedFileTypes

ANY value in here will mean the 'DisallowedFileTypes' property is ignored and only types in this list are allowed

public IEnumerable<string> AllowedFileTypes { get; protected set; }

Property Value

IEnumerable<string>

DisallowedFileTypes

File types to skip.

public IEnumerable<string> DisallowedFileTypes { get; protected set; }

Property Value

IEnumerable<string>

MaxBatchSize

The maximum amount of files allowed in a batch parse. If a directory contains more valid files, an error is thrown. This is important to keep users from unknowingly consuming large numbers of parsing credits.

public int MaxBatchSize { get; set; }

Property Value

int

ShouldProcessFile

A custom function to decide whether or not a file should be parsed. It should return true to parse the file.

public Func<string, bool> ShouldProcessFile { get; protected set; }

Property Value

Func<string, bool>