Skip to content

OpenJarbas/padacioso

dev
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Padacioso

A lightweight, dead-simple intent parser

Built on top of simplematch, inspired by Padaos

Example

from padacioso import IntentContainer

container = IntentContainer()

## samples
container.add_intent('hello', ['hello', 'hi', 'how are you', "what's up"])

## "optionally" syntax
container.add_intent('hello world', ["hello [world]"])

## "one_of" syntax
container.add_intent('greeting', ["(hi|hey|hello)"])

## entity extraction
container.add_intent('buy', [
    'buy {item}', 'purchase {item}', 'get {item}', 'get {item} for me'
])
container.add_intent('search', [
    'search for {query} on {engine}', 'using {engine} (search|look) for {query}',
    'find {query} (with|using) {engine}'
])
container.add_entity('engine', ['abc', 'xyz'])
container.calc_intent('find cats using xyz')
# {'conf': 1.0, 'name': 'search', 'entities': {'query': 'cats', 'engine': 'xyz'}}

## wildcards syntax
container.add_intent('say', ["say *"])
container.calc_intent('say something, whatever')
# {'conf': 0.85, 'entities': {}, 'name': 'test'}

## typed entities syntax
container.add_intent('pick_number', ['* number {number:int}'])
container.calc_intent('i want number 3')
# {'conf': 0.85, 'entities': {'number': 3}, 'name': 'pick_number'})

About

dead simple regex based intent parser

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages