Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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.

License

NotificationsYou must be signed in to change notification settings

CathySunRprogramming/natural-language-classifier-nodejs

 
 

Repository files navigation

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.

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 theCloud-foundry CLI tool if you haven't already.

  3. Edit themanifest.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:  -my-service-instancename:<application-name>command:npm startpath:.memory:512M
  1. Connect to Bluemix with the command line tool.
cf api https://api.ng.bluemix.netcf login
  1. Create and retrieve service keys to access theNatural Language CLassifier service:
cf create-service natural_language_classifier standard my-nlc-servicecf create-service-key my-nlc-service myKeycf service-key my-nlc-service myKey
  1. The Natural Language Classifier service must be trained before you can successfully use this application. The training data is provided in the filetraining/weather_data_train.csv.
    Train a classifier by using the following command:
curl -i -u "<username>":"<password>" \-F training_data=@training/weather_data_train.csv \-F training_metadata="{\"language\":\"en\",\"name\":\"TutorialClassifier\"}" \"https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers"

Copy<username> and<password> from step 5

  1. Create a.env file in the root directory by copying the sample.env.example file using the following command:
cp .env.example .env

You will update the.env with the information you retrieved in steps 5 and 6

The.env file will look something like the following:

NATURAL_LANGUAGE_CLASSIFIER_USERNAME=NATURAL_LANGUAGE_CLASSIFIER_PASSWORD=CLASSIFIER_ID=
  1. Install the dependencies you application need:
npm install
  1. Start the application locally:
npm start
  1. Point your browser tohttp://localhost:3000.

  2. Optional: Push the application to Bluemix:

cf push

After completing the steps above, you are ready to test your application. Start a browser and enter the URL of your application.

        <your application name>.mybluemix.net

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

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 thedocumentation for the Natural Language Classifier.


Directory structure

.├── app.js                      // express routes├── config                      // express configuration│   ├── error-handler.js│   ├── express.js│   └── security.js├── manifest.yml├── package.json├── public                      // static resources├── server.js                   // entry point├── test                        // unit tests├── training│   └── weather_data_train.csv  // training file└── views                       // react components

License

This sample code is licensed under Apache 2.0.

Contributing

SeeCONTRIBUTING.

Open Source @ IBM

Find more open source projects on theIBM Github Page

Privacy Notice

Sample web applications that include this package may be configured to track deployments toIBM Bluemix and other Cloud Foundry platforms. The following information is sent to aDeployment Tracker service on each deployment:

  • Node.js package version
  • Node.js repository URL
  • Application Name (application_name)
  • Space ID (space_id)
  • Application Version (application_version)
  • Application URIs (application_uris)
  • Labels of bound services
  • Number of instances for each bound service and associated plan information

This data is collected from thepackage.json file in the sample application and theVCAP_APPLICATION andVCAP_SERVICES environment variables 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 to measure the usefulness of our examples, so that we can continuously improve the content we offer to you. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript95.0%
  • CSS5.0%

[8]ページ先頭

©2009-2025 Movatter.jp