Skip to content

Commit 78cbf24

Browse files
committed
added tone analyzer and tradeoff analytics to readme because of merge conflicts
1 parent 34096bd commit 78cbf24

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Use this SDK to build Watson-powered applications in Unity. It comes with a set
1414
* [Language Translation](#language-translation)
1515
* [Dialog](#dialog)
1616
* [Natural Language Classifier](#natural-language-classifier)
17+
* [Tone Analyzer](#tone-analyzer)
18+
* [Tradeoff Analytics](#tradeoff-analytics)
1719
* [Visual Recognition](#visual-recognition)
1820
* [Developing a basic application in one minute](#developing-a-basic-application-in-one-minute)
1921
* [Documentation](#documentation)
@@ -211,6 +213,120 @@ You can use the Natural Language Classifier Editor to import and export classifi
211213
2. In the **Name** field, specify a name for the classifier.
212214
3. Click **Create**.
213215

216+
### Tone Analyzer
217+
The [Tone Analyzer][tone_analyzer] service detects emotions, social tendencies and writing style from text input.
218+
219+
```
220+
ToneAnalyzer m_ToneAnalyzer = new ToneAnalyzer();
221+
string m_StringToTestTone = "This service enables people to discover and understand, and revise the impact of tone in their content. It uses linguistic analysis to detect and interpret emotional, social, and language cues found in text.";
222+
223+
void Start () {
224+
m_ToneAnalyzer.GetToneAnalyze( OnGetToneAnalyze, m_StringToTestTone, "TEST");
225+
}
226+
227+
private void OnGetToneAnalyze( ToneAnalyzerResponse resp , string data)
228+
{
229+
Debug.Log("Response: " +resp + " - " + data);
230+
}
231+
```
232+
233+
### Tradeoff Analytics
234+
The [Tradeoff Analytics][tradeoff_analytics] service helps people make better decisions when faced with multiple, sometimes conflicting, goals and alternatives.
235+
236+
```
237+
void Start () {
238+
Problem problemToSolve = new Problem();
239+
problemToSolve.subject = "Test Subject";
240+
241+
List<Column> listColumn = new List<Column>();
242+
Column columnPrice = new Column();
243+
columnPrice.description = "Price Column to minimize";
244+
columnPrice.range = new ValueRange();
245+
((ValueRange)columnPrice.range).high = 600;
246+
((ValueRange)columnPrice.range).low = 0;
247+
columnPrice.type = "numeric";
248+
columnPrice.key = "price";
249+
columnPrice.full_name = "Price";
250+
columnPrice.goal = "min";
251+
columnPrice.is_objective = true;
252+
columnPrice.format = "$####0.00";
253+
254+
Column columnWeight = new Column();
255+
columnWeight.description = "Weight Column to minimize";
256+
columnWeight.type = "numeric";
257+
columnWeight.key = "weight";
258+
columnWeight.full_name = "Weight";
259+
columnWeight.goal = "min";
260+
columnWeight.is_objective = true;
261+
columnWeight.format = "####0 g";
262+
263+
Column columnBrandName = new Column();
264+
columnBrandName.description = "All Brand Names";
265+
columnBrandName.type = "categorical";
266+
columnBrandName.key = "brand";
267+
columnBrandName.full_name = "Brand";
268+
columnBrandName.goal = "max";
269+
columnBrandName.is_objective = true;
270+
columnBrandName.preference = new string[]{"Samsung", "Apple", "HTC"};
271+
columnBrandName.range = new CategoricalRange();
272+
((CategoricalRange)columnBrandName.range).keys = new string[]{"Samsung", "Apple", "HTC"};
273+
274+
listColumn.Add(columnPrice);
275+
listColumn.Add(columnWeight);
276+
277+
problemToSolve.columns = listColumn.ToArray();
278+
279+
280+
List<Option> listOption = new List<Option>();
281+
282+
Option option1 = new Option();
283+
option1.key = "1";
284+
option1.name = "Samsung Galaxy S4";
285+
option1.values = new TestDataValue();
286+
(option1.values as TestDataValue).weight = 130;
287+
(option1.values as TestDataValue).brand = "Samsung";
288+
(option1.values as TestDataValue).price = 249;
289+
listOption.Add(option1);
290+
291+
Option option2 = new Option();
292+
option2.key = "2";
293+
option2.name = "Apple iPhone 5";
294+
option2.values = new TestDataValue();
295+
(option2.values as TestDataValue).weight = 112;
296+
(option2.values as TestDataValue).brand = "Apple";
297+
(option2.values as TestDataValue).price = 599;
298+
listOption.Add(option2);
299+
300+
Option option3 = new Option();
301+
option3.key = "3";
302+
option3.name = "HTC One";
303+
option3.values = new TestDataValue();
304+
(option3.values as TestDataValue).weight = 143;
305+
(option3.values as TestDataValue).brand = "HTC";
306+
(option3.values as TestDataValue).price = 299;
307+
listOption.Add(option3);
308+
309+
problemToSolve.options = listOption.ToArray();
310+
311+
m_TradeoffAnalytics.GetDilemma( OnGetDilemma, problemToSolve, false );
312+
}
313+
314+
private void OnGetDilemma( DilemmasResponse resp )
315+
{
316+
Debug.Log("Response: " + resp);
317+
}
318+
319+
/// <summary>
320+
/// Application data value.
321+
/// </summary>
322+
public class TestDataValue : IBM.Watson.DeveloperCloud.Services.TradeoffAnalytics.v1.ApplicationDataValue
323+
{
324+
public double price { get; set; }
325+
public double weight { get; set; }
326+
public string brand { get; set; }
327+
}
328+
```
329+
214330
### Visual Recognition
215331
Use the [Visual Recognition][visual_recognition] service to classify an image against a default or custom trained classifier. In addition, the service can detect faces and text in an image.
216332

@@ -618,4 +734,5 @@ See [CONTRIBUTING.md](.github/CONTRIBUTING.md).
618734
[sentiment_analysis]: http://www.alchemyapi.com/products/alchemylanguage/sentiment-analysis
619735
[tone_analyzer]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/tone-analyzer/
620736
[tradeoff_analytics]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/tradeoff-analytics/
737+
[conversation]:http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/dialog/api/v1/
621738
[visual_recognition]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/visual-recognition/api/v3/

0 commit comments

Comments
 (0)