Auto generated documentation of Peragro AT: Audio Information Retrieval System (AIRS) code

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)

Test Feed module

Test Feeder module

Provides test methods for automated unit testing of Feeder module

class test_feed.TestFeeder(methodName='runTest')[source]

Test Feeder class for unittesting Feeder module

id_generator(size=10, chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')[source]

generate random token of given size

setUp()[source]

set up method for test fixture

This method runs before each test method. Basically, it setups the test environment

tearDown()[source]

set up tear down method for test fixture

This method runs after each test method and cleans the test environment created in setUp method

test_feed()[source]

tests feed method of Feeder object

test_readContent()[source]

tests readContent method of Feeder object

Test Peragro module

Test peragro module

provides test methods for automated unittesting of peragro module

class test_peragro.TestPeragroClient(methodName='runTest')[source]

unit test PeragroClient module

feed_data()[source]

helper method to feed data to elasticsearch

setUp()[source]

set up method for test fixture

This method runs before each test method. Basically, it setups the test environment

tearDown()[source]

setting up tear down method for test fixture

This method runs after each test method and cleans the test environment created in setUp method

test_get_sound()[source]

tests get_sound method of PeragroClient object

test_set_index()[source]

tests set_index method of PeragroClient object

tests text_search method of PeragroClient object