IranCahtBot
V.I.P
Posts: 27
Joined: Sat Feb 25, 2017 7:36 pm

Oscova smalltalk

Tue Nov 14, 2017 2:06 am

Hello Dear Leslie,

I want to use Oscova smalltalk. To do this, I've used the following code. But when I enter the Hello word, the application does not respond. Would you please help me, what is the problem of the program?
Thank you in advance for any help you can provide.

Best regards
Ebrahim

internal class WelcomeRobot : Dialog
{
[Expression("@Greetings")]
public void Default(Context context, Result result)
{
var appEntity = result.Entities.OfType("app");
Process.Start(appEntity.Value);
}


}
var bot = new OscovaBot();
WelcomeRobot dialog = new WelcomeRobot();
bot.Dialogs.Add(dialog);
string location = AppDomain.CurrentDomain.BaseDirectory + "Syn\\Dialog.siml";
bot.Import(XDocument.Load(location));
bot.Trainer.StartTraining();

<Siml>
<Dialog Name="WelcomeRobot" IntentAlias="Greetings">
<Intent>
<Expression>Hello</Expression>
<Response>I am doing great!</Response>
</Intent>
<Intent>
<Expression>Hi there</Expression>
<Response>Well, hello there!</Response>
</Intent>
</Dialog>
</Siml>

User avatar
Fantom
Help & Support
Posts: 313
Joined: Fri Oct 25, 2013 9:20 pm

Re: Oscova smalltalk

Thu Nov 16, 2017 5:07 pm

I tested your SIML Modern code by putting it in a dialog.siml file and just importing it.

CSharp Code

public class Program
{
	private static void Main()
	{
		var bot = new OscovaBot();
		var path = Path.Combine(Directory.GetCurrentDirectory(), "dialog.siml");
		bot.Import(XDocument.Load(path));
		bot.Trainer.StartTraining();

		bot.MainUser.ResponseReceived += (sender, args) =>
		{
			Console.WriteLine($"Bot: {args.Response.Text}");
		};

		while (true)
		{
			Console.WriteLine("Please type your input...");
			var userInput = Console.ReadLine();
			bot.Evaluate(userInput).Invoke();
		}

		Console.ReadLine(); //Keep Console On.
	}
}
It is working for me. In your c# code you are using [Expression("@Greetings")] is there any recognizer created for the entity type "greeting"? please note IntentAlias is used for quick reply generation and do not create any entities.

Return to “Feature Request and Suggestions”

Who is online

Users browsing this forum: No registered users and 1 guest