Coder Social home page Coder Social logo

200gautam / natural-language-classifier-nodejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from watson-developer-cloud/natural-language-classifier-nodejs

0.0 1.0 0.0 390 KB

See how the classifier service uses natural language to determine the intent behind your question. Ask a question about the weather, and watch as the service classifies the intent as 'temperature' or 'condition' related.

Home Page: http://natural-language-classifier-demo.mybluemix.net/

License: Apache License 2.0

JavaScript 8.58% CSS 70.94% HTML 20.49%

natural-language-classifier-nodejs's Introduction

Natural Language Classifier Demo

Build Status codecov.io

The IBM Watson™ Natural Language Classifier service applies deep learning techniques to make predictions about the best predefined classes for short sentences or phrases. The classes can trigger a corresponding action in an application, such as directing a request to a location or person, or answering a question. After training, the service returns information for texts that it hasn't seen before. The response includes the name of the top classes and confidence values.

Give it a try! Click the button below to fork into IBM DevOps Services and deploy your own copy of this application on Bluemix.

Deploy to Bluemix

Getting started

  1. You need a Bluemix account. If you don't have one, sign up. Experimental Watson Services are free to use.

  2. Download and install the Cloud-foundry CLI tool if you haven't already.

  3. Edit the manifest.yml file and change <application-name> to something unique. The name you use determines the URL of your application. For example, <application-name>.mybluemix.net.

    applications:
    - services:
      - natural-language-classifier-standard
      name: <application-name>
      command: node app.js
      path: .
      memory: 128M
    
  4. Connect to Bluemix with the command line tool.

    $ cf api https://api.ng.bluemix.net
    $ cf login -u <your user ID>
  5. Create the Natural Language Classifier service in Bluemix.

    $ cf create-service natural_language_classifier standard natural-language-classifier-standard
  6. Push your app to make it live:

    $ cf push
  7. Create and train the NLC service using the weather training data. Take note of the <classifier-id>.

  8. To configure the app.js file to use your classifier, export the classifier ID as an environment variable.

    $ cf set-env <application-name> CLASSIFIER_ID <classifier-id>
  9. Finally, restage the application to ensure the environment variable is set.

    $ cf restage <application-name>

    For more details about developing applications that use Watson Developer Cloud services in Bluemix, see Getting started with Watson Developer Cloud and Bluemix.

Running locally

  1. Download and install Node.js and npm.

  2. Create an instance of the Natural Language Classifier service on Bluemix.

  3. Create and train the NLC service using, for example, the weather training data. Note the value of the Classifier ID in the response.

  4. Configure the code to connect to your service:

    1. Copy the credentials from your natural-language-classifier-standard service in Bluemix. Run the following command:

      $ cf env <application-name>

      Example output:

      System-Provided:
      {
        "VCAP_SERVICES": {
      	"natural_language_classifier": [
      	  {
      		"credentials": {
      		  "password": "<password>",
      		  "url": "<url>",
      		  "username": "<username>"
      		}
      		"label": "natural-language-classifier",
      		"name": "natural-language-classifier-standard",
      		"plan": "standard",
      		"tags": [
      		  ...
      		]
      	  }
      	]
        }
      }
    2. Copy username, password, and url from the credentials.

    3. Open the app.js file and paste the username, password, and url credentials for the service.

    4. In the app.js file paste the "Classifier ID". Save the app.js file.

  5. Install the Natural Language Classifier Node.js package:

    1. Change to the new directory that contains the project.
    2. Run the following command:node
    $ npm install
  6. Run the following command to start the application:

    npm start
  7. Point your browser to http://localhost:3000.

  8. Train the classifier, if you haven't already. See the step earlier under Getting started.

Troubleshooting

  • The main source of troubleshooting and recovery information is the Bluemix log. To view the log, run the following command:

    $ cf logs <application-name> --recent
  • For more details about the service, see the documentation for the Natural Language Classifier.

License

This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.
This sample uses jquery which is MIT license

Contributing

See CONTRIBUTING.

Open Source @ IBM

Find more open source projects on the IBM Github Page

Privacy Notice

This node sample web application includes code to track deployments to Bluemix and other Cloud Foundry platforms. The following information is sent to a Deployment Tracker service on each deployment:

  • Application Name (application_name)
  • Space ID (space_id)
  • Application Version (application_version)
  • Application URIs (application_uris)

This data is collected from the VCAP_APPLICATION environment variable in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.

Disabling Deployment Tracking

Deployment tracking can be disabled by removing require('cf-deployment-tracker-client').track(); from the beginning of the server.js file at the root of this repo.

natural-language-classifier-nodejs's People

Contributors

germanattanasio avatar sirspidey avatar nfriedly avatar florenciacomuzzi avatar lhuihui avatar andrew-c-edwards avatar swamichandra avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.