Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add parameters.genie for Chinese #15

Merged
merged 2 commits into from
Mar 14, 2019
Merged

add parameters.genie for Chinese #15

merged 2 commits into from
Mar 14, 2019

Conversation

johnnychhsu
Copy link
Contributor

@johnnychhsu johnnychhsu commented Mar 5, 2019

add parameters.genie for Chinese

@johnnychhsu
Copy link
Contributor Author

johnnychhsu commented Mar 5, 2019

@gcampax
I am not sure about this part
forward_get_do_command = command:forward_get_do_command ('it' | 'that' | 'them') [-> pname]
it seems like the 'it' is a pronouns in the second template of the result in the first template?

@gcampax
Copy link
Contributor

gcampax commented Mar 5, 2019

By the way, you might want a better commit message than "init commit" so in the future, when you go through the history to e.g. understand a change or figure out a regression, you'll remember what's going on.

See https://chris.beams.io/posts/git-commit/ for a guide. Learning to write good commit messages will be helpful in the future, just a general engineering skill!

@gcampax
Copy link
Contributor

gcampax commented Mar 5, 2019

@gcampax
I am not sure about this part
forward_get_do_command = command:forward_get_do_command ('it' | 'that' | 'them') [-> pname]
it seems like the 'it' is a pronouns in the second template of the result in the first template?

Yeah, so the syntax [-> pname] means: the first part of the template (forward_get_do_command, in this case) has a placeholder (called the current value of pname in the loop); replace it with the second part of the template ((it | that | them) in this case.

In other words, this takes a derivation of the form:

'when i receive an email reply to $p_email_id' => monitor (@com.gmail.inbox()) => (p_email_id : EmailAddress) -> @com.gmail.reply(email_id=p_email_id);

and converts it

'when i receive an email reply to it' => monitor (@com.gmail.inbox()) => @com.gmail.reply(email_id=email_id);

If you look at the code, you'll see there are 3 cases where this templates kicks in:

  • parameter passing of pictures: from
    when i upload a picture on instagram, post $p_picture_url on twitter => monitor (@com.instagram.get_pictures()) => (p_picture_url : Picture) -> @com.twitter.post_picture(picture_url=p_picture_url);
    
    to
    when i upload a picture on instagram, post it on twitter => monitor (@com.instagram.get_pictures()) => @com.twitter.post_picture(picture_url=picture_url);
    
  • parameter passing of certain types of id (the previous email_id example)
  • parameter passing of $event (a string description of the result of the get/when part); for example,
    get my fitbit steps and then post $p_status on facebook => now => @com.fitbit.getsteps() => (p_status : String) -> @com.facebook.post(status=p_status);
    
    becomes
    get my fitbit steps and then post that on facebook => now => @com.fitbit.getsteps() => @com.facebook.post(status=$event);
    

@johnnychhsu
Copy link
Contributor Author

By the way, you might want a better commit message than "init commit" so in the future, when you go through the history to e.g. understand a change or figure out a regression, you'll remember what's going on.

See https://chris.beams.io/posts/git-commit/ for a guide. Learning to write good commit messages will be helpful in the future, just a general engineering skill!

Got it! Thank you for sharing this, it's useful !

@johnnychhsu
Copy link
Contributor Author

@gcampax
I am not sure about this part
forward_get_do_command = command:forward_get_do_command ('it' | 'that' | 'them') [-> pname]
it seems like the 'it' is a pronouns in the second template of the result in the first template?

Yeah, so the syntax [-> pname] means: the first part of the template (forward_get_do_command, in this case) has a placeholder (called the current value of pname in the loop); replace it with the second part of the template ((it | that | them) in this case.

In other words, this takes a derivation of the form:

'when i receive an email reply to $p_email_id' => monitor (@com.gmail.inbox()) => (p_email_id : EmailAddress) -> @com.gmail.reply(email_id=p_email_id);

and converts it

'when i receive an email reply to it' => monitor (@com.gmail.inbox()) => @com.gmail.reply(email_id=email_id);

If you look at the code, you'll see there are 3 cases where this templates kicks in:

  • parameter passing of pictures: from
    when i upload a picture on instagram, post $p_picture_url on twitter => monitor (@com.instagram.get_pictures()) => (p_picture_url : Picture) -> @com.twitter.post_picture(picture_url=p_picture_url);
    
    to
    when i upload a picture on instagram, post it on twitter => monitor (@com.instagram.get_pictures()) => @com.twitter.post_picture(picture_url=picture_url);
    
  • parameter passing of certain types of id (the previous email_id example)
  • parameter passing of $event (a string description of the result of the get/when part); for example,
    get my fitbit steps and then post $p_status on facebook => now => @com.fitbit.getsteps() => (p_status : String) -> @com.facebook.post(status=p_status);
    
    becomes
    get my fitbit steps and then post that on facebook => now => @com.fitbit.getsteps() => @com.facebook.post(status=$event);
    

I see. So these three types cover all the possible parameters passing scenario currently support in Almond right?

@gcampax
Copy link
Contributor

gcampax commented Mar 6, 2019

Well, Almond (really, ThingTalk) support parameter passing any output parameter into any input parameter of the same type.
Those are just some of the templates of how we express that in English.

There are other parameter passing "styles". One is projection-based:
post $p_status on facebook (in the non-terminal thingpedia_action) and the title of the latest xkcd (a projection_String) combines into post the title of the latest xkcd on facebook

The other is by parameter name:
the latest xkcd (a complete_table) and post $p_status on facebook (a thingpedia_action) combine into get the latest xkcd and post $p_status on facebook (a get_do_command), which we then turn into get the latest xkcd and post the title on facebook (also a get_do_command, and immediately after a complete_get_do_command)

If the natural language allows it, you can imagine more parameter passing styles (aka coreferences). These are just the ones that make sense in English.

@johnnychhsu johnnychhsu requested a review from gcampax March 6, 2019 08:07
@johnnychhsu
Copy link
Contributor Author

Thank you!
As we come across more device in Chinese, I think we could add more to handle in the future.
Currently it is done.

@johnnychhsu
Copy link
Contributor Author

Well, Almond (really, ThingTalk) support parameter passing any output parameter into any input parameter of the same type.
Those are just some of the templates of how we express that in English.

There are other parameter passing "styles". One is projection-based:
post $p_status on facebook (in the non-terminal thingpedia_action) and the title of the latest xkcd (a projection_String) combines into post the title of the latest xkcd on facebook

The other is by parameter name:
the latest xkcd (a complete_table) and post $p_status on facebook (a thingpedia_action) combine into get the latest xkcd and post $p_status on facebook (a get_do_command), which we then turn into get the latest xkcd and post the title on facebook (also a get_do_command, and immediately after a complete_get_do_command)

If the natural language allows it, you can imagine more parameter passing styles (aka coreferences). These are just the ones that make sense in English.

what do you mean by complete ?

@sileix
Copy link
Member

sileix commented Mar 9, 2019

Well, Almond (really, ThingTalk) support parameter passing any output parameter into any input parameter of the same type.
Those are just some of the templates of how we express that in English.
There are other parameter passing "styles". One is projection-based:
post $p_status on facebook (in the non-terminal thingpedia_action) and the title of the latest xkcd (a projection_String) combines into post the title of the latest xkcd on facebook
The other is by parameter name:
the latest xkcd (a complete_table) and post $p_status on facebook (a thingpedia_action) combine into get the latest xkcd and post $p_status on facebook (a get_do_command), which we then turn into get the latest xkcd and post the title on facebook (also a get_do_command, and immediately after a complete_get_do_command)
If the natural language allows it, you can imagine more parameter passing styles (aka coreferences). These are just the ones that make sense in English.

what do you mean by complete ?

are you referring to the term complete in complete_table and complete_get_do_command?
here, complete means there is no placeholder in the sentence and the generated sentence is good to be used at the top level (root in thinktalk.genie)

@johnnychhsu
Copy link
Contributor Author

johnnychhsu commented Mar 12, 2019

@rayslxu
I see. Thank you!
Currently done.

@sileix sileix self-requested a review March 13, 2019 17:18
@johnnychhsu johnnychhsu merged commit e8218e7 into master Mar 14, 2019
@johnnychhsu johnnychhsu deleted the zh-tw_parameters branch April 3, 2019 06:48
gcampax added a commit that referenced this pull request Jun 23, 2020
We want to deemphasize Comma for the 1.0 release, and the question
is confusing anyway.

Fixes #15.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants