mithunscout
Posts: 14
Joined: Sun Oct 29, 2017 6:49 pm

Issue with Context in Syn.oscova

Thu Sep 20, 2018 1:36 pm

I currently have a professional Syn.Bot License. I am trying to add contexts in my code but for some reason it is not working. find below my code and help me if I have done any mistake in that. Thanks;

<Expression("get numbers")>
Public Sub GetNumbers(ByVal context As Context, ByVal result As Result)
context.Add("Metric_Type", 2)
result.SendResponse("Which metric you want to know... Inventory / Incoming / Workable or Completion...?")
End Sub
<Expression("@sourcetype")>
<Context("Metric_Type")>
Public Sub getinventorynos(ByVal context As Context, ByVal result As Result)
Dim WorkType As String
WorkType = result.Entities.OfType("sourcetype").ToString
result.SendResponse(WorkType)
End Sub

In the above code I am adding a Context called Metric_Type with 2 iterations. and I have created a recognizer with 4 parameters (Inventory / incoming / workable and completion). My expectation is when bot Asks which metric user wants to know the next expression should pick this context up and the function below should be called. but this context is not getting added ...

User avatar
Sreejith
Help & Support
Posts: 20
Joined: Sat Apr 06, 2013 6:16 pm

Re: Issue with Context in Syn.oscova

Fri Sep 21, 2018 4:47 pm

syn bot's context handling system is covered by 1000s of test that address most combinations...we will use ur code and will try to reproduce the case. just make sure there is no other reason why this is not being handled. You can also try adjusting training settings. We will get back once we have reproduced ur case.
If your experiment needs statistics, you ought to have done a better experiment - Ernest Rutherford

mithunscout
Posts: 14
Joined: Sun Oct 29, 2017 6:49 pm

Re: Issue with Context in Syn.oscova

Sat Sep 22, 2018 10:40 am

Thanks Sreejith.. I can even send you the complete code on this for you to replicate....

Regards
Mithun

User avatar
Leslie
Lead Software Architect
Posts: 351
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Issue with Context in Syn.oscova

Mon Oct 08, 2018 9:18 am

Hey Mithun,

Tried to reproduce the case but it seems things are working just fine. I suspect their might be some minor things you might have got wrong while implementing your code.

CSharp Code

public class MinorContextTestDialog : Dialog
{
	[Expression("get numbers")]
	public void GetNumbers(Context context, Result result)
	{
		context.Add("Metric_Type", 2);
		result.SendResponse("response 1");
	}

	[Expression("@sourcetype")]
	[Context("Metric_Type")]
	public void GetInventoryNos(Context context, Result result)
	{
		var workType = result.Entities.OfType("sourcetype").ToString();
		result.SendResponse(workType);
	}
}

CSharp Code

[TestMethod]
public void Minor_Context_Flow_Test()
{
	var bot = TestHelper.GetNewBot();
	bot.CreateRecognizer("sourcetype", new[] { "Inventory","incoming","workable","completion" });
	bot.Dialogs.Add(new ReportedForumContextHitDialog());
	bot.Trainer.StartTraining();

	var resp = TestHelper.GetResponse(bot, "get numbers");
	Assert.AreEqual("response 1", resp.Text);

	resp = TestHelper.GetResponse(bot, "workable");
	Assert.AreEqual("workable", resp.Text);
}

mithunscout
Posts: 14
Joined: Sun Oct 29, 2017 6:49 pm

Re: Issue with Context in Syn.oscova

Fri Oct 12, 2018 11:21 am

Thanks a ton for your time on this response... You are always the best... :)

Return to “Report Bugs and Issues”

Who is online

Users browsing this forum: No registered users and 0 guests