Contoso.AI.PolitenessAnalyzer
0.1.10-beta
This is a prerelease version of Contoso.AI.PolitenessAnalyzer.
dotnet add package Contoso.AI.PolitenessAnalyzer --version 0.1.10-beta
NuGet\Install-Package Contoso.AI.PolitenessAnalyzer -Version 0.1.10-beta
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Contoso.AI.PolitenessAnalyzer" Version="0.1.10-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Contoso.AI.PolitenessAnalyzer" Version="0.1.10-beta" />
<PackageReference Include="Contoso.AI.PolitenessAnalyzer" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Contoso.AI.PolitenessAnalyzer --version 0.1.10-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Contoso.AI.PolitenessAnalyzer, 0.1.10-beta"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Contoso.AI.PolitenessAnalyzer@0.1.10-beta
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Contoso.AI.PolitenessAnalyzer&version=0.1.10-beta&prerelease
#tool nuget:?package=Contoso.AI.PolitenessAnalyzer&version=0.1.10-beta&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Contoso.AI.PolitenessAnalyzer
AI-powered politeness analysis for text using ONNX Runtime and a BERT-based model.
Windows Only: This package requires Windows 10 SDK version 19041 or later and uses Windows-specific AI APIs.
Features
- Analyzes text for politeness level (Polite, Somewhat Polite, Neutral, Impolite)
- Performance and Efficiency modes for different hardware configurations
- Async API for non-blocking operations
- Automatic model download at build time
Installation
dotnet add package Contoso.AI.PolitenessAnalyzer
Platform Requirements:
- Windows 10 version 2004 (build 19041) or later
- Not compatible with: Linux, macOS, or older Windows versions
Model Download
Important: This package uses a ~418 MB ONNX model that is automatically downloaded at build time.
- The model is downloaded to
obj/Models/polite-guard-model.onnx(not tracked by git) - Download happens only once (cached for subsequent builds)
- The model file is automatically copied to your output directory (
bin/.../Models/) - No need to add to
.gitignore- theobj/folder is already ignored by default
Usage
using Contoso.AI;
// Initialize (call once at startup)
var readyResult = await PolitenessAnalyzer.EnsureReadyAsync();
if (readyResult.Status != AIFeatureReadyResultState.Success)
{
// Handle initialization failure
return;
}
// Create analyzer instance
var analyzer = await PolitenessAnalyzer.CreateAsync(PerformanceMode.Performance);
// Analyze text
var result = await analyzer.AnalyzeAsync("Thank you so much for your help!");
Console.WriteLine($"Politeness Level: {result.Level}");
Console.WriteLine($"Description: {result.Description}");
Console.WriteLine($"Inference Time: {result.InferenceTimeMs}ms");
// Don't forget to dispose
analyzer.Dispose();
Performance Modes
PerformanceMode.Performance- Optimized for speed (uses GPU/NPU if available)PerformanceMode.Efficiency- Optimized for power efficiency (uses CPU)
Model Information
- Source: Intel/polite-guard on HuggingFace
- Size: ~418 MB
- License: Apache 2.0
- Type: BERT-based ONNX model
Requirements
- .NET 8.0 or later
- Windows 10 SDK 19041 or later
- Internet connection for initial model download
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows10.0.19041 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0-windows10.0.19041
- Contoso.AI.AIFeatureCore (>= 0.0.1-beta)
- Microsoft.WindowsAppSDK (>= 1.8.260101001)
- System.Numerics.Tensors (>= 9.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.10-beta | 49 | 1/30/2026 |
| 0.1.9-beta | 45 | 1/30/2026 |
| 0.1.8-beta | 44 | 1/30/2026 |
| 0.1.7-beta | 43 | 1/30/2026 |
| 0.1.6-beta | 45 | 1/30/2026 |
| 0.1.5-beta | 47 | 1/30/2026 |
| 0.1.4-beta | 42 | 1/30/2026 |