Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ekms

Package Overview
Dependencies
Maintainers
1
Versions
1122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ekms

Reusable libraries for Entodicton, a natural language to json converter

  • 5.51.174
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
184
increased by982.35%
Maintainers
1
Weekly downloads
 
Created
Source

Entodicton Knowledge Modules

This is a library of entodicton knowledge modules that can be reused. A description of the contents can be found here

Knowledge Modules

The list of knowledge modules can be found here

Usage

The basic usage is redefine the interface functions to point to your data. Then all of the queries that are supported can be performed against your data. Here is an example of how to do that

The first step is to include the client and the knowledge module project called EKMS

const { store } = require('ekms')

store is the knowledge module that describe how to interpret utterances about the store domain. By default the km will work with test data. You can run it the same as any other Entodicton config. For example, this works against the shared server

url = "http://184.67.27.82"
key = "6804954f-e56d-471f-bbb8-08e3c54d9321"
store.server(url, key)
store.process('list the products').then( (response) => {
    //console.log(JSON.stringify(response, null, 2))
      console.log(response.generated[0])
})

The result of running this would be

dev@devlaptop:~/code/thinktelligence/kms$ node use_store.js
[ 'the products are pants1 and shirt1' ]

In order to customize the output to your domain you would need to redefine the interface to access your data

const testData = {
  types: [ 'tanks', 'planes' ],
  products: [
    { marker: 'product', isInstance: true, type: 'tanks', name: 'Tamiya Tiger', cost: 9, id: 1 },
    { marker: 'product', isInstance: true, type: 'planes', name: 'Meng P-47', cost: 15, id: 2 },
  ]
}

const interface = {
  getTypes: () => testData.types,
  getAllProducts: () => testData.products,
  getByTypeAndCost: ({type, cost, comparison}) => {
      results = []
      testData.forEach( (product) => {
      if (product.type == type && comparison(product.cost)) {
        results.append(product)
      }
    })
    return results
  },
  productGenerator: [({context}) => context.marker == 'product' && context.isInstance, ({g, context}) => `${context.name}`]
};

store.interface = interface

url = "http://184.67.27.82"
key = "6804954f-e56d-471f-bbb8-08e3c54d9321"
store.server(url, key)
store.process('list the products').then( (response) => {
  //console.log(JSON.stringify(response, null, 2))
  console.log(response.generated[0])
})

After doing this the results of running would be

dev@devlaptop:~/code/thinktelligence/kms$ node use_store.js
[ 'the products are Tamiya Tiger and Meng P-47' ]

Sample code that runs this example can be found here

Keywords

FAQs

Package last updated on 30 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc