nickhodge / SharpSimpleNLG

C# version of SimpleNLG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

NuGet

SharpSimpleNLG

Install-Package SharpSimpleNLG

Version News

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 2017 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 1.3 / .NET 4.5.2, 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

Questions? You can find me on Twitter @RealNickHodge or email Nick Hodge

About

C# version of SimpleNLG

License:Other


Languages

Language:C# 83.9%Language:Java 14.2%Language:HTML 1.9%