Planeshifter / node-concept-net

node.js interface to the ConceptNet semantic network API [DEPRECATED; ConceptNet API has changed]
MIT License
29 stars 3 forks source link

problem with examples #7

Open dcsan opened 5 years ago

dcsan commented 5 years ago

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.

Planeshifter commented 5 years ago

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.