finish training for rasa nlu.
This commit is contained in:
parent
98e846dd38
commit
32f65ae07a
|
|
@ -1,6 +1,7 @@
|
|||
using BotSharp.Core.Engines;
|
||||
using BotSharp.Platform.Abstraction;
|
||||
using BotSharp.Platform.Models;
|
||||
using BotSharp.Platform.Models.MachineLearning;
|
||||
using DotNetToolkit;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
|
|
@ -9,6 +10,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BotSharp.Core
|
||||
{
|
||||
|
|
@ -70,6 +72,26 @@ namespace BotSharp.Core
|
|||
return Storage.FetchByName(agentName);
|
||||
}
|
||||
|
||||
public virtual async Task<ModelMetaData> Train(TAgent agent, TrainingCorpus corpus, BotTrainOptions options)
|
||||
{
|
||||
if (String.IsNullOrEmpty(options.AgentDir))
|
||||
{
|
||||
options.AgentDir = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Projects", agent.Id);
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(options.Model))
|
||||
{
|
||||
options.Model = "model_" + DateTime.UtcNow.ToString("yyyyMMdd");
|
||||
}
|
||||
|
||||
var trainer = new BotTrainer();
|
||||
agent.Corpus = corpus;
|
||||
|
||||
var info = await trainer.Train(agent, options);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public virtual bool SaveAgent(TAgent agent)
|
||||
{
|
||||
GetStorage();
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace BotSharp.Platform.Abstraction
|
|||
/// <returns></returns>
|
||||
bool SaveAgent(TAgent agent);
|
||||
|
||||
Task<ModelMetaData> Train(TAgent agent, TrainingCorpus corpus);
|
||||
Task<ModelMetaData> Train(TAgent agent, TrainingCorpus corpus, BotTrainOptions options);
|
||||
|
||||
AiResponse TextRequest(AiRequest request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,10 +74,6 @@
|
|||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\botsharp-dialogflow\BotSharp.Platform.Dialogflow\BotSharp.Platform.Dialogflow.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Settings\app.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ namespace BotSharp.WebHost
|
|||
};
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLineFormatted("Platform Emulator: {0} powered by {1} engine.", Color.White, settings);
|
||||
Console.WriteLineFormatted("{0} platform emulator powered by {1} engine.", Color.White, settings);
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
BotSharp.sln
20
BotSharp.sln
|
|
@ -22,10 +22,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Abstracti
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Models", "BotSharp.Platform.Models\BotSharp.Platform.Models.csproj", "{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Dialogflow", "..\botsharp-dialogflow\BotSharp.Platform.Dialogflow\BotSharp.Platform.Dialogflow.csproj", "{B865F070-9693-47C6-B901-40121F659C6F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Rasa", "..\botsharp-rasa\BotSharp.Platform.Rasa\BotSharp.Platform.Rasa.csproj", "{87C265EF-3A8A-4290-8AD2-33504168F653}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -90,22 +86,6 @@ Global
|
|||
{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.Build.0 = Release|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{87C265EF-3A8A-4290-8AD2-33504168F653}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{87C265EF-3A8A-4290-8AD2-33504168F653}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{87C265EF-3A8A-4290-8AD2-33504168F653}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{87C265EF-3A8A-4290-8AD2-33504168F653}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{87C265EF-3A8A-4290-8AD2-33504168F653}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{87C265EF-3A8A-4290-8AD2-33504168F653}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{87C265EF-3A8A-4290-8AD2-33504168F653}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{87C265EF-3A8A-4290-8AD2-33504168F653}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
Loading…
Reference in a new issue