node-concept-net icon indicating copy to clipboard operation
node-concept-net copied to clipboard

problem with examples

Open dcsan opened this issue 7 years ago • 1 comments

I'm trying the example code, basically:


const ConceptNet = require( 'concept-net' )
// let conceptNet = ConceptNet(null, null, '5.3')
let conceptNet = ConceptNet()

  async checkIdea(word) {

    conceptNet.search({
      start: '/c/en/donut'
    }, function onDone( err, result ) {
      log(err)
      log(result)
    })

    let xpath = '/c/en/toast' // + word
    conceptNet.lookup( xpath, {
      limit: 10,
      offset: 0,
      filter: 'core'
    }, function onDone( err, result ) {
      log(err)
      log(result)
    })
  }

and getting the errors below back:

undefined
{ '@context': [ 'http://api.conceptnet.io/ld/conceptnet5.6/context.ld.json' ],
  error:
   { details: '\'/data/5.4/c/en/toast\' isn\'t a URL that we understand.',
     status: 404 } }
undefined
{ '@context': [ 'http://api.conceptnet.io/ld/conceptnet5.6/context.ld.json' ],
  error:
   { details: '\'/data/5.4/search\' isn\'t a URL that we understand.',
     status: 404 } }

have the URLs changed?

is '/data/5.4 the correct prepend for URI calls?

I also tried with the version exactly as you have specified in the examples let conceptNet = ConceptNet(null, null, '5.3')

but that doesn't seem to change the error code in the context URI conceptnet5.6

undefined
{ '@context': [ 'http://api.conceptnet.io/ld/conceptnet5.6/context.ld.json' ],
  error:
   { details: '\'/data/5.3/c/en/toast\' isn\'t a URL that we understand.',
     status: 404 } }

Excited to try this out, appreciate any advice.

dcsan avatar Aug 12 '18 18:08 dcsan

Hi there, yes, I can confirm the requests do not work. It seems that ConceptNet has upgraded to a new API URL for requests, see here:

https://github.com/commonsense/conceptnet5/wiki/API

The results one gets back have changed too, will need to look into it. For the time being, I suggest you make the HTTP requests directly without trying to make use of this library.

Planeshifter avatar Aug 12 '18 21:08 Planeshifter