A Python wrapper for the Deepgrap API https://www.deepgram.com/.
The wrapper is currently written for Python 2.7.xx
Install this package with pip
:
pip install deepgram
from deepgram import Deepgram
dg = Deepgram("API-KEY")
print dg.check_balance() # => { "balance": 12.99, "userID": "API-KEY" }
Returns the available balance for the user.
Return value:
{
"balance": 12.99,
"userID": "API-KEY"
}
Returns the status of an audio object on the server.
Params:
- obj (string): The content ID of the object
Return value:
{
"status": "done"
}
Uploads a remote audio file to the API.
Params:
- media_url (string): The URL of the remote audio file
- tags (list) -- optional: Tags to describe the audio file
Return value:
{
"contentID": "14xxxxx-xxxxx-xxxx-xxxx-xxxxxx"
}
Uploads a list of remote audio files to the API.
Params:
- media_list (list): A list of remote audio file URLs
Return value:
{
"contentID": [
"14xxxxx-xxxxx-xxxx-xxxx-xxxxxx",
"14xxxxx-xxxxx-xxxx-xxxx-xxxxxx"
]
}
Searches the specified object for the given term and returns the parts of it that contain any matches to the search term.
Params:
- obj (string): The content ID fo the object
- query (string): The query term
- kwargs (dict): Extra arguments to pass to the function. Include:
- Nmax (int): The maximum number of matches to return. Default: 10
- Pmin (float): The minimum probability that qualifies a match. Default: 0.55
- snippet (bool): Whether to return the transcript of a match. Default: True
- sort (string): The term to sort by. Default: "time"
Return value:
{
"snippet": [
"hello world"
],
"P": [
1.0
],
"startTime": [
1.11
],
"endTime": [
1.23
],
"N": [
0
]
}
Searches in all the uploaded audio objects with a given "tag" and "query term" and returns the contentIDs of any matches.
Params:
- query (string): The query term
- tag (string) -- optional: The tag to use for the search. Narrows down the objects to be searched.
Return value:
{
"contentID": [
"14xxxxx-xxxxx-xxxx-xxxx-xxxxxx"
],
"P": [
1.0
],
"N": [
0
]
}
Searched in all the uploaded audio objects with the given "tag" and "query term" and returns the parts of it that contain any matches to the search term.
Params:
- query (string): The query term
- kwargs (dict): Extra arguments to pass to the function. Include:
- tag (string): The tag to use for the search. Narrows down the objects to be searched.
- snippet (bool): Whether to return the transcript of a match. Default: True
- group_Nmax (int): The maximum number of objects to return. Default: 10
- object_Nmax (int): The maximum number of matches to return within the same object. Default: 10
- object_Pmin (float): The minimum probability that qualifies a match. Default: 0.55
- sort (string): The term to sort by. Default: "time"
Return value:
{
"object_result": [
{
"contentID": "14xxxxx-xxxxx-xxxx-xxxx-xxxxxx",
"N": [
0,
1
],
"snippet": [
"hello world",
"hello world again"
],
"P": [
1.0,
0.4827729100918347
],
"startTime": [
1.11,
10.82
],
"endTime": [
1.23,
11.086666666666666
]
}
]
}
Tags an audio object in the server with the specified tag.
Params:
- obj (string): The content ID of the object
- tag (string): The tag of the object
Return Value:
{
"result": "success"
}
Returns the tags that are associated with a specific audio object on the server.
Params:
- obj (string): The content ID of the object
Return value:
{
"contentID": "14xxxxx-xxxxx-xxxx-xxxx-xxxxxx",
"tags": [
"sample",
"mp3"
]
}
Returns the transcript of a specific audio object.
Params:
- obj (string): The content ID of the object
Return value:
{
"contentID": "14xxxxx-xxxxx-xxxx-xxxx-xxxxxx",
"paragraphs": [
"this is a simple hello world transcript."
],
"paragraphStartTimes": [
0.67
]
}
Fork the repository, make necessary changes, run tests and submit a pull request. 💪
Before running tests, install the necessary requirements with:
pip install -r requirements_tests.txt
Run tests with nosetests
command.
To submit any issues, raise an issue through the Issues Page