Table of Contents

Class NamedEntityRecognition

Namespace
LMKit.TextAnalysis
Assembly
LM-Kit.NET.dll

A class for performing Named Entity Recognition (NER) on input content a Language Model (LM). This class identifies and extracts all occurrences of specified entity types (built‐in or custom) from the provided content, returning each entity verbatim along with its type and optional positional information.

public class NamedEntityRecognition
Inheritance
NamedEntityRecognition
Inherited Members

Remarks

Use this class to extract entities such as persons, organizations, locations, dates, etc., by leveraging an underlying LMKit LM model. You can customize which entity types to extract by setting the EntityDefinitions property.

Constructors

NamedEntityRecognition(LM)

Initializes a new instance of NamedEntityRecognition with default entity definitions (all built‐in NamedEntityRecognition.NamedEntityType values except Custom).

NamedEntityRecognition(LM, List<EntityDefinition>)

Initializes a new instance of NamedEntityRecognition with a custom list of entity definitions.

Properties

Confidence

Gets the confidence score of the last recognition operation.

EntityDefinitions

Gets or sets the list of entity types (built‐in and/or custom) that this recognizer will extract. Must contain at least one NamedEntityRecognition.EntityDefinition; otherwise, an ArgumentNullException is thrown.

Guidance

Gets or sets semantic guidance for the recognition process.

MaxContextLength

Gets or sets the maximum context length (in tokens) used during named-entity recognition.

Model

The underlying LM instance used for performing extraction.

OcrEngine

Gets or sets the OCR engine used to perform optical character recognition on image attachments during named‐entity recognition.

PreferredInferenceModality

Gets or sets the preferred modality for inference. This determines whether text, image, or both modalities are used when processing input. Defaults to Multimodal.

Methods

Recognize(Attachment, CancellationToken)

Synchronously recognizes named entities in the given image attachment.

Recognize(string, CancellationToken)

Synchronously recognizes named entities in the given content.

RecognizeAsync(Attachment, CancellationToken)

Asynchronously recognizes named entities in the given image attachment.

RecognizeAsync(string, CancellationToken)

Asynchronously recognizes named entities in the given content.