Skip to main content

A simple package for interfacing with Dialogflow

Project description

Affability

Affability allows for an easy utilization of Google's DialogFlow for natural language understanding. It allows for calling a single function and returning the result from Dialogflow as a class containing all the pertinent data such as detected intent. Communicating with Dialogflow through Affability trades-off features and customizability for simplicity and conciseness.

This can be utilized to understand commands and then perform the relevant tasks based from the detected intent. Affability is ultimately designed to make it easy to integrate DialogFlow in other standalone projects.

Dependencies

As of v1.0.1, affability automatically installs dialogflow. Should speech recognition be needed, the SpeechRecognition pakage needs to be installed.

pip install dialogflow

Installation

pip install affability

Usage

The module can be imported as affability:

import affability

Using the understand function:

The understand function contains 5 parameters: text, credentials, projectID, languageCode, and sessionID. Text is text to be analyzed, credentials is the file path of the authentication key, projectID is the project ID, languageCode is the language, and sessionID is the session ID. All parameters are strings.

affability.understand('textToBeAnalyzed', 'filepath', 'projectIDname', 'en-US', 'me')

The understand function returns the results as an organizer class. This class contains detectedIntent, confidence, reply, action, requiredParamsPresent, and replyParams.

class organizer:
    def __init__(self, detectedIntent, confidence, reply, action, requiredParamsPresent, replyParams):
        self.detectedIntent = detectedIntent
        self.confidence = confidence
        self.reply = reply
        self.action = action
        self.requiredParamsPresent = requiredParamsPresent
        self.replyParams = replyParams

For example, to extract and print detected intent:

reply = affability.understand('textToBeAnalyzed', 'filepath', 'projectIDname', 'en-US', 'me')
print(reply.detectedIntent)

Sample usage

The example_usage.py file demonstrates the ease of communicating with Dialogflow through Affability.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

affability-1.0.2.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

affability-1.0.2-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file affability-1.0.2.tar.gz.

File metadata

  • Download URL: affability-1.0.2.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for affability-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2c8218c47955e2810d6a6aa6eebfb6b725149849ef5c09b824bd68c15582ff9f
MD5 98dc489231f5e58b0923b913ca4d7910
BLAKE2b-256 7648460bbc47e7b08310ce1188877953a7b3e69132ea79dda91f6aba84f8e445

See more details on using hashes here.

File details

Details for the file affability-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: affability-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for affability-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 062802b399047ece7e1f2a225143767a3ba11b217233593ca9a0a371a94cacac
MD5 5f6df2aae8671c30ef87fe0a73bda7c7
BLAKE2b-256 9fb6ede335ee4aec3fc9430cdd2e6d945bfcd3a907b1241844b18791d8b98fd8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page