Constructor NamedEntityRecognition
- Namespace
- LMKit.TextAnalysis
- Assembly
- LM-Kit.NET.dll
NamedEntityRecognition(LM, bool)
Initializes a new instance of NamedEntityRecognition with a default set of entity definitions (all built-in NamedEntityRecognition.NamedEntityType values except Custom and, by default, Other).
public NamedEntityRecognition(LM model, bool includeOtherType = false)
Parameters
model
LMA valid LM model that is not an embedding-only model and has tensor weights loaded.
includeOtherType
boolWhen
true
, also includes the catch-all Other in the default definitions. Use this to discover unexpected entities that do not fit any predefined type and for which you have not created a specific Custom label. Defaults tofalse
.
Examples
// Precision-oriented (default): do not include the catch-all bucket
var ner = new NamedEntityRecognition(model);
// Discovery mode (higher recall, potentially more false positives)
var nerWithOther = new NamedEntityRecognition(model, includeOtherType: true);
Remarks
About Other: This is a catch-all bucket intended for discovery of entities that are **not** covered by predefined types (e.g., Person, Location, Organization) and for which you have **not** provided a dedicated custom label. Examples might include domain-specific identifiers or uncommon categories that appear in your data.
Because it is intentionally broad, enabling Other can increase recall at the cost of a higher false-positive rate. When you know the category name you want, prefer defining a Custom label instead of relying on Other.
Exceptions
- ArgumentNullException
Thrown if
model
isnull
.- InvalidModelException
Thrown if
model
is an embedding model or was loaded without weights.
NamedEntityRecognition(LM, List<EntityDefinition>)
Initializes a new instance of NamedEntityRecognition with a custom list of entity definitions.
public NamedEntityRecognition(LM model, List<NamedEntityRecognition.EntityDefinition> definitions)
Parameters
model
LMA valid LM model that is not an embedding‐only model and has tensor weights loaded.
definitions
List<NamedEntityRecognition.EntityDefinition>The list of NamedEntityRecognition.EntityDefinition items (built‐in or custom) that this recognizer will extract. Must be non-null and contain at least one item.
Exceptions
- ArgumentNullException
Thrown if
model
is null ordefinitions
is null/empty.- InvalidModelException
Thrown if
model
is an embedding model or was loaded without weights.