https://github.com/mlehman/nlp-intent-toolkit
Intent recognition with OpenNLP
https://github.com/mlehman/nlp-intent-toolkit
intent-classification opennlp
Last synced: 5 months ago
JSON representation
Intent recognition with OpenNLP
- Host: GitHub
- URL: https://github.com/mlehman/nlp-intent-toolkit
- Owner: mlehman
- License: unlicense
- Created: 2014-02-22T22:17:47.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-06-24T19:01:45.000Z (over 7 years ago)
- Last Synced: 2024-08-05T08:09:47.936Z (about 1 year ago)
- Topics: intent-classification, opennlp
- Language: Java
- Size: 433 KB
- Stars: 153
- Watchers: 15
- Forks: 51
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
nlp-intent-toolkit
==================Recognizing intents with slots using OpenNLP for applications (such as bots using chat, IM, speech-to-text) to convert natural language into structured commands with arguments.
```
> What's the current stock price of General Motors?
{ action: 'stock-price', args: { company: 'General Motors' } }
```The example system uses [document categorization](https://opennlp.apache.org/documentation/1.5.3/manual/opennlp.html#tools.doccat) to determine the intent (command) and [entity recognition](https://opennlp.apache.org/documentation/1.5.3/manual/opennlp.html#tools.namefind) to determine the slots (arguments) of the natural language text input.
The training system uses a directory containing separate files for each possible action, in this case the actions in a fictitious weather application:
```
- example/weather/train
- current-weather.txt - get the current weather
- hourly-forecast.txt - get the hourly forcast
- five-day-forecast.txt - get a five day forecast
```Each training file contains one example per line with any possible arguments surrounded by mark up to indicate the name of the parameter:
```
file: five-day-forecast.txt
...
how does the weather look for this Thursday in Boston ?
is it going to snow this week in Chicago
show me the forecast for Denver
...```
## Running the Example
The training systems is run passing in the training file directory and any parameter name used in the training files.
```
$ mvn clean compile exec:java -Dexec.args="example/weather/train city"
...
Training complete. Ready.>show me the weather for chicago
{ action: 'current-weather', args: { city: 'chicago' } }>will it rain tonight?
{ action: 'hourly-forecast', args: { } }>how does it look in seattle
{ action: 'hourly-forecast', args: { city: 'seattle' } }>what are the conditions in new york?
{ action: 'current-weather', args: { city: 'new york' } }>how does this weekend look in boston
{ action: 'five-day-forecast', args: { city: 'boston' } }>give me the five day forecast
{ action: 'five-day-forecast', args: { } }
```## Copyright and License
The source code provided by this repository is free and unencumbered to be copied or modified for any purpose, commercial or non-commercial.
The full license text is provided in the LICENSE file accompanying this repository.