Add NER interace.
This commit is contained in:
parent
9f87349ec0
commit
bd910918e4
12
BotSharp.Core/Abstractions/INlpNer.cs
Normal file
12
BotSharp.Core/Abstractions/INlpNer.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using BotSharp.Core.Engines.NERs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.Core.Abstractions
|
||||
{
|
||||
public interface INlpNer
|
||||
{
|
||||
List<OntologyEnum> Ontologies { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNetToolkit" Version="1.5.2" />
|
||||
<PackageReference Include="DotNetToolkit" Version="1.5.3" />
|
||||
<PackageReference Include="EntityFrameworkCore.BootKit" Version="1.8.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.1.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
|
|
|
|||
|
|
@ -16,13 +16,24 @@ using System.Text.RegularExpressions;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BotSharp.Core.Engines.CRFsuite
|
||||
namespace BotSharp.Core.Engines.NERs
|
||||
{
|
||||
public class CRFsuiteEntityRecognizer : INlpPipeline
|
||||
public class CRFsuiteEntityRecognizer : INlpPipeline, INlpNer
|
||||
{
|
||||
public IConfiguration Configuration { get; set; }
|
||||
public PipeSettings Settings { get; set; }
|
||||
|
||||
public List<OntologyEnum> Ontologies
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<OntologyEnum>
|
||||
{
|
||||
OntologyEnum.DateTime
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> Train(Agent agent, NlpDoc doc, PipeModel meta)
|
||||
{
|
||||
var dc = new DefaultDataContextLoader().GetDefaultDc();
|
||||
12
BotSharp.Core/Engines/NERs/DucklingEntityRecognizer.cs
Normal file
12
BotSharp.Core/Engines/NERs/DucklingEntityRecognizer.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using BotSharp.Core.Abstractions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.Core.Engines.NERs
|
||||
{
|
||||
public class DucklingEntityRecognizer : INlpNer
|
||||
{
|
||||
public List<OntologyEnum> Ontologies => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
61
BotSharp.Core/Engines/NERs/OntologyEnum.cs
Normal file
61
BotSharp.Core/Engines/NERs/OntologyEnum.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.Core.Engines.NERs
|
||||
{
|
||||
/// <summary>
|
||||
/// Ontology encompasses a representation, formal naming, and definition of the categories, properties, and relations between the concepts, data, and entities that substantiate one, many, or all domains.
|
||||
/// </summary>
|
||||
public enum OntologyEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 6 miles
|
||||
/// </summary>
|
||||
Distance = 1,
|
||||
/// <summary>
|
||||
/// 3 mins
|
||||
/// </summary>
|
||||
Duration = 2,
|
||||
/// <summary>
|
||||
/// team@botsharp.com
|
||||
/// </summary>
|
||||
Email = 3,
|
||||
/// <summary>
|
||||
/// eighty eight
|
||||
/// </summary>
|
||||
Numeral = 4,
|
||||
/// <summary>
|
||||
/// 33rd
|
||||
/// </summary>
|
||||
Ordinal = 5,
|
||||
/// <summary>
|
||||
/// +1 (312) 292-6741
|
||||
/// </summary>
|
||||
PhoneNumber = 6,
|
||||
/// <summary>
|
||||
/// 3 cups of sugar
|
||||
/// </summary>
|
||||
Quantity = 7,
|
||||
/// <summary>
|
||||
/// 80F
|
||||
/// </summary>
|
||||
Temperature = 8,
|
||||
/// <summary>
|
||||
/// today at 9am
|
||||
/// </summary>
|
||||
DateTime = 9,
|
||||
/// <summary>
|
||||
/// https://github.com/Oceania2018/BotSharp
|
||||
/// </summary>
|
||||
Url = 10,
|
||||
/// <summary>
|
||||
/// 4 gallons
|
||||
/// </summary>
|
||||
Volume = 11,
|
||||
/// <summary>
|
||||
/// Chicago
|
||||
/// </summary>
|
||||
Location = 12
|
||||
}
|
||||
}
|
||||
22
BotSharp.Core/Engines/NERs/WitAiEntityRecognizer.cs
Normal file
22
BotSharp.Core/Engines/NERs/WitAiEntityRecognizer.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using BotSharp.Core.Abstractions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.Core.Engines.NERs
|
||||
{
|
||||
public class WitAiEntityRecognizer : INlpNer
|
||||
{
|
||||
public List<OntologyEnum> Ontologies
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<OntologyEnum>
|
||||
{
|
||||
OntologyEnum.DateTime,
|
||||
OntologyEnum.Location
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
BotSharp.RestApi/Ontology/EntityController.cs
Normal file
23
BotSharp.RestApi/Ontology/EntityController.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using BotSharp.Core.Engines;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.RestApi.Ontology
|
||||
{
|
||||
[Route("v1/[controller]/[action]")]
|
||||
public class EntityController : ControllerBase
|
||||
{
|
||||
private readonly IBotPlatform _platform;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize dialog controller and get a platform instance
|
||||
/// </summary>
|
||||
/// <param name="platform"></param>
|
||||
public EntityController(IBotPlatform platform)
|
||||
{
|
||||
_platform = platform;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -2,7 +2,9 @@
|
|||
### The Open Source AI Chatbot Platform Builder for Enterprise
|
||||
###
|
||||
|
||||
**BotSharp** is an open source AI chatbot platform builder's framework. It's not only a bot builder but also a complete out of box toolkit for building up a functional chabot platform which utilize aritifical intelligence. It's witten in C# running on .Net Core that is full cross-platform framework. C# is a enterprise grade programming language which is widely used to code business logic in information management related system. BotSharp adopts machine learning algrithm in C/C++ interfaces directly which skips the python interfaces. That will facilitate the feature of the typed language C#, and be more easier when refactoring code in system scope.
|
||||
**BotSharp** is an open source machine learning framework for AI Bot platform builder. This project involves natural language understanding, computer vision and audio processing technologies, and aims to promote the development and application of intelligent robot assistants in enterprise information systems. Out-of-the-box machine learning algorithms allow ordinary programmers to develop artificial intelligence applications faster and easier.
|
||||
|
||||
It's witten in C# running on .Net Core that is full cross-platform framework. C# is a enterprise grade programming language which is widely used to code business logic in information management related system. More friendly to corporate developers. BotSharp adopts machine learning algrithm in C/C++ interfaces directly which skips the python interfaces. That will facilitate the feature of the typed language C#, and be more easier when refactoring code in system scope.
|
||||
|
||||
Why we do this? because we all know python is not friendly programming language for enterprise developers, it's not only because it's low performance but also it's a type weak language, it will be a disater if you use python to build your bussiness system.
|
||||
|
||||
|
|
@ -20,6 +22,7 @@ BotSharp is in accordance with components princple strictly, decouples every par
|
|||
### How to Install
|
||||
````shell
|
||||
PM> Install-Package BotSharp.Core
|
||||
PM> Install-Package BotSharp.RestApi
|
||||
````
|
||||
|
||||
### Documents
|
||||
|
|
|
|||
2226
TrainingFiles/1.txt
2226
TrainingFiles/1.txt
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue