Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/macournoyer/utterance_parser
Extract intent and entities from natural language utterances
https://github.com/macournoyer/utterance_parser
extracts-intent nlp slot-filling
Last synced: 7 days ago
JSON representation
Extract intent and entities from natural language utterances
- Host: GitHub
- URL: https://github.com/macournoyer/utterance_parser
- Owner: macournoyer
- License: mit
- Created: 2016-05-04T18:05:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-04T08:09:40.000Z (almost 7 years ago)
- Last Synced: 2024-11-02T03:23:17.666Z (14 days ago)
- Topics: extracts-intent, nlp, slot-filling
- Language: Ruby
- Size: 9.77 KB
- Stars: 36
- Watchers: 7
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# UtteranceParser
A trainable natural language parser that extracts intent and entities from utterances.
It uses a [Naive Bayes classifier](https://en.wikipedia.org/wiki/Naive_Bayes_classifier) to determine intent and [Conditional random fields](https://en.wikipedia.org/wiki/Conditional_random_field) to extract entities.
For example, it can turn this:
> Remind me to pick up the kids in two hours
into ...
```ruby
[
# intent
"reminder",
# entities
{task: "pick up the kids", time: "in two hours"}
]
```## Installation
Add this line to your application's Gemfile:
gem 'utterance_parser'
And then execute:
$ bundle
Or install it yourself as:
$ gem install utterance_parser
## Usage
```ruby
parser = UtteranceParser.newparser.train(
# Utterance => intent
"Hi" => "greeting",
"Hello" => "greeting","What time is it" => "time",
"What's the weather outside" => "weather",# Mark entities using XML tags
"Remind me to get stuff done " => "reminder",
"Remind me to buy milk " => "reminder",
"Remind me to pick up the kids " => "reminder","Play some jazz" => "play",
"Play some blues" => "play",
"Play some rap" => "play"
)parser.parse "Hello there!"
# => ["greeting", {}]parser.parse "Play some rock"
# => ["play", {playlist: "rock"}]parser.parse "Remind me to buy stuff in three hours"
# => ["reminder", {task: "buy stuff", time: "in three hours"}]
```## Contributing
1. Fork it ( https://github.com/macournoyer/utterance_parser/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request