Sentencex 1.0.25

There is a newer version of this package available.
See the version list below for details.
dotnet add package Sentencex --version 1.0.25
                    
NuGet\Install-Package Sentencex -Version 1.0.25
                    
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="Sentencex" Version="1.0.25" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sentencex" Version="1.0.25" />
                    
Directory.Packages.props
<PackageReference Include="Sentencex" />
                    
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 Sentencex --version 1.0.25
                    
#r "nuget: Sentencex, 1.0.25"
                    
#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 Sentencex@1.0.25
                    
#: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=Sentencex&version=1.0.25
                    
Install as a Cake Addin
#tool nuget:?package=Sentencex&version=1.0.25
                    
Install as a Cake Tool

Sentencex — .NET Bindings

NuGet C# Tests

.NET bindings for sentencex, a fast, multi-lingual sentence segmentation library written in Rust.

Requirements

  • .NET 10.0 or later

Supported platforms

  • Android 5.0+ (API level 21) for arm64, x64
  • iOS 12.2+ for arm64
  • Linux for x64, arm64 with glibc 2.35+ (e.g., Ubuntu 22.04+)
  • Mac Catalyst 12.2+ for arm64, x64
  • Mac OS 15.0+ for arm64, x64
  • Windows 7+ for x64

Installation

dotnet add package sentencex

API

All methods live on the static Segmenter class in the Sentencex namespace.

Segmenter.Segment

Splits text into an array of sentence strings.

using Sentencex;

string text = "The James Webb Space Telescope (JWST) is a space telescope. The U.S. NASA led its development.";
string[] sentences = Segmenter.Segment("en", text);

foreach (string sentence in sentences)
    Console.WriteLine(sentence);

Output:

The James Webb Space Telescope (JWST) is a space telescope. 
The U.S. NASA led its development.

Segmenter.GetSentenceBoundaries

using Sentencex;

string text = "Hello world. This is a test.";
SentenceBoundary[] boundaries = Segmenter.GetSentenceBoundaries("en", text);

foreach (SentenceBoundary b in boundaries)
    Console.WriteLine($"[{b.StartIndex}–{b.EndIndex}] \"{b.Text}\" (boundary: '{b.BoundarySymbol}', paragraph: {b.IsParagraphBreak})");

Output

[0–13] "Hello world." (boundary: '.', paragraph: False)
[13–28] "This is a test." (boundary: '.', paragraph: False)
SentenceBoundary properties
Property Type Description
StartIndex int Character index where the sentence starts
EndIndex int Character index where the sentence ends
Text string The sentence text
BoundarySymbol string? The punctuation mark that ended the sentence, or null if none
IsParagraphBreak bool true if this boundary represents a paragraph break

Segmenter.GetSentenceBoundariesSlim

Returns lightweight SentenceBoundarySlim values containing only start and end character indices. Use this when you only need index ranges and want to avoid allocating sentence text strings.

using Sentencex;

string text = "Hello world. This is a test.";
SentenceBoundarySlim[] boundaries = Segmenter.GetSentenceBoundariesSlim("en", text);

foreach (SentenceBoundarySlim b in boundaries)
    Console.WriteLine($"[{b.StartIndex}–{b.EndIndex}] \"{text[b.StartIndex..b.EndIndex]}\"");

Output

[0–13] "Hello world."
[13–28] "This is a test."
SentenceBoundarySlim properties
Property Type Description
StartIndex int Character index where the sentence starts
EndIndex int Character index where the sentence ends

Language support

The first argument to every method is a BCP 47 language code (e.g. "en", "fr", "ja", "ar").

Multiple languages are supported. See the sentencex Rust library documentation for more information.

AOT compatibility

The library is AOT-compatible (IsAotCompatible = true).

Building from source

The native library (sentencex_dotnet) must be compiled from the Rust source before running the managed project.

# From the bindings/dotnet directory
cargo build --release
dotnet build -c Release
dotnet test

License

MIT license

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-ios26.0 is compatible.  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.
  • net10.0

    • No dependencies.
  • net10.0-ios26.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
1.0.28 43 5/22/2026
1.0.27 45 5/22/2026
1.0.26 94 5/18/2026
1.0.25 100 5/11/2026
1.0.24 86 5/7/2026
1.0.23 99 4/28/2026
1.0.22 98 4/27/2026
1.0.21 95 4/24/2026
1.0.21-rc1 78 4/22/2026
1.0.20 114 4/10/2026
1.0.20-rc1 91 4/22/2026
1.0.19 108 4/8/2026