diff --git a/README.md b/README.md
index 34f9a66..394b507 100644
--- a/README.md
+++ b/README.md
@@ -20,8 +20,8 @@ If you like SymSpell, try [**SeekStorm**](https://github.com/SeekStorm/SeekStorm
```
-Copyright (c) 2022 Wolf Garbe
-Version: 6.7.2
+Copyright (c) 2025 Wolf Garbe
+Version: 6.7.3
Author: Wolf Garbe
Maintainer: Wolf Garbe
URL: https://github.com/wolfgarbe/symspell
@@ -29,7 +29,7 @@ Description: https://seekstorm.com/blog/1000x-spelling-correction/
MIT License
-Copyright (c) 2022 Wolf Garbe
+Copyright (c) 2025 Wolf Garbe
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -489,6 +489,13 @@ https://www.sciencedirect.com/science/article/pii/S2215016124001225
2. Option to preserve case (upper/lower case) of input term.
3. Open source the code for creating custom frequency dictionaries in any language and size as intersection between Google Books Ngram data (Provides representative word frequencies) and SCOWL Spell Checker Oriented Word Lists (Ensures genuine English vocabulary).
+#### Changes in v6.7.3
+
+- TargetFrameworks changed from `netstandard2.0;net461;net47;netcoreapp3.0` to `netstandard2.0;net9.0`.
+- PackageReferences updated.
+- In SymSpell.Test all Assert.AreEqual changed to Assert.That
+- Incorporates PR #126 that fixes null reference exception in CommitStaged (#139).
+
#### Changes in v6.7.2
1. Exception fixed in WordSegmentation
diff --git a/SymSpell.Benchmark/SymSpell.Benchmark.csproj b/SymSpell.Benchmark/SymSpell.Benchmark.csproj
index d3e2195..c1b262c 100644
--- a/SymSpell.Benchmark/SymSpell.Benchmark.csproj
+++ b/SymSpell.Benchmark/SymSpell.Benchmark.csproj
@@ -1,8 +1,8 @@
-
+
Exe
- netcoreapp3.0
+ net9.0
@@ -15,4 +15,9 @@
+
+
+
+
+
diff --git a/SymSpell.CommandLine/SymSpell.CommandLine.csproj b/SymSpell.CommandLine/SymSpell.CommandLine.csproj
index 41fd732..b3649c9 100644
--- a/SymSpell.CommandLine/SymSpell.CommandLine.csproj
+++ b/SymSpell.CommandLine/SymSpell.CommandLine.csproj
@@ -1,12 +1,17 @@
-
+
Exe
- netcoreapp3.0
+ net9.0
+
+
+
+
+
diff --git a/SymSpell.CompoundDemo/SymSpell.CompoundDemo.csproj b/SymSpell.CompoundDemo/SymSpell.CompoundDemo.csproj
index f96c66b..ae00c91 100644
--- a/SymSpell.CompoundDemo/SymSpell.CompoundDemo.csproj
+++ b/SymSpell.CompoundDemo/SymSpell.CompoundDemo.csproj
@@ -1,8 +1,8 @@
-
+
Exe
- netcoreapp3.0
+ net9.0
@@ -15,4 +15,9 @@
+
+
+
+
+
diff --git a/SymSpell.Demo/SymSpell.Demo.csproj b/SymSpell.Demo/SymSpell.Demo.csproj
index 0d80b95..304acde 100644
--- a/SymSpell.Demo/SymSpell.Demo.csproj
+++ b/SymSpell.Demo/SymSpell.Demo.csproj
@@ -2,7 +2,7 @@
Exe
- netcoreapp3.0
+ net9.0
@@ -15,4 +15,9 @@
+
+
+
+
+
diff --git a/SymSpell.SegmentationDemo/SymSpell.SegmentationDemo.csproj b/SymSpell.SegmentationDemo/SymSpell.SegmentationDemo.csproj
index 3d3cf80..c63685f 100644
--- a/SymSpell.SegmentationDemo/SymSpell.SegmentationDemo.csproj
+++ b/SymSpell.SegmentationDemo/SymSpell.SegmentationDemo.csproj
@@ -1,8 +1,8 @@
-
+
Exe
- netcoreapp3.0
+ net9.0
@@ -14,5 +14,10 @@
+
+
+
+
+
diff --git a/SymSpell.Test/SymSpell.Test.cs b/SymSpell.Test/SymSpell.Test.cs
index c24bf4a..761ec40 100644
--- a/SymSpell.Test/SymSpell.Test.cs
+++ b/SymSpell.Test/SymSpell.Test.cs
@@ -14,23 +14,23 @@ public void WordsWithSharedPrefixShouldRetainCounts()
symSpell.CreateDictionaryEntry("pipe", 5);
symSpell.CreateDictionaryEntry("pips", 10);
var result = symSpell.Lookup("pipe", SymSpell.Verbosity.All, 1);
- Assert.AreEqual(2, result.Count);
- Assert.AreEqual("pipe", result[0].term);
- Assert.AreEqual(5, result[0].count);
- Assert.AreEqual("pips", result[1].term);
- Assert.AreEqual(10, result[1].count);
+ Assert.That(result.Count, Is.EqualTo(2));
+ Assert.That(result[0].term, Is.EqualTo("pipe"));
+ Assert.That(result[0].count, Is.EqualTo(5));
+ Assert.That(result[1].term, Is.EqualTo("pips"));
+ Assert.That(result[1].count, Is.EqualTo(10));
result = symSpell.Lookup("pips", SymSpell.Verbosity.All, 1);
- Assert.AreEqual(2, result.Count);
- Assert.AreEqual("pips", result[0].term);
- Assert.AreEqual(10, result[0].count);
- Assert.AreEqual("pipe", result[1].term);
- Assert.AreEqual(5, result[1].count);
+ Assert.That(result.Count, Is.EqualTo(2));
+ Assert.That(result[0].term, Is.EqualTo("pips"));
+ Assert.That(result[0].count, Is.EqualTo(10));
+ Assert.That(result[1].term, Is.EqualTo("pipe"));
+ Assert.That(result[1].count, Is.EqualTo(5));
result = symSpell.Lookup("pip", SymSpell.Verbosity.All, 1);
- Assert.AreEqual(2, result.Count);
- Assert.AreEqual("pips", result[0].term);
- Assert.AreEqual(10, result[0].count);
- Assert.AreEqual("pipe", result[1].term);
- Assert.AreEqual(5, result[1].count);
+ Assert.That(result.Count, Is.EqualTo(2));
+ Assert.That(result[0].term, Is.EqualTo("pips"));
+ Assert.That(result[0].count, Is.EqualTo(10));
+ Assert.That(result[1].term, Is.EqualTo("pipe"));
+ Assert.That(result[1].count, Is.EqualTo(5));
}
[Test]
@@ -39,9 +39,9 @@ public void AddAdditionalCountsShouldNotAddWordAgain()
var symSpell = new SymSpell();
var word = "hello";
symSpell.CreateDictionaryEntry(word, 11);
- Assert.AreEqual(1, symSpell.WordCount);
+ Assert.That(symSpell.WordCount, Is.EqualTo(1));
symSpell.CreateDictionaryEntry(word, 3);
- Assert.AreEqual(1, symSpell.WordCount);
+ Assert.That(symSpell.WordCount, Is.EqualTo(1));
}
[Test]
public void AddAdditionalCountsShouldIncreaseCount()
@@ -52,12 +52,12 @@ public void AddAdditionalCountsShouldIncreaseCount()
var result = symSpell.Lookup(word, SymSpell.Verbosity.Top);
long count = 0;
if (result.Count == 1) count = result[0].count;
- Assert.AreEqual(11, count);
+ Assert.That(count, Is.EqualTo(11));
symSpell.CreateDictionaryEntry(word, 3);
result = symSpell.Lookup(word, SymSpell.Verbosity.Top);
count = 0;
if (result.Count == 1) count = result[0].count;
- Assert.AreEqual(11 + 3, count);
+ Assert.That(count, Is.EqualTo(11+3));
}
[Test]
public void AddAdditionalCountsShouldNotOverflow()
@@ -68,12 +68,12 @@ public void AddAdditionalCountsShouldNotOverflow()
var result = symSpell.Lookup(word, SymSpell.Verbosity.Top);
long count = 0;
if (result.Count == 1) count = result[0].count;
- Assert.AreEqual(long.MaxValue - 10, count);
+ Assert.That(count, Is.EqualTo(long.MaxValue - 10));
symSpell.CreateDictionaryEntry(word, 11);
result = symSpell.Lookup(word, SymSpell.Verbosity.Top);
count = 0;
if (result.Count == 1) count = result[0].count;
- Assert.AreEqual(long.MaxValue, count);
+ Assert.That(count, Is.EqualTo(long.MaxValue));
}
[Test]
public void VerbosityShouldControlLookupResults()
@@ -83,11 +83,11 @@ public void VerbosityShouldControlLookupResults()
symSpell.CreateDictionaryEntry("steams", 2);
symSpell.CreateDictionaryEntry("steem", 3);
var result = symSpell.Lookup("steems", SymSpell.Verbosity.Top, 2);
- Assert.AreEqual(1, result.Count);
+ Assert.That(result.Count, Is.EqualTo(1));
result = symSpell.Lookup("steems", SymSpell.Verbosity.Closest, 2);
- Assert.AreEqual(2, result.Count);
+ Assert.That(result.Count, Is.EqualTo(2));
result = symSpell.Lookup("steems", SymSpell.Verbosity.All, 2);
- Assert.AreEqual(3, result.Count);
+ Assert.That(result.Count, Is.EqualTo(3));
}
[Test]
public void LookupShouldReturnMostFrequent()
@@ -97,9 +97,9 @@ public void LookupShouldReturnMostFrequent()
symSpell.CreateDictionaryEntry("steamb", 6);
symSpell.CreateDictionaryEntry("steamc", 2);
var result = symSpell.Lookup("steam", SymSpell.Verbosity.Top, 2);
- Assert.AreEqual(1, result.Count);
- Assert.AreEqual("steamb", result[0].term);
- Assert.AreEqual(6, result[0].count);
+ Assert.That(result.Count, Is.EqualTo(1));
+ Assert.That(result[0].term, Is.EqualTo("steamb"));
+ Assert.That(result[0].count, Is.EqualTo(6));
}
[Test]
public void LookupShouldFindExactMatch()
@@ -109,8 +109,8 @@ public void LookupShouldFindExactMatch()
symSpell.CreateDictionaryEntry("steamb", 6);
symSpell.CreateDictionaryEntry("steamc", 2);
var result = symSpell.Lookup("steama", SymSpell.Verbosity.Top, 2);
- Assert.AreEqual(1, result.Count);
- Assert.AreEqual("steama", result[0].term);
+ Assert.That(result.Count, Is.EqualTo(1));
+ Assert.That(result[0].term, Is.EqualTo("steama"));
}
[Test]
public void LookupShouldNotReturnNonWordDelete()
@@ -118,9 +118,9 @@ public void LookupShouldNotReturnNonWordDelete()
var symSpell = new SymSpell(16, 2, 7, 10);
symSpell.CreateDictionaryEntry("pawn", 10);
var result = symSpell.Lookup("paw", SymSpell.Verbosity.Top, 0);
- Assert.AreEqual(0, result.Count);
+ Assert.That(result.Count, Is.EqualTo(0));
result = symSpell.Lookup("awn", SymSpell.Verbosity.Top, 0);
- Assert.AreEqual(0, result.Count);
+ Assert.That(result.Count, Is.EqualTo(0));
}
[Test]
public void LookupShouldNotReturnLowCountWord()
@@ -128,7 +128,7 @@ public void LookupShouldNotReturnLowCountWord()
var symSpell = new SymSpell(16, 2, 7, 10);
symSpell.CreateDictionaryEntry("pawn", 1);
var result = symSpell.Lookup("pawn", SymSpell.Verbosity.Top, 0);
- Assert.AreEqual(0, result.Count);
+ Assert.That(result.Count, Is.EqualTo(0));
}
[Test]
public void LookupShouldNotReturnLowCountWordThatsAlsoDeleteWord()
@@ -137,7 +137,7 @@ public void LookupShouldNotReturnLowCountWordThatsAlsoDeleteWord()
symSpell.CreateDictionaryEntry("flame", 20);
symSpell.CreateDictionaryEntry("flam", 1);
var result = symSpell.Lookup("flam", SymSpell.Verbosity.Top, 0);
- Assert.AreEqual(0, result.Count);
+ Assert.That(result.Count, Is.EqualTo(0));
}
//[Test]
//public void DeleteInSuggestionPrefixEdgeCases()
@@ -194,7 +194,7 @@ public void LookupShouldReplicateNoisyResults()
{
resultSum += symSpell.Lookup(testList[i], verbosity, symSpell.MaxDictionaryEditDistance ).Count;
}
- Assert.AreEqual( 4955 , resultSum);
+ Assert.That(resultSum, Is.EqualTo(4955));
}
}
}
diff --git a/SymSpell.Test/SymSpell.Test.csproj b/SymSpell.Test/SymSpell.Test.csproj
index 45d6434..6c0dec7 100644
--- a/SymSpell.Test/SymSpell.Test.csproj
+++ b/SymSpell.Test/SymSpell.Test.csproj
@@ -1,19 +1,25 @@
- net461;netcoreapp3.0;
+ preview
+ net9.0
symspellTest
symspellTest
-
-
-
+
+
+
+
+
+
+
+
diff --git a/SymSpell/SymSpell.cs b/SymSpell/SymSpell.cs
index 7304dfd..240facc 100644
--- a/SymSpell/SymSpell.cs
+++ b/SymSpell/SymSpell.cs
@@ -11,15 +11,15 @@
// 2. mistakenly omitted space between two correct words led to one incorrect combined term
// 3. multiple independent input terms with/without spelling errors
-// Copyright (C) 2022 Wolf Garbe
-// Version: 6.7.2
+// Copyright (C) 2025 Wolf Garbe
+// Version: 6.7.3
// Author: Wolf Garbe wolf.garbe@seekstorm.com
// Maintainer: Wolf Garbe wolf.garbe@seekstorm.com
// URL: https://github.com/wolfgarbe/symspell
// Description: https://seekstorm.com/blog/1000x-spelling-correction/
//
// MIT License
-// Copyright (c) 2022 Wolf Garbe
+// Copyright (c) 2025 Wolf Garbe
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
@@ -224,9 +224,9 @@ public bool CreateDictionaryEntry(string key, Int64 count, SuggestionStage stagi
//even if the same term existed before in the dictionary as an edit from another word
if (key.Length > maxDictionaryWordLength) maxDictionaryWordLength = key.Length;
- if (deletes == null) this.deletes = new Dictionary(initialCapacity); //initialisierung
+ if (deletes == null) deletes = new Dictionary(initialCapacity); //initialisierung
- //create deletes
+ //create deletes
var edits = EditsPrefix(key);
// if not staging suggestions, put directly into main data structure
if (staging != null)
@@ -353,7 +353,6 @@ public bool LoadDictionary(Stream corpusStream, int termIndex, int countIndex, c
}
}
}
- if (this.deletes == null) this.deletes = new Dictionary(staging.DeleteCount);
CommitStaged(staging);
return true;
}
@@ -390,7 +389,6 @@ public bool CreateDictionary(Stream corpusStream)
}
}
}
- if (this.deletes == null) this.deletes = new Dictionary(staging.DeleteCount);
CommitStaged(staging);
return true;
}
@@ -410,6 +408,7 @@ public void PurgeBelowThresholdWords()
/// The SuggestionStage object storing the staged data.
public void CommitStaged(SuggestionStage staging)
{
+ if (deletes == null) deletes = new Dictionary(staging.DeleteCount);
staging.CommitTo(deletes);
}
diff --git a/SymSpell/SymSpell.csproj b/SymSpell/SymSpell.csproj
index 8c31c01..77a90e9 100644
--- a/SymSpell/SymSpell.csproj
+++ b/SymSpell/SymSpell.csproj
@@ -1,7 +1,8 @@
- netstandard2.0;net461;net47;netcoreapp3.0
+ preview
+ netstandard2.0;net9.0
pdbonly
True
True
@@ -9,13 +10,13 @@
Wolf Garbe <wolf.garbe@seekstorm.com>
SymSpell
Spelling correction & Fuzzy search: 1 million times faster through Symmetric Delete spelling correction algorithm
- Copyright (C) 2022 Wolf Garbe
+ Copyright (C) 2025 Wolf Garbe
https://github.com/wolfgarbe/symspell
https://github.com/wolfgarbe
Git
symspell, spelling-correction, spellcheck, spell-check, spelling, fuzzy-search, approximate-string-matching, edit-distance, levenshtein, levenshtein-distance, damerau-levenshtein, word segmentation
Exception fixed in WordSegmentation
- 6.7.2
+ 6.7.3
MIT
@@ -50,4 +51,9 @@
+
+
+
+
+