You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 22, 2021. It is now read-only.
If you are having difficulties running the app or have a question about the service, please ask a question on [dW Answers](https://developer.ibm.com/answers/questions/ask/?topics=watson) or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).
3
+
If you are having problems using the APIs or have a question about the IBM
or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).
7
+
8
+
# Code
9
+
10
+
* Our style guide is based on [Google's](https://google.github.io/styleguide/jsguide.html), most of it is automaticaly enforced (and can be automatically applied with `npm run autofix`)
11
+
* Commits should follow the [Angular commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). This is because our release tool uses this format for determining release versions and generating changelogs. To make this easier, we recommend using the [Commitizen CLI](https://github.com/commitizen/cz-cli) with the `cz-conventional-changelog` adapter.
4
12
5
13
# Issues
6
14
7
-
If you encounter an issue with this sample app, you are welcome to submit a [bug report](https://github.com/watson-developer-cloud/natural-language-classifier-nodejs/issues). Before that, please search for similar issues. It's possible somebody has encountered this issue already.
15
+
If you encounter an issue with the Node.js library, you are welcome to submit
16
+
a [bug report](https://github.com/watson-developer-cloud/natural-language-classifier-nodejs/issues).
17
+
Before that, please search for similar issues. It's possible somebody has
18
+
already encountered this issue.
8
19
9
20
# Pull Requests
10
21
11
-
If you want to contribute to the repository, here's a quick guide:
22
+
If you want to contribute to the repository, follow these steps:
12
23
13
24
1. Fork the repo.
14
-
1. develop your code changes: `npm install -d`
15
-
1. Test your changes: `npm test`
16
-
1. Commit your changes
17
-
1. Push to your fork and submit a pull request
25
+
2. Develop and test your code changes: `npm install -d && npm test`.
26
+
3. Travis-CI will run the tests for all services once your changes are merged.
27
+
4. Add a test for your changes. Only refactoring and documentation changes require no new tests.
28
+
5. Make the test pass.
29
+
6. Commit your changes.
30
+
7. Push to your fork and submit a pull request.
31
+
32
+
# Developer's Certificate of Origin 1.1
33
+
34
+
By making a contribution to this project, I certify that:
35
+
36
+
(a) The contribution was created in whole or in part by me and I
37
+
have the right to submit it under the open source license
38
+
indicated in the file; or
39
+
40
+
(b) The contribution is based upon previous work that, to the best
41
+
of my knowledge, is covered under an appropriate open source
42
+
license and I have the right under that license to submit that
43
+
work with modifications, whether created in whole or in part
44
+
by me, under the same open source license (unless I am
45
+
permitted to submit under a different license), as indicated
46
+
in the file; or
47
+
48
+
(c) The contribution was provided directly to me by some other
49
+
person who certified (a), (b) or (c) and I have not modified
50
+
it.
51
+
52
+
(d) I understand and agree that this project and the contribution
53
+
are public and that a record of the contribution (including all
54
+
personal information I submit with it, including my sign-off) is
55
+
maintained indefinitely and may be redistributed consistent with
56
+
this project or the open source license(s) involved.
57
+
58
+
## Tests
59
+
60
+
Ideally, we'd like to see both unit and innervation tests on each method.
61
+
(Unit tests do not actually connect to the Watson service, integration tests do.)
62
+
63
+
Out of the box, `npm test` runs linting and unit tests, but skips the integration tests,
# Natural Language Classifier Demo [](http://travis-ci.org/watson-developer-cloud/natural-language-classifier-nodejs)
2
-
3
-
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.
1
+
<h1align="center"style="border-bottom: none;">🚀 Natural Language Classifier Sample Application</h1>
2
+
<h3align="center">This Node.js app demonstrates some of the Natural Language Classifier service features.</h3>
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.
4
14
5
15

6
16
7
-
## Getting started
8
-
9
-
1. You need a Bluemix account. If you don't have one, [sign up][sign_up]. Experimental Watson Services are free to use.
10
-
11
-
2. Download and install the [Cloud-foundry CLI][cloud_foundry] tool if you haven't already.
12
-
13
-
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`.
14
-
15
-
```yaml
16
-
applications:
17
-
- services:
18
-
- my-service-instance
19
-
name: <application-name>
20
-
command: npm start
21
-
path: .
22
-
memory: 512M
23
-
```
17
+
You can view a [demo](https://natural-language-classifier-demo.ng.bluemix.net/) of this app.
24
18
25
-
4. Connect to Bluemix with the command line tool.
26
19
27
-
```sh
28
-
cf api https://api.ng.bluemix.net
29
-
cf login
30
-
```
20
+
## Prerequisites
31
21
32
-
5. Create and retrieve service keys to access the [Natural Language Classifier][nlc_docs] service:
22
+
1. Sign up for an [IBM Cloud account](https://console.bluemix.net/registration/).
23
+
1. Download the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview).
24
+
1. Create an instance of the Natural Language Classifier service and get your credentials:
25
+
- Go to the [Natural Language Classifier](https://console.bluemix.net/catalog/services/natural-language-classifier) page in the IBM Cloud Catalog.
26
+
- Log in to your IBM Cloud account.
27
+
- Click **Create**.
28
+
- Click **Show** to view the service credentials.
29
+
- Copy the `apikey` value, or copy the `username` and `password` values if your service instance doesn't provide an `apikey`.
30
+
- Copy the `url` value.
33
31
34
-
```none
35
-
cf create-service natural_language_classifier standard my-nlc-service
36
-
cf create-service-key my-nlc-service myKey
37
-
cf service-key my-nlc-service myKey
38
-
```
32
+
## Configuring the application
39
33
40
-
6. The Natural Language Classifier service must be trained before you can successfully use this application. The training data is provided in the file `training/weather_data_train.csv`.
41
-
Train a classifier by using the following command:
34
+
1. The Natural Language Classifier service must be trained before you can successfully use this application. The training data is provided in the file `training/weather_data_train.csv`.
35
+
If you have `username` and `password` credentials, train a classifier by using the following command:
- If your service instance uses `username` and `password` credentials, add the `NATURAL_LANGUAGE_CLASSIFIER_USERNAME` and `NATURAL_LANGUAGE_CLASSIFIER_PASSWORD` variables to the *.env* file.
71
63
72
-
9. Start the application locally:
64
+
Example *.env* file that configures the `username`, `password`, and `url` for a Natural Language Classifier service instance hosted in the Sydney region:
10. Point your browser to [http://localhost:3000](http://localhost:3000).
72
+
8. Add the `CLASSIFIER_ID` to the previous properties
79
73
80
-
11.**Optional:** Push the application to Bluemix:
74
+
```
75
+
CLASSIFIER_ID=522be-7b41-ab44-dec3-g1eab2ha73c6
76
+
```
81
77
82
-
```none
83
-
cf push
84
-
```
78
+
## Running locally
85
79
86
-
After completing the steps above, you are ready to test your application. Start a browser and enter the URL of your application.
80
+
1. Install the dependencies
87
81
88
-
<your application name>.mybluemix.net
82
+
```
83
+
npm install
84
+
```
89
85
86
+
1. Run the application
90
87
91
-
For more details about developing applications that use Watson Developer Cloud services in Bluemix, see [Getting started with Watson Developer Cloud and Bluemix][getting_started].
88
+
```
89
+
npm start
90
+
```
92
91
92
+
1. View the application in a browser at `localhost:3000`
93
93
94
-
## Troubleshooting
94
+
## Deploying to IBM Cloud as a Cloud Foundry Application
95
95
96
-
* The main source of troubleshooting and recovery information is the Bluemix log. To view the log, run the following command:
96
+
1. Login to IBM Cloud with the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview)
97
97
98
-
```sh
99
-
cf logs <application-name> --recent
100
-
```
98
+
```
99
+
ibmcloud login
100
+
```
101
+
102
+
1. Target a Cloud Foundry organization and space.
101
103
102
-
* For more details about the service, see the [documentation][nlc_docs] for the Natural Language Classifier.
104
+
```
105
+
ibmcloud target --cf
106
+
```
103
107
108
+
1. Edit the *manifest.yml* file. Change the **name** field to something unique.
109
+
For example, `- name: my-app-name`.
110
+
1. Deploy the application
104
111
105
-
----
112
+
```
113
+
ibmcloud app push
114
+
```
106
115
107
-
### Directory structure
116
+
1. View the application online at the app URL.
117
+
For example: https://my-app-name.mybluemix.net
118
+
119
+
120
+
## Directory structure
108
121
109
122
```none
110
123
.
@@ -125,17 +138,14 @@ For more details about developing applications that use Watson Developer Cloud s
125
138
126
139
## License
127
140
128
-
This sample code is licensed under Apache 2.0.
141
+
This sample code is licensed under Apache 2.0.
142
+
Full license text is available in [LICENSE](LICENSE).
129
143
130
144
## Contributing
131
145
132
-
See [CONTRIBUTING](.github/CONTRIBUTING.md).
146
+
See [CONTRIBUTING](CONTRIBUTING.md).
133
147
134
148
## Open Source @ IBM
135
-
Find more open source projects on the [IBM Github Page](http://ibm.github.io/)
0 commit comments