Sentencex 1.0.25
See the version list below for details.
dotnet add package Sentencex --version 1.0.25
NuGet\Install-Package Sentencex -Version 1.0.25
<PackageReference Include="Sentencex" Version="1.0.25" />
<PackageVersion Include="Sentencex" Version="1.0.25" />
<PackageReference Include="Sentencex" />
paket add Sentencex --version 1.0.25
#r "nuget: Sentencex, 1.0.25"
#:package Sentencex@1.0.25
#addin nuget:?package=Sentencex&version=1.0.25
#tool nuget:?package=Sentencex&version=1.0.25
Sentencex — .NET Bindings
.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
| Product | Versions 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. |
-
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.