dialogy.types.entity.credit_card_number package¶
Module contents¶
Credit Card Number Entity¶
Provides the entity class for credit card numbers 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=["credit-card-number"],
...: locale="en_IN",
...: timezone="Asia/Kolkata",
...: )
...:
In [3]: duckling_plugin.parse("my credit card number is 4111111111111111.")
Out[3]: [CreditCardNumberEntity(body='4111111111111111', type='value', parsers=['DucklingPlugin'], score=1.0, alternative_index=0, alternative_indices=[0], latent=False, issuer='visa', value='4111111111111111', values=[{'value': '4111111111111111'}])]
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=["credit-card-number"],
...: locale="en_IN",
...: timezone="Asia/Kolkata",
...: )
...:
In [3]: workflow = Workflow([duckling_plugin])
In [4]: _, output = workflow.run(Input(utterances="my credit card number is 4111111111111111."))
In [5]: output
Out[5]:
{'intents': [],
'entities': [{'range': {'start': 25, 'end': 41},
'body': '4111111111111111',
'type': 'value',
'parsers': ['DucklingPlugin'],
'score': 1.0,
'alternative_index': 0,
'entity_type': 'credit-card-number',
'issuer': 'visa',
'value': '4111111111111111'}],
'original_intent': {}}
- class CreditCardNumberEntity(body, dim=None, parsers=NOTHING, score=None, alternative_index=None, alternative_indices=None, latent=False, *, range, type='value', entity_type='credit-card-number', issuer, value=None, values)[source]¶
Bases:
dialogy.types.entity.base_entity.BaseEntity
- entity_type: Optional[str]¶
- issuer: str¶
- value: Optional[str]¶
- values: List[Dict[str, Any]]¶