MohitKhare 0.1.0

dotnet add package MohitKhare --version 0.1.0
                    
NuGet\Install-Package MohitKhare -Version 0.1.0
                    
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="MohitKhare" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MohitKhare" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="MohitKhare" />
                    
Project file
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 MohitKhare --version 0.1.0
                    
#r "nuget: MohitKhare, 0.1.0"
                    
#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 MohitKhare@0.1.0
                    
#: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=MohitKhare&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=MohitKhare&version=0.1.0
                    
Install as a Cake Tool

MohitKhare .NET Utilities

Developer utilities for token estimation, text analysis, and slug generation. Built for .NET 8+ with idiomatic C# patterns including records, pattern matching, and LINQ.

Installation

dotnet add package MohitKhare

Token Estimation

Estimate token counts and API costs before sending text to LLM APIs. The estimator uses a word-boundary heuristic calibrated against BPE tokenizers (GPT, Claude):

using MohitKhare;

var article = File.ReadAllText("article.md");
var estimate = TokenEstimator.Estimate(article);

Console.WriteLine($"Tokens: ~{estimate.Tokens}");
Console.WriteLine($"Words: {estimate.Words}");
Console.WriteLine($"Estimated cost: ${estimate.EstimateCost(3.00m):F4}");
// Tokens: ~1729
// Words: 1300
// Estimated cost: $0.0052

Text Analysis

Analyze text for word count, reading time, sentence structure, and readability. Readability uses the Flesch Reading Ease formula:

var analysis = TextAnalyzer.Analyze(article);

Console.WriteLine($"Words: {analysis.WordCount}");
Console.WriteLine($"Sentences: {analysis.SentenceCount}");
Console.WriteLine($"Reading time: {analysis.ReadingTime.Minutes}m {analysis.ReadingTime.Seconds}s");
Console.WriteLine($"Readability: {analysis.FleschReadingEase} ({analysis.ReadingLevel})");
// Words: 1300
// Sentences: 68
// Reading time: 5m 27s
// Readability: 62.3 (Standard)

Slug Generation

Convert arbitrary text to clean, URL-safe slugs with full Unicode support. Handles diacritics, special characters, and optional length limits:

Slugify.ToSlug("C# Best Practices 2025");    // "c-best-practices-2025"
Slugify.ToSlug("Resume: A Developer's Path"); // "resume-a-developers-path"
Slugify.ToSlug("Long Title Here", maxLength: 10); // "long-title"

Reading Levels

The Flesch Reading Ease score maps to human-readable levels:

Score Level Typical Audience
90-100 Very Easy 5th grader
80-89 Easy 6th grader
70-79 Fairly Easy 7th grader
60-69 Standard 8th-9th grader
50-59 Fairly Difficult High school
30-49 Difficult College
0-29 Very Difficult Graduate

API Surface

Type Description
TokenEstimator BPE-calibrated token count and cost estimation
TextAnalyzer Word count, reading time, Flesch readability
Slugify Unicode-aware slug generation with optional length limit

License

MIT License. See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos 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

    • No dependencies.

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.0 165 3/29/2026