Skip to content

nickhodge/SharpSimpleNLG

Repository files navigation

Build status

SharpSimpleNLG

SharpSimpleNLG is a C# port of the University of Aberdeen simplenlg project. All thanks and acknowledgement for hard work goes to this team.

Please note that this port is behind the most current original simplenlg project.

NuGet

SharpSimpleNLG

Install-Package SharpSimpleNLG

Version News

Version 1.4.0:

  • Thanks to PR from Michael Paulus Updated extensions to be internal so consuming projects don't pick them up.

Version 1.2.0:

  • Thanks to PR from Arash-Sabet now supports .NET Standard 1.6 and .NET 4.6.2; along with VS2017 support. Added to NuGet package (I still hope my packaging is OK!)

Version 1.1.1:

  • Thanks to PR from Andriy Svyrd now supports .NET Standard 1.3. Added to NuGet package (I hope my packaging is OK!)
  • Renaming .csproj to ensure naming of assemblies is OK
  • Move all extension methods (on Enums, mainly) into the SimpleNLG.Extensions namespace to stop pollution (thanks for recommendation Andriy)
  • Fix pathing to Lexicon
  • NuGet packaging fixes

Version 1.0.2:

  • Permit passing of path to default-lexicon.xml into the XMLLexicon constructor
  • thereby permitting a rough-draft (and untested) .NET Core port

Version 1.0.0 First commit/NuGet:

  • Taken the current release of SimpleNLG (V4.4.8 API) version and generated a C# version.
  • Unit tests ported, with added tests for C# specifics (Java idioms in Regex, Collections, equals, strings.substring etc)
  • Current release English, with no HTML generation nor NIHLexicon import

How to Use SharpSimpleNLG?

I have to write some good documentation.

Look at the code in the Syntax Tutorials Unit Test. All these pass, so it is a good starter.

The simplenlg Tutorial is a good resource.

Or look at the general Unit Tests and see what simplenlg can do: SharpSimpleNLG Unit Tests

Building SharpSimpleNLG

  • Visual Studio 2022 with C# 6.0+ idioms used (as this is what I used)
  • I've only used C# null conditionals and string interpolation in a couple of places so C# 6.0 isn't a forced requirement
  • Assembly created has a minimum of .NET Standard 2.0 / .NET 4.6, but there is only use of generic HashSet<T>, Stack<T>, List<T> and Dictionary<K,V> with no async/await - so it should port to earlier .NET if you are into that sort of thing.

Unit Tests

  • 270 Unit tests using NUnit included.

  • Passing Unit tests from the original project have been ported
  • Added Unit tests for this particular port
  • 7 tests do not pass; I think this is related to the configuration of the Unit tests rather than a code issue.

Learnings

I am sure someone somewhere at sometime (most likely me) will find my Learnings on Java to C# interesting and useful.

Outstanding and Future Work

  • contribute back to parent!
  • implement NIHLexicon and MultipleLexicon
  • implement HTMLFormatter
  • re-work Unit test hierarchy
  • continue to track simplenlg changes and additions
  • fluent-style sentence and phrase creation
  • More C#/functional style
  • Enums.ToString() change to Enum "side" hierarchy (because of C#/Java differences)
  • smarter types (eg: widely used Dictionary<string, object> to subclassed to make life easier)
  • Documentation specific to this port

About

C# version of SimpleNLG

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •