Home

Awesome

Sounder API

This section is dedicated to the Sounder Library API, which is an abstraction of the Sounder Algorithm, To read the full paper explaining how Sounder works and can be incoporated in the project as well as where it can be used at, kindly refer here: Sounder Explained, PDF version

<hr> <a name="installation">

Installation

Installing Sounder library into your application is easy as pie with pip package manager, allowing you to do a simple command from your favorite command line as follows:

pip install sounder
<hr> <a name="instantiate">

Instantiate Class

The first and the foremost thing to do is to import the class like so.

from sounder import Sounder

And then simply instantiating the class.

sounder = Sounder([['facebook', 'notifications'], ['twitter', 'notifications']])

You can pass dataset as a positional argument(optional) to the Sounder constructor, or set it later down the line using set_module() method which returns self.

sounder.set_dataset([['facebook', 'notifications'], ['twitter', 'notifications']])

As you can already notice, in order to use search method, the dataset needs to be 2 dimensional list, containing string elements.

<hr> <a name="search">

Search Method

search(query, dataset=None, metaphone=False) method takes a positional argument(compulsory), a query which needs to be a list composed of string that needs to be searched through the dataset, like so.

sounder = Sounder([['facebook', 'notifications'], ['twitter', 'notifications'], ['note', 'something']])
index = sounder.search(['trackbook', 'notifs'])

search method always returns back the index which it found to be most probable to be identical for your given set of data. In this case index will equate to 0.

This method take other optional arguments as follows:

<hr> <a name="probability">

Probability Method

probability(query, dataset=None, metaphone=False, detailed=False, prediction=False) method takes again a single positional argument which is the query that needs to be compared with the dataset. (A list composed of strings.), like so.

sounder = Sounder([['facebook', 'notifications'], ['twitter', 'notifications'], ['note', 'something']])
chances = sounder.probability(['trackbook', 'notifs'])

probability method returns result depending on the optional parameters under given cases:

Two other arguments that can be set are :

Sounder basically internally map it into double dimensional list automatically, giving you the leverage to compare any two lists of words.

<hr> <a name="filter">

Filter Method

filter(query, reserved_sub_words=None) is basically a utility provided you to filter the stop words out of your string, for instance, "Hey Stephanie, what is the time right now?" would filter away ['hey', 'what', 'is', 'the'] since they don't hold higher meaning, leaving behind key_words like ['stephanie', 'time', 'right', 'now']

This method is just a utility to help you do the entire intent recognization from single library, but you're free to use any kind of system. It returns back a dictionary with keys such as sub_words and key_words, resonating to stop words found in the string and keywords found in it in a list form respectively.

<hr> <a name="practical-usage">

Practical Usage

This algorithm is the brain of Stephanie, an open-source platform built specifically for voice-controlled application as well as to automate daily tasks imitating much of an virtual assistant's work.