Skip to content

Allow duckling to bind custom classes #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ltbringer opened this issue Apr 15, 2021 · 2 comments
Closed

Allow duckling to bind custom classes #21

ltbringer opened this issue Apr 15, 2021 · 2 comments
Assignees
Labels

Comments

@ltbringer
Copy link
Contributor

Duckling's default class associations work fine but there cases where we need to create a custom class.

A case is to extend an entity to have a special method that computes time values differently (or say can add one time-entity with another). Here this would require a modification of existing types, breaking the extensibility.

@ltbringer
Copy link
Contributor Author

ltbringer commented Apr 15, 2021

@ltbringer
Copy link
Contributor Author

A simple solution would be to expect users to create their own config that specifies modifications like:

dimension_entity_map = {
    "duration": {"value": CustomDurationEntity},
}

This can be passed to DucklingParser during instantiation, a dictionary merge can help drive the feature.

@ltbringer ltbringer self-assigned this Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant