DemaConsulting.WordSense.MiniLM 0.1.0-beta.6

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

WordSense

GitHub forks GitHub stars GitHub contributors License Build Quality Gate Security NuGet

WordSense is a .NET library that identifies an English word in context, offline. For each word it returns the lemma, the part of speech with its features and, where it can tell, the sense: an Open English WordNet (OEWN) fine sense with a readable id such as bank#financial-institution, or the group of closely related senses it belongs to. Every answer states its level (sense, group or part of speech), carries a confidence for that level and lists the candidate analyses with their probabilities.

Every word is looked up in an embedded dictionary of over 140,000 common words. A word with several analyses is decided from its sentence by Basic, a small statistical tagger in the core package, or by an ONNX encoder (MiniLM or BertBaseCased) that scores the fine senses of the 856 lemmas it was trained for and leaves every other word to Basic.

Features

  • 📖 Dictionary - Parts of speech and senses for over 140,000 common words
  • 🏷️ Levels and Confidence - Every answer says whether it is a sense, a group or a part of speech
  • 🔑 Stable Keys - One string per answer, and the list of every key the library can return
  • 📦 Layered Packages - A dependency-free core, optional ONNX encoder models
  • 🔒 Verified Models - Downloads are checked against pinned SHA-256 digests
  • 🌍 Multi-Platform - Windows, Linux and macOS; .NET 8, 9 and 10
  • ✅ Continuous Compliance - Evidence on every CI run (method)

Installation

dotnet add package DemaConsulting.WordSense                # dictionary, senses and the Basic model; no download
dotnet add package DemaConsulting.WordSense.MiniLM         # small and fast encoder
dotnet add package DemaConsulting.WordSense.BertBaseCased  # larger, case-sensitive encoder

The encoder packages bring the core package and DemaConsulting.WordSense.Onnx. They need ONNX Runtime and download their model files on first use, or from a mirror. Requirements: .NET 8, 9 or 10. Contributors who clone this repository also need Git LFS.

Quick Start

The code is compiled and its output checked by the test suite.

using DemaConsulting.WordSense;

// Basic is in the core package and needs no download. MiniLM and BertBaseCased need their package and
// download their model files on first use.
using var model = new BasicWordSenseModel();
// using var model = new MiniLMWordSenseModel();         // using DemaConsulting.WordSense.MiniLM;
// using var model = new BertBaseCasedWordSenseModel();  // using DemaConsulting.WordSense.BertBaseCased;

var words = "The hunter fired an arrow from his bow at a deer so we will record a record then go back home".Split(' ');
var results = await model.ClassifyAsync(words);

// Print the part of speech, level, confidence and sense or group id
foreach (var result in results)
{
    var pos = result.Details?.PartOfSpeech.ToString() ?? "unknown";
    var sense = result.SenseId ?? result.GroupId ?? "";
    Console.WriteLine($"{result.Word,-9} {pos,-12} {result.Level,-12} {result.Confidence,4:F2}  {sense}".TrimEnd());
}

Output with the Basic model:

The       Determiner   Sense        1.00  the#determiner
hunter    Noun         PartOfSpeech 1.00
fired     Verb         PartOfSpeech 1.00
an        Determiner   Sense        1.00  an#determiner
arrow     Noun         PartOfSpeech 1.00
from      Preposition  Sense        1.00  from#preposition
his       Determiner   Sense        1.00  his#determiner
bow       Noun         PartOfSpeech 1.00
at        Preposition  Sense        1.00  at#preposition
a         Determiner   Sense        1.00  a#determiner
deer      Noun         Sense        1.00  deer#noun
so        Adverb       PartOfSpeech 0.51
we        Pronoun      Sense        1.00  we#pronoun
will      Auxiliary    Sense        1.00  will#auxiliary
record    Verb         PartOfSpeech 1.00
a         Determiner   Sense        1.00  a#determiner
record    Noun         PartOfSpeech 1.00
then      Adverb       PartOfSpeech 1.00
go        Verb         PartOfSpeech 1.00
back      Adverb       PartOfSpeech 0.99
home      Adverb       PartOfSpeech 0.51

The Level says how precisely the model answered. Sense is a fine sense, and also the answer for a word whose lemma and part of speech have one sense, such as the. Group is a group of closely related senses. PartOfSpeech means the model told the analysis but not the sense, and a low confidence marks a guess (so). Basic answers ambiguous words at the part-of-speech level. The encoder models answer the words they were trained for at the sense level when they are sure enough. The user guide shows their output for this sentence.

Choosing a Model

Model Real-text sense (share @ precision) Running-text part of speech (open corpus test) UD-EWT test part of speech (convention-mapped) Independent sense evaluation (SemCor) STE challenge set (part of speech) Download Weights / table RAM Latency per sentence First use (model + word table) Download needed
Basic 3.75% @ 78.89% 94.53% (ambiguous 92.64%) 92.28% (ambiguous 89.61%) 3.00% @ 73.84% (top-1 56.37%) 98.65% (ambiguous 97.83%) none 237 KiB 4 MiB 0.11 ms 34 ms + 58 ms no
MiniLM 7.93% @ 96.32% 94.62% (ambiguous 92.79%) 92.66% (ambiguous 90.19%) 8.31% @ 89.01% (top-1 58.67%) 98.65% (ambiguous 97.83%) 22 MiB 5,225 KiB 98 MiB 1.52 ms 443 ms + 60 ms yes
BERT base cased 27.12% @ 94.46% 94.67% (ambiguous 92.86%) 92.62% (ambiguous 90.13%) 26.85% @ 86.70% (top-1 64.99%) 98.20% (ambiguous 97.10%) 104 MiB 10,203 KiB 221 MiB 8.08 ms 684 ms + 56 ms yes

All three models give the same part-of-speech quality, so choose by what else you need:

  • ⚡ Basic: no download. The part of speech of every word, the tense of verbs such as put and read, and the sense of a word that has one. Use it when the part of speech is enough, and as the fallback of the other two.
  • 🎯 BertBaseCased: the model for fine senses. It commits to a sense most often. It is the largest and slowest.
  • ⚖️ MiniLM: a small download and fast answers, mostly at the part-of-speech and group levels.

The part of speech is the dependable part of an answer; treat a sense as a candidate to check. The accuracy chapter explains each column and its caveats.

Documentation

Credits and Licenses

WordSense is MIT licensed. The core, MiniLM and BertBaseCased packages embed derived data and are MIT AND CC-BY-4.0; each carries a NOTICE.md with the credits. DemaConsulting.WordSense.Onnx is MIT. No package contains CC BY-SA material, and the corpus is not shipped.

The word data derives from Open English WordNet 2025 (CC BY 4.0), which carries the Princeton WordNet notice. The sense frequency counts come from WordNet 3.0 (Princeton University) under the WordNet license. The dictionary derives from the public-domain Moby Part-of-Speech List. The inflected forms, annotations and open corpus are CC0 1.0, and the real sentences are CC0 or public domain. SemCor 3.0 and the UD English-EWT treebank (CC BY-SA 4.0) are evaluation sources only: never committed, redistributed or trained on. The encoder models are Apache License 2.0. The user guide has the full list with notices.

Contributing

Contributions are welcome. See CONTRIBUTING.md for development setup, coding standards and the pull request process. The maintainer tools in tools/ are described in tools/README.md.

License

Copyright (c) DEMA Consulting. Licensed under the MIT License. See LICENSE for details.

By contributing to this project, you agree that your contributions will be licensed under the MIT License.

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 is compatible.  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 is compatible.  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.

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-beta.6 0 10/26/2026
0.1.0-beta.5 0 10/25/2026
0.1.0-beta.4 30 10/25/2026
0.1.0-beta.3 39 10/24/2026
0.1.0-beta.2 56 10/19/2026
0.1.0-beta.1 53 10/19/2026