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.
To see the live working demo, navigate to https://nlu-web.mybluemix.net
-
Required IBM Cloud account. Lite / Free tier is sufficient.
-
A Watson Natural Language Understanding service instance on IBM Cloud.
-
Login and set your target organization and space
bx login bx target -o <YOUR-ORGANIZATION> -s <YOUR-SPACE>
-
Apply your Watson Natural Language Understanding service credentials
vi server/index.js
Note:
:wq!
will save an exit fromvi
-
Replace line
<YOUR-USERNAME>
and<YOUR-PASSWORD>
with your service credentialsconst nlu = new NaturalLanguageUnderstandingV1({ username: '<YOUR-USERNAME>', password: '<YOUR-PASSWORD>', version_date: '2017-02-27', })
-
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
-
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'
-
Install dependencies
npm install
-
Install dependencies
npm start
-
Navigate to http://localhost:8080
-
Open
./manifest.yml
and updatename
andhost
with<YOUR-USERNAME>-nlu-web
-
Build for production
npm run build
-
Deploy
cf push
-
Navigate to https://YOUR-USERNAME.mybluemix.net
MIT