Multimodal ContentAnalysis for .NET
Extract meaning from text and images with six specialized engines: sentiment analysis, custom classification, keyword extraction, named entity recognition, PII detection, and semantic embeddings. Fine-tune with your data. Run 100% on-device with Dynamic Sampling for maximum accuracy on any hardware.
Complete Text Intelligence Toolkit
Six specialized engines working together to extract meaning, detect patterns, and transform unstructured content into actionable insights.
Multimodal Processing
Analyze both text and images with unified APIs. Automatic OCR integration extracts content from scanned documents, screenshots, and photos.
Dynamic Sampling
LM-Kit's innovative sampling technology delivers up to 75% error reduction and 2x faster processing, even with smaller models on CPU.
Fine-Tunable Models
Every analysis engine includes CreateTrainingObject methods for custom fine-tuning. Generate LoRA adapters tailored to your domain and data.
Sentiment & Emotion Analysis
Understand the emotional tone behind any content with three specialized engines. SentimentAnalysis classifies text as positive, negative, or neutral with up to 99.5% accuracy. EmotionDetection identifies specific emotions: joy, anger, sadness, fear, surprise, and disgust. SarcasmDetection captures ironic tones that might otherwise mislead analysis.
- Multilingual support with no configuration required
- Neutral sentiment support for objective content
- Fine-tune with your domain data via LoRA adapters
- Pre-built training datasets for rapid customization
- Confidence scores for every classification
var model = LM.LoadFromModelID("lm-kit-sentiment-analysis-2.0-1b"); var sentiment = new SentimentAnalysis(model) { NeutralSupport = true }; // Analyze sentiment var result = sentiment.GetSentimentCategory( "The product exceeded all expectations!"); Console.WriteLine($"Sentiment: {result}"); // Output: Positive // Detect specific emotions var emotions = new EmotionDetection(model); var emotion = emotions.GetEmotionCategory( "I can't believe they cancelled my order!"); Console.WriteLine($"Emotion: {emotion}"); // Output: Anger
Custom Text & Image Classification
Build classification engines tailored to your exact requirements with the Categorization class. Define any number of categories with optional descriptions, then classify text or images with lightning-fast inference and confidence scores. Works with both text input and multimodal attachments.
- Define unlimited custom categories
- Multimodal: classify both text and images
- GetBestCategory for single result, GetTopCategories for ranked list
- Guidance property for custom classification instructions
- HandleUnknownCategory for out-of-scope inputs
var model = LM.LoadFromModelID("phi-3.5-mini"); var classifier = new Categorization(model); // Define your categories var categories = new[] { "Technical Support", "Billing Inquiry", "Feature Request", "General Feedback" }; // Classify incoming text int result = classifier.GetBestCategory( categories, "My payment didn't go through"); Console.WriteLine(categories[result]); // Output: Billing Inquiry // Or classify an image var attachment = new Attachment("screenshot.png"); int imgResult = classifier.GetBestCategory( categories, attachment);
Keyword Extraction
Surface the most relevant terms and phrases from any content with the KeywordExtraction engine. Configure the number of keywords to extract, handle large documents with TextShrinkingStrategy, and optionally specify a target language for multilingual content. Works with both text and image attachments.
- Configurable keyword count with KeywordCount property
- TextShrinkingStrategy for handling large documents
- TargetLanguage for multilingual keyword extraction
- Extract from images with multimodal support
- Dynamic Sampling for high accuracy with small models
var model = LM.LoadFromModelID("phi-3.1-mini-4k"); var extractor = new KeywordExtraction(model) { KeywordCount = 8, TargetLanguage = "English" }; string article = File.ReadAllText("article.txt"); var keywords = extractor.ExtractKeywords(article); foreach (var kw in keywords) { Console.WriteLine($"- {kw.Value}"); } // Extract from image var attachment = new Attachment("infographic.png"); var imgKeywords = extractor.ExtractKeywords( attachment);
Named Entity Recognition (NER)
Extract structured information from unstructured content with the NamedEntityRecognition engine. Identify people, organizations, locations, dates, and any custom entity types you define. Each extracted entity includes occurrence positions, enabling precise highlighting or redaction in source documents. Visit our dedicated NER page for detailed implementation guidance and advanced use cases.
- Built-in entity types: Person, Organization, Location, Date, Money, Percent
- Define custom entity types with EntityDefinition
- Occurrences property with character offsets for each mention
- Multimodal: extract entities from images with OCR
- Guidance property for domain-specific extraction rules
var model = LM.LoadFromModelID("phi-3.5-mini"); var ner = new NamedEntityRecognition(model); // Define entity types to extract ner.EntityDefinitions.Add(new EntityDefinition( NamedEntityType.Person)); ner.EntityDefinitions.Add(new EntityDefinition( NamedEntityType.Organization)); ner.EntityDefinitions.Add(new EntityDefinition( "Product", "Product names mentioned")); string text = "John Smith joined Microsoft to lead " + "the Azure AI division in Seattle."; var entities = ner.ExtractEntities(text); foreach (var entity in entities) { Console.WriteLine( $"{entity.Type}: {entity.Value}"); foreach (var occ in entity.Occurrences) Console.WriteLine($" at [{occ.Start}]"); }
PII Extraction
Detect and extract personally identifiable information for privacy compliance, data masking, and audit workflows with the PiiExtraction engine. Supports built-in PII types plus unlimited custom labels for organization-specific identifiers. Works on both text and images with integrated OCR. Visit our dedicated PII Detection page for in-depth guidance on implementing privacy-compliant workflows.
- Built-in types: Name, Email, Phone, Address, SSN, DateOfBirth, URL, IP
- Define custom PII labels: PatientID, AccountNumber, PassportNumber
- Character offsets for precise masking and redaction
- Batch processing for high-volume document scanning
- Multimodal: extract from scanned documents and screenshots
var model = LM.LoadFromModelID("phi-3.5-mini"); var pii = new PiiExtraction(model); // Configure PII types to detect pii.PiiTypes.Add(PiiEntityType.Name); pii.PiiTypes.Add(PiiEntityType.Email); pii.PiiTypes.Add(PiiEntityType.Phone); pii.PiiTypes.Add(PiiEntityType.SSN); // Add custom PII type pii.CustomLabels.Add("PatientID"); string text = "Contact Jane Doe at [email protected] " + "or 555-123-4567. SSN: 123-45-6789"; var entities = pii.ExtractPii(text); foreach (var entity in entities) { Console.WriteLine( $"[{entity.Type}] {entity.Value}"); } // Extract from scanned document var scan = new Attachment("form.pdf"); var docPii = pii.ExtractPii(scan);
Text & Image Embeddings
Generate dense vector representations that capture semantic meaning with the Embedder class. Power semantic search, clustering, recommendations, and RAG pipelines with high-quality embeddings from both text and images. Supports batch processing and multiple embedding models optimized for different use cases.
- Text embeddings with models like nomic-embed-text, bge-m3
- Image embeddings with nomic-embed-vision
- Batch processing with GetEmbeddingsAsync for multiple inputs
- GetCosineSimilarity for measuring semantic similarity
- Seamless integration with RAG engine and vector stores
var model = LM.LoadFromModelID("nomic-embed-text"); var embedder = new Embedder(model); // Generate text embeddings float[] queryVec = await embedder.GetEmbeddingsAsync( "machine learning algorithms"); // Batch embed multiple texts var docs = new[] { "AI overview", "Neural networks" }; float[][] docVecs = await embedder.GetEmbeddingsAsync(docs); // Calculate similarity float sim = Embedder.GetCosineSimilarity( queryVec, docVecs[0]); // Image embeddings var visionModel = LM.LoadFromModelID("nomic-embed-vision"); var imgEmbedder = new Embedder(visionModel); var image = new Attachment("photo.jpg"); float[] imgVec = await imgEmbedder.GetEmbeddingsAsync( image);
Real-World Use Cases
Organizations across industries leverage LM-Kit's content analysis to automate workflows, ensure compliance, and unlock insights.
Customer Support Triage
Classify incoming tickets by sentiment and category, route to appropriate teams, and extract key entities for faster resolution.
Privacy Compliance
Scan documents for PII before sharing or archiving. Automate GDPR, CCPA, and HIPAA compliance workflows with precise detection.
Document Intelligence
Extract entities from contracts, invoices, and forms. Classify document types and route to appropriate processing pipelines.
Social Media Monitoring
Track brand sentiment across platforms. Detect emerging issues, measure campaign impact, and identify influencer content.
Semantic Search
Build intelligent search with embeddings that understand meaning, not just keywords. Find similar content across documents and images.
Content Moderation
Automatically classify user-generated content. Detect toxic language, spam, and policy violations before publication.
API Reference
Complete documentation for all content analysis classes and methods.
SentimentAnalysis
Classify text sentiment as positive, negative, or neutral with multilingual support and fine-tuning capabilities.
View DocsEmotionDetection
Identify specific emotions: joy, anger, sadness, fear, surprise, and disgust with optional neutral support.
View DocsCategorization
Custom classification with unlimited categories. Supports text and image inputs with confidence scores.
View DocsKeywordExtraction
Extract key terms and phrases with configurable count and language targeting.
View DocsNamedEntityRecognition
Extract people, organizations, locations, dates, and custom entity types with occurrence tracking.
View DocsPiiExtraction
Detect PII including names, emails, SSNs, and custom identifiers for compliance workflows.
View DocsEmbedder
Generate semantic embeddings from text and images for search, clustering, and RAG applications.
View DocsReady to Analyze Your Content?
Six powerful engines. Multimodal support. 100% on-device. Start building intelligent .NET applications today.