private static void Main() { var bot = new OscovaBot(); bot.Dialogs.Add(new TestDialog()); bot.Trainer.StartTraining(); var botServer = new WebApiChannel <OscovaBot>(bot, "http://localhost:8086/bot"); //In case the server generates a log, write it to console. botServer.Logger.LogReceived += (sender, eventArgs) => { Console.WriteLine(eventArgs.Log); }; botServer.Start(); //Once the server is started you can call API url using the below format. //http://localhost:8086/bot?userid={USER-ID}&query={USER-MESSAGE} //Example: http://localhost:8086/bot?userid=12345&query=test Console.WriteLine($"Bot Server is online at '{botServer.Url}'. Press any key to stop server."); Console.ReadLine(); botServer.Stop(); }
// Start is called before the first frame update void Start() { try { //Create new instance of bot. MainBot = new OscovaBot(); OscovaBot.Logger.LogReceived += (s, o) => { Debug.Log($"OscovaBot: {o.Log}"); }; //Train on simple dialog. MainBot.Dialogs.Add(new StartDialog()); //Import bot's knowledge-base from a Workspace project file. //To read the content of this file ensure you've got Oryzer installed. Visit Oryzer.com //UNCHECK THE LINE BELOW TO IMPORT A PIZZA BOT DEMO. // MainBot.ImportWorkspace("Assets/pizza-bot.west"); MainBot.Trainer.StartTraining(); //When the bot generates a response simply display it. MainBot.MainUser.ResponseReceived += (sender, evt) => { AddMessage($"Bot: {evt.Response.Text}", MessageType.Bot); }; } catch (Exception ex) { Debug.LogError(ex); } }
static void Main(string[] args) { var lblnSair = false; while (!lblnSair) { var bot = new OscovaBot(); bot.Dialogs.Add(new ChatBotDialog()); bot.Trainer.StartTraining(); bot.MainUser.ResponseReceived += (sender, eventArgs) => { Console.WriteLine($"Panelinha: {eventArgs.Response.Text}"); }; Console.Write("Usuário: "); var message = Console.ReadLine(); var result = bot.Evaluate(message); result.Invoke(); if (message.Equals("sair")) { lblnSair = true; } } }
private static void Main(string[] args) { var bot = new OscovaBot(); // License is required, see https://developer.syn.co.in/tutorial/bot/activate-license.html //bot.Configuration.ProcessingMode = ProcessingMode.Deep; Console.WriteLine("Loading WordNet"); LoadWordNet(bot); Console.WriteLine("Loading word vectors"); LoadWordVectors(bot); Console.WriteLine("Adding dialogs"); bot.Dialogs.Add(new HelloBotDialog()); bot.Dialogs.Add(new AppDialog()); //bot.Dialogs.Add(new MyDialog()); Console.WriteLine("Training the model"); bot.Trainer.StartTraining(); Console.WriteLine("Ready!"); bot.MainUser.ResponseReceived += (sender, eventArgs) => { Console.WriteLine(eventArgs.Response.Text); }; while (true) { var request = Console.ReadLine(); var evaluationResult = bot.Evaluate(request); evaluationResult.Invoke(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var bot = new OscovaBot(); bot.Dialogs.Add(new HelloBotDialog()); bot.Trainer.StartTraining(); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button>(Resource.Id.MyButton); var input = FindViewById <EditText>(Resource.Id.editText1); var output = FindViewById <EditText>(Resource.Id.editText2); bot.MainUser.ResponseReceived += (sender, args) => { output.Text = $"Bot: {args.Response.Text}"; }; button.Click += delegate { var result = bot.Evaluate(input.Text); result.Invoke(); }; }
// Start is called before the first frame update void Start() { try { MainBot = new OscovaBot(); OscovaBot.Logger.LogReceived += (s, o) => { Debug.Log($"OscovaBot: {o.Log}"); }; MainBot.Dialogs.Add(new BotDialog()); //MainBot.Dialogs. //MainBot.ImportWorkspace("Assets/bot-kb.west"); MainBot.Trainer.StartTraining(); MainBot.MainUser.ResponseReceived += (sender, evt) => { AddMessage($"Bot: {evt.Response.Text}", MessageType.Bot); }; } catch (Exception ex) { Debug.LogError(ex); } }
// Start is called before the first frame update void Start() { try { MainBot = new OscovaBot(); OscovaBot.Logger.LogReceived += (s, o) => { Debug.Log($"OscovaBot: {o.Log}"); }; //Import bot's knowledge-base from an Oryzer Workspace project file. //To read the content of this file ensure you've got Oryzer installed. Visit Oryzer.com //First read the knowledge.json file and create a workspace. /*Note: Oryzer usually saves file in .West file extensions so the file was intentionally * renamed to knowledge.json so Unity stores it as a resource. */ var txtAsset = (TextAsset)Resources.Load("tobor_phase_1_v_0.1", typeof(TextAsset)); var tileFile = txtAsset.text; Debug.Log(txtAsset); Debug.Log(tileFile); var workspace = new WorkspaceGraph(); workspace.LoadFromString(tileFile); //Import the workspace. MainBot.ImportWorkspace(workspace); MainBot.Trainer.StartTraining(); //When the bot generates a response simply display it. MainBot.MainUser.ResponseReceived += (sender, evt) => { //StartCoroutine(Response(evt.Response.Text)); Debug.Log(evt.Response.Messages); AddMessage($"Bot: {evt.Response.Messages}", MessageType.Bot); }; /*Note: Originally from Ma Xin * MainBot.Recognizers.EntityRecognized += Recognizers_EntityRecognized; * MainBot.Recognizers.EntitiesExtracted += Recognizers_EntitiesExtracted; * * MainBot.Dialogs.Add(new BotDialog()); * //MainBot.ImportWorkspace("Assets/bot.json");//original Assets/SimpleText.west * MainBot.Trainer.StartTraining(); * * MainBot.MainUser.ResponseReceived += (sender, evt) => * { * StartCoroutine(Response(evt.Response.Text)); * StartCoroutine(ShowText()); * Debug.Log(evt.Response.Text); * //AddMessage($"Bot: {evt.Response.Text}", MessageType.Bot); * }; */ } catch (Exception ex) { Debug.LogError(ex); } }
private dynamic OnPostText(dynamic o) { OscovaBot bot = TvBot.Instance; dynamic result = bot.Evaluate(o.text); result.Invoke(); return(result); }
static void Main(string[] args) { Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("ru-RU"); var dbContext = new NureBotDbContext(false); var unityContainer = new UnityContainer(); dbContext.Database.Initialize(true); ContainerBoostraper.RegisterTypes(unityContainer, dbContext, "356520093:AAGKBe8YFpR5_5WIkGfoeRbdTMuOKE2O9GQ"); Bot = unityContainer.Resolve <TelegramBotClient>(); UService = unityContainer.Resolve <IUserService>(); RecognitionSystem = unityContainer.Resolve <OscovaBot>(); Console.Title = Bot.GetMeAsync().Result.Username; Bot.OnMessage += Bot_OnMessage; Bot.OnReceiveError += Bot_OnReceiveError; RecognitionSystem.Dialogs.Add(new CistDialog()); RecognitionSystem.Dialogs.Add(new WeatherDialog()); RecognitionSystem.MainUser.Context.SharedData.Add(Bot); RecognitionSystem.MainUser.Context.SharedData.Add(UService); RecognitionSystem.Language.Stemmer = new RussianStemmer(); RecognitionSystem.Language.StopWords = StopWordsGenerator.GenerateRussianStopWords(); RecognitionSystem.Trainer.StartTraining(); RecognitionSystem.Recognizers.Clear(); RecognitionSystem.Recognizers.Add(new RuDateRecognizer()); RecognitionSystem.Language.Culture.DateTimeFormat = CultureInfo.GetCultureInfo("ru-RU").DateTimeFormat; RecognitionSystem.Recognizers.Add(new GroupRecognizer()); RecognitionSystem.CreateRecognizer("teacherName", new Regex(@"[А-Яа-я]+ [А-Яа-я]\.? [А-Яа-я]\.?")); RecognitionSystem.MainUser.ResponseReceived += async(sender, arg) => { var msg = JsonConvert.DeserializeObject <MessageTransfer>(arg.Response.Text); await Bot.SendTextMessageAsync(msg.ChatId, msg.Message, replyMarkup : msg.ReplyMarkup); }; Bot.SetWebhookAsync(); Bot.StartReceiving(); Console.BackgroundColor = ConsoleColor.DarkGreen; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(@"Service started"); Console.WriteLine(@"Press Enter to Stop Service!"); Console.ReadLine(); Bot.StopReceiving(); dbContext.Dispose(); unityContainer.Dispose(); }
public void Start() { _bot = new OscovaBot(); _bot.Plugins.LoadFromDirectory(_pluginsDirectory, fileInfo => fileInfo.Name.ToLower().EndsWith("plugin.dll")); _bot.Language.WordNet.LoadFromDirectory(_wordNetDirectory); _bot.Configuration.Scoring.MinimumScore = 0.5; _bot.Trainer.StartTraining(); _bot.MainUser.ResponseReceived += Reply; _receiver.Invoke(new AssistantResponse("Жду ваших указаний!")); }
/** Loads word vectors, see {@link https://developer.syn.co.in/tutorial/bot/oscova/load-word-vectors.html} */ private static void LoadWordVectors(OscovaBot bot) { // Loaded from https://s3-us-west-1.amazonaws.com/fasttext-vectors/wiki.en.vec //var dbName = "wiki.en.vec"; // Loaded from http://nlp.stanford.edu/data/glove.6B.zip var dbName = @"glove.6B\glove.6B.50d.txt"; var fileStream = new FileStream(ROOT_DIR + dbName, FileMode.Open); bot.Language.WordVectors.Load(fileStream, VectorDataFormat.Text); }
public ChatBotC() { ob = new OscovaBot(); //Ajouter dialogue (base de connaissane) ob.Dialogs.Add(new BaseConnaissance()); //Connexion avec bd ConnectionavecBase conB = new ConnectionavecBase(); ob.MainUser.Context.SharedData.Add(conB); ob.CreateRecognizer("Categorie", new[] { "T-Shirt", "Short", "Survêtement", "Gilet", "Jacket", "Veste", "Tops", "Robes", "Jupes", "Jeans", "Pantalons", "Accessoires", "Chaussures" }); ob.Trainer.StartTraining(); }
private static void LaunchOscovaBot() { var websiteUrl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); var oscovaBot = new OscovaBot(); oscovaBot.Dialogs.Add(new HelloBotDialog()); oscovaBot.CreateRecognizer("start", new Regex(@"(?<!/)(/(?:start))(?(?<=\w)\b)", RegexOptions.IgnoreCase)); oscovaBot.Trainer.StartTraining(); _oscovaBotChannel = new WidgetChannel <OscovaBot>(oscovaBot) { ServiceUrl = websiteUrl + "/BotService.aspx", ResourceUrl = websiteUrl + "/BotResource", }; }
private static OscovaBot InitBot() { var bot = new OscovaBot(); bot.CreateRecognizer <VolumeDirection>("volumeDirection"); bot.CreateRecognizer <Direction>("direction"); bot.CreateRecognizer <StationDirection>("stationDirection"); bot.CreateRecognizer("volumeAddress", new[] { "Lautstärke", "Pegel", "Volume" }); bot.CreateRecognizer("stationAddress", new[] { "Sender", "Kanal", "Fernsehsender", "Fernsehkanal", "TV-Sender", "Programm" }); bot.Recognizers.Add(new StationRecognizer(() => TvControlViewModel.Current.TvStations)); bot.Dialogs.Add(new StationDialog()); bot.Dialogs.Add(new VolumeDialog()); bot.Trainer.StartTraining(); return(bot); }
static void Main(string[] args) { var bot = new OscovaBot(); bot.ImportWorkspace(@"C:\Users\aykut\OneDrive\Documents\bot1.west"); bot.Trainer.StartTraining(); bot.MainUser.ResponseReceived += (sender, eventArgs) => { Console.WriteLine($"Bot: {eventArgs.Response.Text}"); }; while (true) { var request = Console.ReadLine(); var evaluationResult = bot.Evaluate(request); evaluationResult.Invoke(); } }
public MainWindow() { InitializeComponent(); Bot = new OscovaBot(); Bot.MainUser.ResponseReceived += (sender, args) => { ResponseLabel.Content = args.Response.Text; }; DatabaseUtility = new DatabaseUtility(this); DatabaseUtility.Initialize(); UpdateDataGrid("SELECT * From Employees"); Bot.MainUser.Context.SharedData.Add(DatabaseUtility); CreateNameParser(); CreateJobParser(); Bot.CreateRecognizer("set", new[] { "change", "update", "set" }); Bot.CreateRecognizer("property", new[] { "id", "name", "job", "age", "salary" }); Bot.CreateRecognizer("equality", new[] { "greater than", "less than", "equal to", "not equal to", "greater than or equal to", "less than or equal to" }); //Add all required dialogs. Bot.Dialogs.Add(new DatabaseGenericDialog()); Bot.Dialogs.Add(new DatabaseUpdateByNameDialog()); Bot.Dialogs.Add(new DatabaseUpdateByIdDialog()); Bot.Dialogs.Add(new DatabaseEnquiryDialog()); Bot.Dialogs.Add(new DatabaseSuperlativeDialog()); Bot.Language.Filters.AddWordFilter("=", "equal to"); Bot.Language.Filters.AddWordFilter(">", "greater than"); Bot.Language.Filters.AddWordFilter("<", "less than"); Bot.Language.Filters.AddWordFilter(">=", "greater than or equal to"); Bot.Language.Filters.AddWordFilter("<=", "less than or equal to"); Bot.Language.Filters.AddWordFilter("!=", "not equal to"); //Finally Train the Bot. //var data = Bot.Trainer.GetTrainingData(); //data.Save(@"d:\training-data.xml"); Bot.Trainer.StartTraining(); }
/** Loads WordNet, see {@link https://developer.syn.co.in/tutorial/bot/oscova/load-wordnet.html} */ private static void LoadWordNet(OscovaBot bot) { var directory = ROOT_DIR + @"wordnet\dict"; var wordNet = bot.Language.WordNet; //Data wordNet.AddDataSource(new StreamReader(Path.Combine(directory, "data.adj")), PartOfSpeech.Adjective); wordNet.AddDataSource(new StreamReader(Path.Combine(directory, "data.adv")), PartOfSpeech.Adverb); wordNet.AddDataSource(new StreamReader(Path.Combine(directory, "data.noun")), PartOfSpeech.Noun); wordNet.AddDataSource(new StreamReader(Path.Combine(directory, "data.verb")), PartOfSpeech.Verb); //Indices wordNet.AddIndexSource(new StreamReader(Path.Combine(directory, "index.adj")), PartOfSpeech.Adjective); wordNet.AddIndexSource(new StreamReader(Path.Combine(directory, "index.adv")), PartOfSpeech.Adverb); wordNet.AddIndexSource(new StreamReader(Path.Combine(directory, "index.noun")), PartOfSpeech.Noun); wordNet.AddIndexSource(new StreamReader(Path.Combine(directory, "index.verb")), PartOfSpeech.Verb); wordNet.Load(); }
static void Main(string[] args) { var oscovaBot = new OscovaBot(); //Channel Tester provides OscovaTestDialog. var tester = new ChannelTester(Directory.GetCurrentDirectory()); oscovaBot.Dialogs.Add(tester.OscovaTestDialog); oscovaBot.Trainer.StartTraining(); var discordChannel = new DiscordChannel <OscovaBot>(oscovaBot, "DISCORD_BOT_USER_TOKEN"); discordChannel.Start().Wait(); Console.WriteLine("Your Oscova Bot is now hosted as a Discord Bot. Press any key to exit."); Console.ReadKey(); discordChannel.Stop().Wait(); }
public Judi() { bot = new OscovaBot(); bot.Dialogs.Add(new AppDialog()); dbutility = new DataBaseUtility(); dbutility.init(); bot.MainUser.Context.SharedData.Add(dbutility); bot.CreateRecognizer("message", new[] { "this is a message" }); bot.CreateRecognizer("price", new[] { "price" }); bot.CreateRecognizer("action", new[] { "show", "display", "show me, give me" }); bot.CreateRecognizer("qteQuestions", new[] { "do you have", "have you", "how many" }); bot.CreateRecognizer("greeting", new[] { "hello", "hi", "good morning", "good afternoon", "good evening" }); String[] st = dbutility.categoryDescriptions(); String[] pl = dbutility.productLib(); bot.CreateRecognizer("category", st); bot.CreateRecognizer("libelle", pl); bot.Trainer.StartTraining(); }
private static void Main(string[] args) { var bot = new OscovaBot(); bot.Dialogs.Add(new HelloBotDialog()); bot.Dialogs.Add(new AppDialog()); bot.Trainer.StartTraining(); bot.MainUser.ResponseReceived += (sender, eventArgs) => { Console.WriteLine(eventArgs.Response.Text); }; while (true) { var request = Console.ReadLine(); var evaluationResult = bot.Evaluate(request); evaluationResult.Invoke(); } }
static BotService() { Bot = new OscovaBot(); WidgetChannel = new WidgetChannel(Bot); //Add the pre-built channel test dialog. Bot.Dialogs.Add(new ChannelTestDialog(Bot)); //Start training. Bot.Trainer.StartTraining(); var websiteUrl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); WidgetChannel.ServiceUrl = websiteUrl + "/BotService.aspx"; WidgetChannel.ResourceUrl = websiteUrl + "/BotResources"; WidgetChannel.WidgetTitle = "Our Smart Bot!"; WidgetChannel.LaunchButtonText = "Ask"; WidgetChannel.InputPlaceHolder = "Ask your query here..."; }
static void Main(string[] args) { var oscovaBot = new OscovaBot(); //Channel Tester provides OscovaTestDialog. var tester = new ChannelTester(Directory.GetCurrentDirectory()); //oscovaBot.Dialogs.Add(tester.OscovaTestDialog); //Load the SIML Modern doc instead of using a channel tester. oscovaBot.Import(XDocument.Load("knowlege.siml")); oscovaBot.Trainer.StartTraining(); var discordChannel = new DiscordChannel <OscovaBot>(oscovaBot, "Token Here"); discordChannel.Start().Wait(); Console.WriteLine("Your Oscova Bot is now hosted as a Discord Bot. Press any key to exit."); Console.ReadKey(); discordChannel.Stop().Wait(); }
/// <summary> /// ChatPageViewModel Constructor /// </summary> public ChatbotPageViewModel() { SendCommand = new RelayCommand(Send); BackArrowCommand = new RelayCommand(Back); chatbot = new OscovaBot(); var assembly = IntrospectionExtensions.GetTypeInfo(typeof(MainPage)).Assembly; Stream stream = assembly.GetManifestResourceStream("BluePillApp.Helpers.new3.siml"); chatbot.Import(XDocument.Load(stream)); chatbot.Trainer.StartTraining(); //This gets the chatbots response for each message chatbot.MainUser.ResponseReceived += (sender, args) => { //await Task.Delay(1000); Messages.Add(new ChatMessageModel() { Text = args.Response.Text, User = App.ChatBot }); }; }
// Start is called before the first frame update void Start() { try { //Create new instance of bot. MainBot = new OscovaBot(); OscovaBot.Logger.LogReceived += (s, o) => { Debug.Log($"OscovaBot: {o.Log}"); }; //Import bot's knowledge-base from an Oryzer Workspace project file. //To read the content of this file ensure you've got Oryzer installed. Visit Oryzer.com //First read the knowledge.json file and create a workspace. /*Note: Oryzer usually saves file in .West file extensions so the file was intentionally * renamed to knowledge.json so Unity stores it as a resource. */ var txtAsset = (TextAsset)Resources.Load("knowledge", typeof(TextAsset)); var tileFile = txtAsset.text; var workspace = new WorkspaceGraph(); workspace.LoadFromString(tileFile); //Import the workspace. MainBot.ImportWorkspace(workspace); MainBot.Trainer.StartTraining(); //When the bot generates a response simply display it. MainBot.MainUser.ResponseReceived += (sender, evt) => { AddMessage($"Bot: {evt.Response.Text}", MessageType.Bot); }; } catch (Exception ex) { Debug.LogError(ex); } }
protected override void OnActivityResult(int requestCode, Android.App.Result resultVal, Intent data) { var bot = new OscovaBot(); bot.Dialogs.Add(new HelloBotDialog()); bot.Trainer.StartTraining(); if (requestCode == VOICE) { if (resultVal == Android.App.Result.Ok) { var matches = data.GetStringArrayListExtra(RecognizerIntent.ExtraResults); if (matches.Count != 0) { string textInput = input.Text + matches[0]; // limit the output to 500 characters if (textInput.Length > 500) { textInput = textInput.Substring(0, 500); } input.Text = textInput; var result = bot.Evaluate(textInput); result.Invoke(); CrossTextToSpeech.Current.Speak(output.Text); } else { input.Text = "No speech was recognised"; } // change the text back on the button button.Text = "Start Recording"; } } base.OnActivityResult(requestCode, resultVal, data); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); isRecording = false; // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var bot = new OscovaBot(); bot.Dialogs.Add(new HelloBotDialog()); bot.Trainer.StartTraining(); string rec = Android.Content.PM.PackageManager.FeatureMicrophone; if (rec != "android.hardware.microphone") { // no microphone, no recording. Disable the button and output an alert var alert = new AlertDialog.Builder(button.Context); alert.SetTitle("You don't seem to have a microphone to record with"); alert.SetPositiveButton("OK", (sender, e) => { input.Text = "No microphone present"; button.Enabled = false; return; }); alert.Show(); } // Get our button from the layout resource, // and attach an event to it button = FindViewById <Button>(Resource.Id.MyButton); input = FindViewById <EditText>(Resource.Id.editText1); output = FindViewById <EditText>(Resource.Id.editText2); bot.MainUser.ResponseReceived += (sender, args) => { output.Text = $"Bot: {args.Response.Text}"; }; button.Click += delegate { var result = bot.Evaluate(input.Text); result.Invoke(); CrossTextToSpeech.Current.Speak(output.Text); // change the text on the button button.Text = "End Recording"; isRecording = !isRecording; if (isRecording) { // create the intent and start the activity var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech); voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); // put a message on the modal dialog voiceIntent.PutExtra(RecognizerIntent.ExtraPrompt, Application.Context.GetString(Resource.String.messageSpeakNow)); // if there is more then 1.5s of silence, consider the speech over voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500); voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500); voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000); voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1); // you can specify other languages recognised here, for example // voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.German); // if you wish it to recognise the default Locale language and German // if you do use another locale, regional dialects may not be recognised very well voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default); StartActivityForResult(voiceIntent, VOICE); } }; }
public void Initialize() { try { Employees.Clear(); FullEmployeeList.Clear(); Input = string.Empty; var sheet = Globals.ThisAddIn.Application.ActiveSheet as Worksheet; var columnCount = sheet?.UsedRange.Columns.Count; var rowCount = sheet?.UsedRange.Rows.Count; var columnNameIndexTable = new Dictionary <int, string>(); //Add column names and index. for (var i = 1; i <= columnCount; i++) { var cell = sheet.UsedRange.Cells[1, i] as Range; if (cell != null) { columnNameIndexTable.Add(i, cell.Value.ToString()); } } //Create employees list from row data. for (var r = 2; r <= rowCount; r++) { var employee = new Employee(); for (var c = 1; c <= columnCount; c++) { var cell = sheet.UsedRange.Cells[r, c] as Range; var columnName = columnNameIndexTable[c].ToLower(); var stringCellValue = cell?.Value.ToString(); if (stringCellValue == null) { break; } if (columnName == "id") { employee.Id = int.Parse(stringCellValue); } if (columnName == "salary") { employee.Salary = int.Parse(stringCellValue); } if (columnName == "age") { employee.Age = int.Parse(stringCellValue); } if (columnName == "name") { employee.Name = stringCellValue; } if (columnName == "role") { employee.Role = stringCellValue; } } FullEmployeeList.Add(employee); } Bot = new OscovaBot(); Bot.MainUser.Context.SharedData.Add(this); Bot.Dialogs.Add(new DatabaseGenericDialog()); Bot.Dialogs.Add(new DatabaseEnquiryDialog()); Bot.Dialogs.Add(new DatabaseSuperlativeDialog()); Bot.MainUser.ResponseReceived += (sender, args) => { Output = args.Response.Text; }; Task.Run(() => { Bot.CreateRecognizer("property", new[] { "ID", "Name", "Role", "Age", "Salary" }); Bot.CreateRecognizer("role", new[] { "CEO", "Manager", "Admin", "Engineer", "Tech", "Support" }); AddEmployeeNameRecognizer(); Bot.Trainer.StartTraining(); }); _sendAction = () => { Output = string.Empty; var evaluationResult = Bot.Evaluate(Input); evaluationResult.Invoke(); Input = string.Empty; }; } catch (Exception e) { Console.WriteLine(e); } }
public MusicBotPlugin(OscovaBot bot) : base(bot) { bot.Dialogs.Add(new MusicDialog()); }
public WeatherBotPlugin(OscovaBot bot) : base(bot) { bot.Dialogs.Add(new WeatherDialog()); }
public CalculationsBotPlugin(OscovaBot bot) : base(bot) { bot.Dialogs.Add(new CalculationsDialog()); }