mysam-extract
v0.2.0
Published
Extract tags from sentences
Downloads
1
Readme
mysam-extract
Extract tags from sentences
Used by MySam's taggin mechanism.
Example
npm install mysam-extract
const extract = require('mysam-extract');
const locator = extract.extractor('what\'s the weather in vancouver');
locator.tag({ location: [ 5, 5 ] });
locator.extract('do you know, how is the weather in san francisco')
// {
// "tags": {
// "location": [ 8, 9 ]
// },
// "extracted": {
// "location": "san francisco"
// }
// }
const list = extract.extractor('can you put toothpaste on the shopping list');
list.tag({
items: [ 3, 3 ],
list: [ 6, 6 ]
});
list.extract('Please put cat food and apples on the grocery list');
// {
// "tags": {
// "items": [ 2, 5 ],
// "list": [ 8, 8 ]
// },
// "extracted": {
// "items": "cat food and apples",
// "list": "grocery"
// }
// }
License
Copyright (c) 2016
Licensed under the MIT license.