Table of Contents

Method AddSample

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

AddSample(string, IEnumerable<EntityAnnotation>)

Adds a training sample from raw text content using the engine’s preferred modality.

public void AddSample(string content, IEnumerable<EntityAnnotation> annotations)

Parameters

content string

The textual content to analyze for PII/entities.

annotations IEnumerable<EntityAnnotation>

Ground-truth entity annotations (label + representative text) expected in content.

Examples

dataset.AddSample(
    "SSN: 123-45-6789",
    new [] { new EntityAnnotation("US_SSN", "123-45-6789") });

Remarks

AddSample(Attachment, IEnumerable<EntityAnnotation>)

Adds a training sample from an Attachment using the engine’s preferred modality.

public void AddSample(Attachment content, IEnumerable<EntityAnnotation> annotations)

Parameters

content Attachment

The input attachment (e.g., text, image, or multimodal source) to analyze.

annotations IEnumerable<EntityAnnotation>

Ground-truth entity annotations (label + representative text) expected in content.

Remarks

AddSample(InferenceModality, Attachment, IEnumerable<EntityAnnotation>)

Adds a training sample with an explicit InferenceModality.

public void AddSample(InferenceModality modality, Attachment content, IEnumerable<EntityAnnotation> annotations)

Parameters

modality InferenceModality

The inference modality to use for generating prompts and responses.

content Attachment

The content attachment to analyze.

annotations IEnumerable<EntityAnnotation>

Ground-truth entity annotations (label + representative text) expected in content.

Examples

var attachment = Attachment.CreateFromText("Email: alice@example.com", "text");
var anns = new [] { new EntityAnnotation("EmailAddress", "alice@example.com") };
dataset.AddSample(InferenceModality.Text, attachment, anns);

Remarks

This method assembles a ShareGPT-style conversation from the configured prompts and appends a ChatTrainingSample whose assistant response reflects the provided annotations. When EnableModalityAugmentation is true and modality is Multimodal, additional samples are appended for Text and Vision.