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
- modelLM
- A valid LM model that is not an embedding-only model and has tensor weights loaded. 
- includeOtherTypebool
- When - 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 to- false.
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 - modelis- null.
- InvalidModelException
- Thrown if - modelis 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
- modelLM
- A valid LM model that is not an embedding‐only model and has tensor weights loaded. 
- definitionsList<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 - modelis null or- definitionsis null/empty.
- InvalidModelException
- Thrown if - modelis an embedding model or was loaded without weights.