Skip to content

feature - extend api #16

@JarbasAl

Description

@JarbasAl

extend engine to support features from Jurebes

# fuzzy matching
engine.enable_fuzzy()
engine.disable_fuzzy()

# temporarily disable a intent
engine.detach_intent("name")
engine.reatach_intent("name")

# force correct predictions
engine.exclude_keywords("name", ["laugh"])
engine.exclude_keywords("hello", ["laugh"])
print(engine.calc_intent("make me laugh"))
# IntentMatch(intent_name='joke', confidence=1.0, entities={})

# inject context
engine.set_context("joke", "joke_type", "chuck_norris")  # if a value is passed it will populate entities
print(engine.calc_intent("tell me a chuch norris joke")) 
# IntentMatch(intent_name='joke', confidence=0.9707841337857908, entities={'joke_type': 'chuck_norris'})

# require context
engine.require_context("joke", "joke_type")
engine.unrequire_context("joke", "joke_type")

# exclude intent matches based on context
engine.exclude_context("hello", "said_hello")
engine.set_context("hello", "said_hello")  # now wont predict hello intent

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions