{ "info": { "author": "Jacob Scott", "author_email": "jscott12009@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3 :: Only" ], "description": "[](https://travis-ci.org/crumpstrr33/Utter-More)\n\n# Utter More\nTo customize Amazon's Alexa, you make what is called a skill. Do do something in the skill, you make an intent. To run the intent, you make an utterance. When that utterance is uttered, the intent is run. Since language is complex, there may be many different ways to say the same thing and you may want Alexa to pick up on all of those ways. Furthermore, you may have many variables for the utterances (called intent slots). Being verbose enough to cover every case can be tedious, so this takes care of that.\n\n## Installing Package\nJust do the classic:\n```\npip install utter-more\n```\nOr if you're adventurous and use Conda:\n```\nconda install -c crumpstrr33 utter-more\n```\n\n## Creating Utterances\nBelow are some examples to show its functionality.\n### Formatting\nThere are two options currently:\n1) OR statement `(a|b|c|...)` - Used if you want to allow multiple interchangeable words. For example, if `photo`, `picture` and `painting` are interchangeable in your utterances, then write `(photo|picture|painting)` in the place where it would be. The number of words to OR is arbitrary and single curly keywords like `{intent_slot}` can be used in this.\n3) Conditional OR statement `(a*tag1|b) (c^tag1|d)` - Used if you want the appearance of a phrase in an OR statement to be dependent on another phrase. Here, `a` is the master and `c` is the follower; utterances with `c` will only appear if it also contains `a`. Another functionality of this is as follows. If you have `(It*s|They*p) (is^s|are^p) (close^s|far^p)`, `is` and `close` will only show if `It` also shows and, conversely, `are` and `far` will only show if `They` shows. This is how you can do a conditional AND with this function.\n2) Optional Intent Slot `{{slot}}` - Used if the existence of an intent slot in your utterance is optional. For example, if you have an optional adverb you may write `I {adverb} love it` or just `I love it`. Instead you can write `I {{adverb}} love it` to capture both.\n\n### Running the Code\nNow with the formatting down, lets create some templates for the utterances. Something like:\n```\n\"What is that {{descriptor}} (photo|picture) (of|from)\"\n```\nand\n```\n\"Download the (photo|picture) {{to_file_path}}\"\n```\nTo do this, we run the following:\n``` python\nfrom pprint import pprint\nfrom utter_more import UtterMore\n\num = UtterMore(\"What (is*s|are*p) (that^s|those^p) {{descriptor}} (photo|picture)(^s|s^p) (of|from)\",\n \"Download the (photo|picture) {{to_file_path}}\")\num.iter_build_utterances()\n\npprint(um.utterances)\n```\nAnd this will display:\n``` python\n[['What is that {descriptor} photo of',\n 'What is that {descriptor} photo from',\n 'What is that {descriptor} picture of',\n 'What is that {descriptor} picture from',\n 'What is that photo of',\n 'What is that photo from',\n 'What is that picture of',\n 'What is that picture from',\n 'What are those {descriptor} photos of',\n 'What are those {descriptor} photos from',\n 'What are those {descriptor} pictures of',\n 'What are those {descriptor} pictures from',\n 'What are those photos of',\n 'What are those photos from',\n 'What are those pictures of',\n 'What are those pictures from'],\n ['Download the photo {to_file_path}',\n 'Download the photo',\n 'Download the picture {to_file_path}',\n 'Download the picture']]\n```\nHere we can easily follow the grammatical rules of plurality. If we want to save the utterances so that we can upload them to our Alexa skill, we simply do:\n``` python\num.save_for_alexa(PATH_TO_DIRECTORY, FILE_NAME)\n```\nHere we will find the CSV file properly formatted for uploading.\n\n## Uploading the Utterances\n1) After going to the tab for the intended intent, click on \"Bulk Edit\" in the top right corner of the page.\n\n
\n \n
\n \n
\n \n
\n \n \n
\n \n
\n \n
\n \n