new Detector(id, category, media, realTime, url, otherOptions)
Detector constructor function. It defines the common prototype
for future detectors.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Id of the detector. This id would be use in HTTP request. |
category |
string | Category of the detector. Values can be 'face', 'voice','body', 'physio' and 'others'. |
media |
Array | Types of media the service can handle. |
realTime |
boolean | Boolean indicating if the API works in realTime. |
url |
string | Url to which the request will be sent. |
otherOptions |
Object | Other options, such as API keys, and so on. |
- Source:
Methods
(static) addResults(results)
Add the raw results and the PAD-translated version to the results arrays.
Parameters:
Name | Type | Description |
---|---|---|
results |
Object | Results as they come from the 3rd party emotion detection service. |
- Source:
(static) applyStrategy(strategy) → {Array}
Apply aggregation strategy to array of triplets.
Parameters:
Name | Type | Description |
---|---|---|
strategy |
String | Name of the strategy which will be used to aggregate the PAD results. one triplet. |
- Source:
Returns:
Aggregated results.
- Type
- Array
(static) cleanResults()
Delete all the previous results.
- Source:
(static) extractEmotions(context, media, callback)
Send the media passed to the correspondent API.
Parameters:
Name | Type | Description |
---|---|---|
context |
Object | Context in which auxiliar functions will be called. Context will be 'this' most of the times. |
media |
string | Media to analyse. This media will be sent to the Detector's API. This string will be an absolute path/url pointing to where the media is stored. |
callback |
function | Callback used to auxiliar tasks, like measuring times. |
- Source:
(static) getResults(resultsType) → {Array}
Translated the raw results to the PAD format.
Parameters:
Name | Type | Description |
---|---|---|
resultsType |
string | String with the type of results requested, i.e., 'pad' or 'raw'. |
- Source:
Returns:
Results requested.
- Type
- Array
(async, static) initialize()
Auxiliar method to log in and perform other initialization tasks.
If you need to add new parameters to your Detector object, you can do it here.
- Source:
(static) translateToPAD(results) → {Object}
Translated the raw results to the PAD format.
Parameters:
Name | Type | Description |
---|---|---|
results |
Object | Results from the API that will be translated to the PAD space. |
- Source:
Returns:
Results expressed in the PAD space.
- Type
- Object