dialogy.types.entity.people package

Module contents

People Entity

Provides the entity class for representing number of people in natural language. This entity is obtained via DucklingPlugin.

Plugin Walkthrough

In [1]: from dialogy.plugins import DucklingPlugin

In [2]: duckling_plugin = DucklingPlugin(
   ...:     dest="output.entities",
   ...:     dimensions=["people"],
   ...:     locale="en_IN",
   ...:     timezone="Asia/Kolkata",
   ...: )
   ...: 

In [3]: duckling_plugin.parse("two kids")
Out[3]: []

Workflow Integration

In [1]: from dialogy.base import Input
   ...: from dialogy.plugins import DucklingPlugin
   ...: from dialogy.workflow import Workflow
   ...: 

In [2]: duckling_plugin = DucklingPlugin(
   ...:     dest="output.entities",
   ...:     dimensions=["people"],
   ...:     locale="en_IN",
   ...:     timezone="Asia/Kolkata",
   ...: )
   ...: 

In [3]: workflow = Workflow([duckling_plugin])

In [4]: _, output = workflow.run(Input(utterances="two kids"))

In [5]: output
Out[5]: {'intents': [], 'entities': [], 'original_intent': {}}
class PeopleEntity(body, dim=None, parsers=NOTHING, score=None, alternative_index=None, alternative_indices=None, latent=False, values=NOTHING, value=None, unit='', entity_type='people', *, range, type='value')[source]

Bases: dialogy.types.entity.base_entity.BaseEntity

A variant of numerical entity which addresses collections of people.

Example sentences that contain the entity are: - “N people”, where N is a whole number. - “A couple” ~ 2 people. - “I have triplets” ~ 3 children.

entity_type: Optional[str]
classmethod from_duckling(d, alternative_index, **kwargs)[source]
Return type

PeopleEntity