This commit is contained in:
botsharp2018 2018-10-18 22:47:30 -05:00
commit 0c3fdbc192
38 changed files with 200 additions and 21 deletions

View file

@ -43,8 +43,11 @@ Naive Bayes Classifier</Description>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Bigtree.Algorithm" Version="0.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Bigtree.MachineLearning\Bigtree.Algorithm\Bigtree.Algorithm.csproj" />
</ItemGroup>
</Project> </Project>

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using Bigtree.Algorithm.Matrix; //using Bigtree.Algorithm.Matrix;
using BotSharp.NLP.Tokenize; using BotSharp.NLP.Tokenize;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -35,7 +35,7 @@ namespace BotSharp.NLP.Featuring
public List<Tuple<string, int>> Dictionary { get; set; } public List<Tuple<string, int>> Dictionary { get; set; }
public List<string> Features { get; set; } public List<string> Features { get; set; }
public Shape Shape { get; set; } //public Shape Shape { get; set; }
public string ModelFile { get; set; } public string ModelFile { get; set; }
public void Vectorize(List<string> features) public void Vectorize(List<string> features)

View file

@ -1,4 +1,4 @@
using Bigtree.Algorithm.Matrix; //using Bigtree.Algorithm.Matrix;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@ -35,7 +35,7 @@ namespace BotSharp.NLP.Featuring
/// <summary> /// <summary>
/// Array shape /// Array shape
/// </summary> /// </summary>
Shape Shape { get; set; } //Shape Shape { get; set; }
/// <summary> /// <summary>
/// Pre-trained model file path /// Pre-trained model file path

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using Bigtree.Algorithm.Matrix; //using Bigtree.Algorithm.Matrix;
using BotSharp.NLP.Tokenize; using BotSharp.NLP.Tokenize;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -39,7 +39,7 @@ namespace BotSharp.NLP.Featuring
public List<Tuple<string, int>> Dictionary { get; set; } public List<Tuple<string, int>> Dictionary { get; set; }
public List<string> Features { get; set; } public List<string> Features { get; set; }
public Shape Shape { get; set; } //public Shape Shape { get; set; }
public string ModelFile { get; set; } public string ModelFile { get; set; }
public void Extract(Sentence sentence) public void Extract(Sentence sentence)

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Bigtree.Algorithm.Matrix; //using Bigtree.Algorithm.Matrix;
using Txt2Vec; using Txt2Vec;
namespace BotSharp.NLP.Featuring namespace BotSharp.NLP.Featuring
@ -12,7 +12,7 @@ namespace BotSharp.NLP.Featuring
public List<Sentence> Sentences { get; set; } public List<Sentence> Sentences { get; set; }
public List<Tuple<string, int>> Dictionary { get; set; } public List<Tuple<string, int>> Dictionary { get; set; }
public List<string> Features { get; set; } public List<string> Features { get; set; }
public Shape Shape { get; set; } //public Shape Shape { get; set; }
public VectorGenerator Vg { get; set; } public VectorGenerator Vg { get; set; }
public int SentenceVectorSize { get; set; } public int SentenceVectorSize { get; set; }
public string ModelFile { get; set; } public string ModelFile { get; set; }

View file

@ -1,7 +1,7 @@
{ {
// if you want to override platform setting, please set corresponding value, otherwise you don't need this section. // if you want to override platform setting, please set corresponding value, otherwise you don't need this section.
"dialogflowAi": { "dialogflowAi": {
"botEngine": "BotSharpNLU", "botEngine": "BotSharpNLU",
"agentStorage": "AgentStorageInRedis" "agentStorage": "AgentStorageInMemory"
} }
} }

View file

@ -1,12 +1,12 @@
{ {
"version": "0.1.0", "version": "0.1.0",
"assemblies": "BotSharp.Core", "assemblies": "BotSharp.Core",
"platformModuleName": "DialogflowAi", "platformModuleName": "ArticulateAi",
"machineLearning": { "machineLearning": {
"dataDir": "D:\\Projects\\BotSharp\\Data" "dataDir": "D:\\Projects\\BotSharp\\Data"
}, },
"moduleBasePath": "C:\\Users\\haipi\\Documents\\Projects", "moduleBasePath": "C:\\Users\\haipi\\Documents\\Projects",
"modules": [ "modules": [

View file

@ -24,16 +24,24 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Models",
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
ARTICULATE|Any CPU = ARTICULATE|Any CPU
ARTICULATE|x64 = ARTICULATE|x64
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
DIALOGFLOW|Any CPU = DIALOGFLOW|Any CPU DIALOGFLOW|Any CPU = DIALOGFLOW|Any CPU
DIALOGFLOW|x64 = DIALOGFLOW|x64 DIALOGFLOW|x64 = DIALOGFLOW|x64
RASA|Any CPU = RASA|Any CPU
RASA|x64 = RASA|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64 Release|x64 = Release|x64
Test|Any CPU = Test|Any CPU Test|Any CPU = Test|Any CPU
Test|x64 = Test|x64 Test|x64 = Test|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{95780673-2A1A-4953-962F-C46CBFDD07FF}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.ARTICULATE|x64.ActiveCfg = ARTICULATE|x64
{95780673-2A1A-4953-962F-C46CBFDD07FF}.ARTICULATE|x64.Build.0 = ARTICULATE|x64
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|Any CPU.Build.0 = Debug|Any CPU {95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|x64.ActiveCfg = Debug|x64 {95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|x64.ActiveCfg = Debug|x64
@ -42,6 +50,10 @@ Global
{95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU {95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64 {95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64
{95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64 {95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64
{95780673-2A1A-4953-962F-C46CBFDD07FF}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.RASA|Any CPU.Build.0 = RASA|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.RASA|x64.ActiveCfg = RASA|x64
{95780673-2A1A-4953-962F-C46CBFDD07FF}.RASA|x64.Build.0 = RASA|x64
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|Any CPU.Build.0 = Release|Any CPU {95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|Any CPU.Build.0 = Release|Any CPU
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|x64.ActiveCfg = Release|x64 {95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|x64.ActiveCfg = Release|x64
@ -58,6 +70,10 @@ Global
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU {03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|x64.ActiveCfg = Debug|x64 {03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|x64.ActiveCfg = Debug|x64
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|x64.Build.0 = Debug|x64 {03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|x64.Build.0 = Debug|x64
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.RASA|Any CPU.ActiveCfg = Release|Any CPU
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.RASA|Any CPU.Build.0 = Release|Any CPU
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.RASA|x64.ActiveCfg = Release|x64
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.RASA|x64.Build.0 = Release|x64
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|Any CPU.ActiveCfg = Release|Any CPU {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|Any CPU.Build.0 = Release|Any CPU {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|Any CPU.Build.0 = Release|Any CPU
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|x64.ActiveCfg = Release|x64 {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|x64.ActiveCfg = Release|x64
@ -74,6 +90,10 @@ Global
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64 {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64 {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.RASA|Any CPU.Build.0 = RASA|Any CPU
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.RASA|x64.ActiveCfg = RASA|x64
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.RASA|x64.Build.0 = RASA|x64
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|Any CPU.ActiveCfg = Release|Any CPU {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|Any CPU.Build.0 = Release|Any CPU {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|Any CPU.Build.0 = Release|Any CPU
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|x64.ActiveCfg = Release|x64 {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|x64.ActiveCfg = Release|x64
@ -90,6 +110,10 @@ Global
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64 {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64 {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.RASA|Any CPU.Build.0 = RASA|Any CPU
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.RASA|x64.ActiveCfg = RASA|x64
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.RASA|x64.Build.0 = RASA|x64
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|Any CPU.ActiveCfg = Release|Any CPU {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|Any CPU.Build.0 = Release|Any CPU {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|Any CPU.Build.0 = Release|Any CPU
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|x64.ActiveCfg = Release|x64 {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|x64.ActiveCfg = Release|x64
@ -106,6 +130,10 @@ Global
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64 {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64 {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.RASA|Any CPU.Build.0 = RASA|Any CPU
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.RASA|x64.ActiveCfg = RASA|x64
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.RASA|x64.Build.0 = RASA|x64
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|Any CPU.ActiveCfg = Release|Any CPU {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|Any CPU.Build.0 = Release|Any CPU {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|Any CPU.Build.0 = Release|Any CPU
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|x64.ActiveCfg = Release|x64 {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|x64.ActiveCfg = Release|x64
@ -122,6 +150,10 @@ Global
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.RASA|Any CPU.ActiveCfg = Release|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.RASA|Any CPU.Build.0 = Release|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.RASA|x64.ActiveCfg = Release|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.RASA|x64.Build.0 = Release|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|Any CPU.ActiveCfg = Release|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|Any CPU.Build.0 = Release|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|Any CPU.Build.0 = Release|Any CPU
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|x64.ActiveCfg = Release|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|x64.ActiveCfg = Release|Any CPU
@ -138,6 +170,10 @@ Global
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.RASA|Any CPU.ActiveCfg = Release|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.RASA|Any CPU.Build.0 = Release|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.RASA|x64.ActiveCfg = Release|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.RASA|x64.Build.0 = Release|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|Any CPU.ActiveCfg = Release|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|Any CPU.Build.0 = Release|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|Any CPU.Build.0 = Release|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|x64.ActiveCfg = Release|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|x64.ActiveCfg = Release|Any CPU

View file

@ -49,6 +49,10 @@ Some Features
Quick Started Quick Started
------------- -------------
* Make sure that you have downloaded the related components.
* See the file "BotSharp\BotSharp.WebHost\Settings\app.json",change the path to your own project's path.
* Select dialogflow or articulate to make it work.
You can use docker compose to run BotSharp quickly, make sure you've got `Docker`_ installed. You can use docker compose to run BotSharp quickly, make sure you've got `Docker`_ installed.
:: ::
@ -56,7 +60,7 @@ You can use docker compose to run BotSharp quickly, make sure you've got `Docker
PS D:\> cd BotSharp PS D:\> cd BotSharp
PS D:\BotSharp\> docker-compose -f dockerfiles/docker-compose-articulateui.yml up PS D:\BotSharp\> docker-compose -f dockerfiles/docker-compose-articulateui.yml up
Point your web browser at http://localhost:3000 and enjoy BotSharp with Articulate-UI. Point your web browser at http://localhost:**** and enjoy BotSharp with Articulate-UI.
Extension Libraries Extension Libraries
----------------- -----------------

View file

@ -7,6 +7,14 @@ services:
networks: ['botsharp-network'] networks: ['botsharp-network']
environment: environment:
- API_URL - API_URL
api:
image: samtecspg/articulate-api:0.12.1
ports: ['0.0.0.0:7500:7500']
networks: ['botsharp-network']
entrypoint: ['node', 'start.js']
environment:
- SWAGGER_BASE_PATH
botsharp: botsharp:
image: botsharpdocker/botsharp-rasa:latest image: botsharpdocker/botsharp-rasa:latest

View file

@ -47,6 +47,8 @@ templates_path = ['_templates']
# You can specify multiple suffix as a list of string: # You can specify multiple suffix as a list of string:
# #
# source_suffix = ['.rst', '.md'] # source_suffix = ['.rst', '.md']
from recommonmark.parser import CommonMarkParser
source_parsers = {'.md': CommonMarkParser}
source_suffix = ['.rst', '.md'] source_suffix = ['.rst', '.md']
# The master toctree document. # The master toctree document.

View file

@ -52,7 +52,8 @@ The main documentation for the site is organized into a couple sections:
.. toctree:: .. toctree::
:maxdepth: 3 :maxdepth: 3
:caption: User Documentation: :caption: User Documentation:
overview
installation installation
agent/import-agent agent/import-agent
agent/train-agent agent/train-agent

56
docs/overview.md Normal file
View file

@ -0,0 +1,56 @@
# BotSharp Overview
*Bo Peng & Haiping Chen --10/10/2018*
BotSharp is an open source machine learning framework for AI Bot platform builder. This project involves natural language understanding and audio processing technologies, and aims to promote the development and application of intelligent robot assistants in information systems. Out of the box machine learning algorithms allow ordinary programmers to develop artificial intelligence applications faster and easier.
BotSharp is an high compatible and high scalable platform builder. It is in accordance with components princple strictly, decouples every part that needed in the platform builder. So you can choose different UI/UX, or pick up a different NLP Tagger, or select a more advanced algrithm to do NER task. They are all modulized based on unfied interfaces.
![ ](./static/screenshots/BotSharp_arch.png "BotSharp Architecture Chart")
From the chart ahead we can see that based on botsharp you can launch your own chatbot platform with 3 components:
- Storage module: Botsharp supports memory and redis DB 2 methods.
- Corpus extractor: To format data in template to feed into botsharp trainer.
- NLU engine. Botsharp initiate a exclusive NLU engine and are open to users.
BotSharp let you build conversational interfaces on top of your products and services by providing a natural language understanding (NLU) engine to process and understand natural language inut.
Tradational computer interfaces require structured data, which makes the use of these interfaces unnatural and sometime difficult. While machine learning interfaces are data driven, which computer can find the logic or information behind the unstructured data(sentences).
For example. an simple request may like "Can you play country music?". Other users may ask "play some romantic songs."
Even with this simple question, you can see conversational experience are hard to implemented. Interpreting and processing natural language requires a very robust language parser that has the capable of understanding the nuances of language.
Your code would have to handle all these different types of requests ro carry out the same logic: looking up some forecast information for a feature. For this reason, a traditional computer interface would tend to force users to input a well-known, standard request at the detriment of the user experience, because it's just easier.
However, BotSharp lets you easily achieve a conversational user experience by handling the natural language understanding (NLU) for you.When you use BotSharp, you can create agents that can understand the meaning of natural language and the nuances and trainslate that to structured meaning your software can understand.
## Agent
An agent helps you process user sentences (unstructure data) into structure data that you can use to return an appropriate response.
![](./static/screenshots/Agent_sent.png)
When users say something, your agent matches the user utterance to an exactly matched intent or closely matched intent. Besides, the agent will return extra information about named entities which you need from the utterance. This can be name, location date or a host of other data categories (entities). You can define both the intent and the entities in your training data sets. You can also define what else to extact in your training phares as well.Then you can send a response to user to continue the conversation or to just end the conversation. It is very simple to create your own agent in BotSharp. The only thing you need is to assign you agent a name and a brief discription.
![](./static/screenshots/Agent_Workflow.png)
## Intent
To define how conversations work, you create intents in your agent that map user input to response. Generally an intent represents one dialog turn in a conversation. For example, you could create an music control angent recognise and responds to users. If a user said "Can you play Rihanna's Diamonds?". Your agent will do intent matching to music play intent, and responds to users a corresponding reply. It usually prompts users for another utterance which your agent will attempt to match another intent, and the conversation continues.
### Training Phrases
Training Phrases are collections of possible utterances that users might say to match a intent. You don't have to define every possible utterance of what user say. While we recommend users could define as more expression way as possible. It will help improve the robot understanding ability a lot.
![](./static/screenshots/articulatescreenshot.png)
From the chart above we can see: An Intent consist of four main components:
- Intent name: The name of the intent
- Training phrases: Examples of what users can say to match a particular intent. BotSharp will automaticlly expand these phrases to match similar user utterances.
- Actions and parameters: Define how relevant information (Entities) are extracted from user utterances. You can use these parameters (entities) as input into other logic, such as looking up information, carry out a task, or returning a response.
- Response: An utterance that is spoken or displayed back to the user.
## Named Entity
Named Entity is BotSharp mechanism for identfying and extacting useful data from user utterance text inputs. The difference between intent and entity is: intents allows your agent to understand the motivation behind a particular user input, on the other hand entities are used to extract out specific pieces of information that user mentions. Any important data you want to get from a user's request have a corresponding entity.
### Annotation Entities
Training Phrases allow your agent to successfully match user input to an intent. In order to help your agent with this matching process. You can annotate training phrases with entities. Entitty is a host of categories. For example, locations, organizations, persons and numbers are all entities. Annotation refers to the linking of words or values within training phrases to their corresponding entities. You can manually annotate you training phrases. Once a word or phrase is annotated, it will be highlight in your training phrases.
For example, imagine that you defined a training phrase like "Can you play Rihanna's Diamond please?" You can annotate Rihanna as an artist and Diamond as a song here. This annotation tells BotSharp to match more variations. like "Can you play Beattle's Hey Jude please?", or any other variation that have an artist and a song name combination. If you didn't annotate the phrase.For "Can you play Rihanna's Diamond" speaking, the agent would match user input that contained "Rihanna" and "Diamond" exactly, but not any other artists and any other songs. We recommend users could annotation properly in order to have a impressive intent classification experience.
## Channels
When you already trained a chatbot on Botsharp, you may want it to play a really role in life. So we intergrate some popular channels in Botsharp including Twilio, facebook messenger, Telegram, WeChat and some other RPAs. These channels can make your robot "real" in life. For example, on facebook when a user visit your page and sends you a message, they can talk to your agent. You can also set a virtral assistant based on Twilio to chat with your clients for ordering, consulting, problem solving and many other business processes.

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
docs/static/screenshots/Agent_sent.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View file

@ -0,0 +1,69 @@
---
title: 集成微信公众号
tags: BotSharp,微信公众测试号
grammar_cjkRuby: true
---
集成微信公众号主要是将BotSharp与微信公众号对接起来搭建一个环境为后续工作做好准备。
----------
# BotSharp的配置
要与微信公众号对接首先要成功运行BotSharp。下面详细讲解运行BotSharp的步骤
## 加载项目
项目botsharp-channel-weixin为腾讯微信BotSharp的通道模块加载此项目可以省去编写微信通道模块的过程当然也可以根据自己的需求去编写微信的通道模块。
项目文件botsharp-channel-weixin下载地址(https://github.com/Oceania2018/botsharp-channel-weixin)将botsharp-channel-weixin项目放置到BotSharp同级的目录下。加载botsharp-channel-weixin到BotSharp中。
![](./集成微信公众号图片/图片1.png)
右键点击“==依赖项==”、“==添加引用==”把botsharp-channel-weixin项目添加到BotSharp.WebHost的引用中。
![](./集成微信公众号图片/图片2.png)
找到BotSharp.WebHost下的app.json,修改moduleBasePath和botsharp-channel-weixin的Path路径。程序会根据路径找到其项目的.dll。
![](./集成微信公众号图片/图片3.png)
## 运行BotSharp
加载项目完毕运行BotSharp项目出现如下的黑色的控制台程序表示程序找到了botsharp-channel-weixin的.dll,项目运行成功。如果想用NLU做自然语言理解则可以加载botsharp-dialogflow项目到BotSharp中。
![](./集成微信公众号图片/BotSharp运行结果.png)
运行成功后,打开网址为(http://localhost:3112/index.html)的网页此网页所显示的为BotSharp的接口列表。
![](./集成微信公众号图片/3112.png)
# 对接微信公众号
## 申请微信测试号
在微信公众平台认证之前,我们可以先申请一个测试的公众号来进行测试,这对开发人员来说还是有很大好处的。(https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login)
## 测试号接口信息配置
**1)申请服务器**
我们所要填写的url必须是外网能够访问到的服务器地址而且必须是80端口通过服务器的地址你要能够让微信访问到你的项目。
![](./集成微信公众号图片/微信接口配置信息1.png)
我们需要把内网映射出去变成能够访问的外网我们采取一个简单的方法通过ngrok进行内网穿透。ngrok工具的下载地址(http://ngrok.ciqiuwl.cn/)下载完成后解压缩。
找到apps.bat文件点击右键打开记事本进行编辑,执行 *ngrok -config=ngrok.cfg -subdomain xxx 80*//(xxx 是你自定义的域名前缀),如执行*ngrok -config=ngrok.cfg -subdomain sss 3112* ,双击弹出一个黑窗体,该黑窗体显示的域名就是映射出去的网址。
也有其它的方法得到外网网址,如通过路由器映射,可自行通过百度上网查询。
![](./集成微信公众号图片/ngrok黑窗体.png)
其中http://sss.ngrok.xiaomiqiu.cn即为映射的外网IP。
**2)填写接口配置信息**
url填写 http://外网IP/wx
Token自主设置这个token与公众平台wiki中常提的access_token不是一回事。这个token只用于验证开发者服务器。
![](./集成微信公众号图片/配置接口url.png)
Token是用于交互安全认证的可任意填写但要与服务端的校验微信的Controller一样。
打开BotSharp-Channel-Weixin类库下的Controllers文件中WeixinAsyncConreoller.cs类。正确填写Token、AppId字符串。其中Token要与微信测试号中的Token相同。
![](./集成微信公众号图片/配置接口Token.png)
填写完毕打开ngrok并运行BotSharp项目则可以成功提交微信测试号的接口配置信息。
![](./集成微信公众号图片/接口配置成功.png)
填写JS接口安全域名域名可随意填写。微信扫描关注测试公众号。
至此,集成微信公众号完成。

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB