Skip to content

Sample application using Watson Natural Language Understand and IBM Cloud Functions

Notifications You must be signed in to change notification settings

ghas-results/watson-nlu-dbpedia-app

 
 

Repository files navigation

watson-nlu-dbpedia-app

A sample application that uses Watson Natural Language Understanding, DBpedia, and IBM Cloud Functions (OpenWhisk).


The client application is implemented with Vue.js. The UI enables a user to enter a url, preferably one that references a news article. The UI invokes a backend that analyzes the article's contents, identifies a subset of relevant entities, then looks up their details using DBpedia. Finally, the results are rendered as cards. Entities with locations will appear on a Google Map.

The backend is implemented using IBM Cloud Functions.

Try it out

To see the live working demo, navigate to https://nlu-web.mybluemix.net

Prerequisities

Setup

Server

  1. Login and set your target organization and space

    bx login
    bx target -o <YOUR-ORGANIZATION> -s <YOUR-SPACE>
  2. Apply your Watson Natural Language Understanding service credentials

    vi server/index.js
    

    Note: :wq! will save an exit from vi

  3. Replace line <YOUR-USERNAME> and <YOUR-PASSWORD> with your service credentials

    const nlu = new NaturalLanguageUnderstandingV1({
      username: '<YOUR-USERNAME>',
      password: '<YOUR-PASSWORD>',
      version_date: '2017-02-27',
    })
  4. Deploy the OpenWhisk action (IBM Cloud Function)

     bx wsk action update /<YOUR-ORGANIZATION>_<YOUR-SPACE>/demo/nlu_analyze index.js --web true --kind nodejs:8

Client

  1. Change the endpoint url to reference your new action's endpoint

    vi src/config.js
    export const nluNewsApiRoot = 'https://openwhisk.ng.bluemix.net/api/v1/web/<YOUR-ORGANIZATION>_<YOUR-SPACE>/demo'
  2. Install dependencies

npm install

Run (locally)

  1. Install dependencies

    npm start
  2. Navigate to http://localhost:8080

Deploy (IBM Cloud)

  1. Open ./manifest.yml and update name and host with <YOUR-USERNAME>-nlu-web

  2. Build for production

    npm run build
  3. Deploy

    cf push
  4. Navigate to https://YOUR-USERNAME.mybluemix.net

License

MIT

About

Sample application using Watson Natural Language Understand and IBM Cloud Functions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 73.2%
  • Vue 25.2%
  • HTML 1.6%