API(s) documentation of Peragro AT: Audio Information Retrieval System (AIRS)

Feed module

Feeder module

Takes extracted features from audio and feed it to the elasticsearch apis, which eventually creates and stores index of all extracted features.

class feed.Feeder[source]

Feeder class that provides helper functions to feed extracted features to the elasticsearch inorder to create indexes.

feed(jsonFile, cont_id, iname='audio_index', doc_type='audio')[source]

feed extracted features of an audio to elasticsearch for index creation

Input:
  • jsonFile: a json file of extracted features of an audio
  • cont_id : identity of the content
  • iname : index name for that group of content
  • doc_type: document type to be stored
output:
  • retVal: a boolean return value. true if data is indexed otherwise

    false.

feedAll(jsonDir, iname='audio_index', doc_type='audio')[source]

feed extracted features of all audio from all the files present in jsonDir to elasticsearch for index creation

Input:
  • jsonDir : directory path that contains all json files
  • iname : index name for that group of content
  • doc_type: document type to be stored
readContent(jsonFile)[source]

Converts json data to dictionary format

Input:
  • jsonFile: a json file containing extracted features of an audio
output:
  • content: features stored in dictionary format

Peragro module

A client that provides audio search

provides different api(s) for audio search, including text based and content based search.

class peragro.PeragroClient[source]

An audio search client

get_sound(id_)[source]

Get sound by its id

input:
-id: id of sound
output:
-sound: sound details if it exists otherwise None

Usage:

>>> id = "X2VFAB12GH"
>>> sound = c.get_sound(id)
set_index(index)[source]

set index for to lookup in elasticsearch

Input:
-index: an elasticsearch index

Get sound results based on text query. It also has support for field queries.

Usage:

>>> query = "tum hi ho"
>>> sounds = c.text_search(query)
>>> # OR field query
>>> query = "tags:'interscope' genre:'hip hop'"
>>> sounds = c.text_search(query)