Genie Community Forum

Device that lets user choose if an article is relevant or not

Yeah, developer access is currently restricted on the dev website. I gave you permission now.

I tried using the syntax you used to name the entity, however, it seems that it causes an error as follows in the manifest.tt:

When I tried to shortened it to only article, the parameters for the functions raise a different error message:

When I tried to change the parameters as well, a different error is raised:

How should I fix this issue?

in the type declaration, that is, in the entity statetement, you should use only the local part of the name, and you should include a description:

entity article #_[description="News Article"];

in uses of the type, that is, in Entity() type references, you should use the fully-qualified name:

query article(out id : Entity(org.itspersonal.newsfilter:article))

Also, the name of the query must be the same as the name of the entity. That’s how the system recognize that the query is the “main” query for a given entity.

It seems that I have successfully created the device called Simple News Filter as shown here:

But when I try to add it in the enable skills part of my Almond it redirects to an error page:


And trying the input in My Almond doesn’t work as well:

Is there something wrong with my code? This part works fine in the old Almond website (it should just show a random article at the moment, it doesn’t use the entity part yet).

Update:
It seems that it automatically added the smartnews device for some reason, which was the source of the replies. So the problem is that my new device cannot be added to the skills for some reason.

Yeah sorry it seems there are some problems with the automatic training of basic natural language at the moment. I will need to deploy a new fixed version on the website. Meanwhile you might be able to use ThingTalk commands (prefixed with \t) instead.

Ok, how can we use the ThingTalk commands, just input them straight to my Almond? and where can we find the commands for the device?

You input in the normal command prefixed them with \t . For example:

\t @org.itspersonal.newsfilter.article();

The commands are those you defined in your manifest. If you haven’t already, I recommend reading through the ThingTalk guide

It doesn’t seem to work?


This is the function in the manifest.tt
image

You need to specify the right type:

\t @org.itspersonal.newsfilter.article(topic = enum test);

See the ThingTalk Reference to see how each type is specified in ThingTalk.

You might also need to refresh the page if you get no response to a command.

Still nothing:

That means there is some other error in the system at the moment. I’ll check and let you know…

1 Like

I just updated dev.almond, and tested your skill, it seems to work now with ThingTalk code.

I managed to get the query part working properly but now I’m stuck with linking it to the action. I’m not sure how to get the id from the query to the action and how to ask the user for their input. I checked that the id is indeed returned from the function from the console.



How should it work with the ThingTalk code? I was under the impression that it would then automatically call the marking function and ask the user for true/false or yes/no.
Here is the action function for reference:

I see you created two queries, one list query and one that is not a list. At the moment, the Genie dialogue model does not add a action to the result of a non-list query.

You can find all the templates that Genie uses to generate the agent replies here genie-toolkit/languages/thingtalk at master ¡ stanford-oval/genie-toolkit ¡ GitHub in the .genie files.
In particular, the templates used for talking about the top result of a query are here: genie-toolkit/recommendation.genie at master ¡ stanford-oval/genie-toolkit ¡ GitHub
You can see that there is a template of the form ["${proposal}. ${action}"] in system_recommendation (which is used for list results), but one in system_nonlist_result.

You essentially now have two options.

  1. You can modify the Genie dialogue model to have it do what you want precisely. You can point your almond-cloud installation to your modified Genie using npm link. This is not easy to do, but it gives you the most freedom to implement whatever you want in terms of dialogue.
  2. You can tweak your manifest until Genie will give you the behavior you want. In this case, I think marking the training_news_article query as list and then only returning one result should get the user to ask the user something along the lines of “Would you like to mark this article as relevant?”. Then the user says “yes”, and the agent asks, “Is this article relevant?” and the user answers yes/no.

By the way, you will need to add primitive templates in dataset.tt for the action. You almost always need primitive templates for actions so you can express the grammatical relationship between the action verb and the parameters correctly. You definitely need primitive templates to generate a phrase like “mark this as relevant”, which you need. (That would be "mark $p_article as relevant" in dataset.tt)

I think we will be better off with option 2 then, I want to get it working as fast as possible and this seems to be the less complicated of the two.
I tried changing the query to also return list as follows:


But now the output also prints the title and description for some reason:

I also still don’t understand what we have to add to the manifest/dataset to get the Almond to ask whether we want to mark or not, as in where should we put the “Would you like to mark?” and “Is this article relevant?” statements. So far I have added a template in the dataset for the action as follows:

Yeah Genie is trying to be “helpful” add as much information as possible about the articles, given what the query returns.

I think you can suppress that with a result phrase like:

#_[result=["Here is a random article { |. ${title} ${description}}"]]

(The result phrase has two variants inside the {}, separated by |. The first is clean, the second includes the title and description. Because some variant includes title and description, Genie will not add them separately after the phrase. But then agent always speaks the first variant so they never show up.)

As for the action, what you want is exactly:

action (p_id : Entity(org.itspersonal.newsfilter:training_news_article)) = @org.itspersonal.newsfilter.mark_training_news_article(id=p_id)
  #_[utterances=["mark $p_id article"]]
  #[name="MarkTrainingNewsArticleWithId"];

Do not include the relevant argument. Genie will ask the user for it.

(Also, why are you posting code as pictures? This forum supports markdown…)

Sorry, I keep forgetting about the codeblock function in the post editor, I’m not used to posting on forums with markdown.
Well, the results are now showing in the format I want, but it still doesn’t call the action function:

I’m not sure exactly why it doesn’t show the action then. I think everything in your manifest and dataset looks correct. I’ll have to debug it a bit, and get back to you.

Could it be because the NLP as you said isn’t working? So maybe it bugs the dataset understanding by Almond?

No this is about the agent side of things, not the interpretation. Anyway I’ll take a closer look locally and see what I dig up…

1 Like