Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miguelmota/intent-utterance-file-parser
Parse an intent utterance file, like the Alexa Skills Kit Sample Utterance file.
https://github.com/miguelmota/intent-utterance-file-parser
Last synced: 3 months ago
JSON representation
Parse an intent utterance file, like the Alexa Skills Kit Sample Utterance file.
- Host: GitHub
- URL: https://github.com/miguelmota/intent-utterance-file-parser
- Owner: miguelmota
- License: mit
- Archived: true
- Created: 2015-09-15T07:57:35.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-18T07:46:57.000Z (about 9 years ago)
- Last Synced: 2024-07-01T14:19:31.964Z (4 months ago)
- Language: JavaScript
- Homepage: https://github.com/miguelmota/intent-utterance-file-parser
- Size: 133 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Intent Utterance File Parser
> Parse an intent utterance file, like the [Alexa Skills Kit Sample Utterance file](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/defining-the-voice-interface).
The parser extracts words and slots from each intent.
# Install
```bash
npm install intent-utterance-file-parser
```# Usage
`IntentUtterances.txt`
```text
GetHoroscope what is the horoscope for {pisces|Sign}
GetHoroscope what will the horoscope for {leo|Sign} be {next tuesday|Date}
GetHoroscope get me my horoscope
GetHoroscope {gemini|Sign}GetLuckyNumbers what are my lucky numbers
GetLuckyNumbers tell me my lucky numbers
```File parsing
```javascript
const fs = require('fs');
const IntentUtteranceParser = require('intent-utterance-file-parser');const fileStream = fs.createReadStream(__dirname + '/IntentUtterances.txt');
IntentUtteranceParser(fileStream, function(error, response) {
if (error) {
console.error(error);
return false;
}console.log(response);
/*
[
{
"intent": "GetHoroscope",
"slots": [
{
"name": "Sign",
"type": "LITERAL"
},
{
"name": "Date",
"type": "LITERAL"
}
],
"utterances": [
[
"what",
"is",
"the",
"horoscope",
"for",
"pisces"
],
[
"what",
"will",
"the",
"horoscope",
"for",
"be",
"leo",
"next",
"tuesday"
],
[
"get",
"me",
"my",
"horoscope"
],
[
"gemini"
]
]
},
{
"intent": "GetLuckyNumbers",
"slots": [],
"utterances": [
[
"what",
"are",
"my",
"lucky",
"numbers"
],
[
"tell",
"me",
"my",
"lucky",
"numbers"
]
]
}
]
*/console.log(IntentUtteranceParser.getUniqueWords(response));
/*
[
"what",
"is",
"the",
"horoscope",
"for",
"pisces",
"will",
"be",
"leo",
"next",
"tuesday",
"get",
"me",
"my",
"gemini",
"are",
"lucky",
"numbers",
"tell"
]
*/
});
```# Test
```bash
npm test
```# License
MIT