mysam-extract

0.2.0 • Public • Published

mysam-extract

Build Status

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.

Readme

Keywords

Package Sidebar

Install

npm i mysam-extract

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • daffl