@@ -26,6 +26,7 @@ public class ExamplePersonalityInsights : MonoBehaviour {
26
26
27
27
void Start ( )
28
28
{
29
+ LogSystem . InstallDefaultReactors ( ) ;
29
30
string dataPath = Application . dataPath + "/Watson/Examples/ServiceExamples/TestData/personalityInsights.json" ;
30
31
31
32
if ( ! m_personalityInsights . GetProfile ( OnGetProfile , dataPath , DataModels . ContentType . TEXT_PLAIN , DataModels . Language . ENGLISH ) )
@@ -34,6 +35,49 @@ void Start ()
34
35
35
36
private void OnGetProfile ( DataModels . Profile profile , string data )
36
37
{
37
- Log . Debug ( "ExamplePersonalityInsights" , profile . id ) ;
38
+ Log . Debug ( "ExamplePersonalityInsights" , "data: {0}" , data ) ;
39
+ if ( profile != null )
40
+ {
41
+ if ( ! string . IsNullOrEmpty ( profile . id ) )
42
+ Log . Debug ( "ExamplePersonalityInsights" , "id: {0}" , profile . id ) ;
43
+ if ( ! string . IsNullOrEmpty ( profile . source ) )
44
+ Log . Debug ( "ExamplePersonalityInsights" , "source: {0}" , profile . source ) ;
45
+ if ( ! string . IsNullOrEmpty ( profile . processed_lang ) )
46
+ Log . Debug ( "ExamplePersonalityInsights" , "proccessed_lang: {0}" , profile . processed_lang ) ;
47
+ if ( ! string . IsNullOrEmpty ( profile . word_count ) )
48
+ Log . Debug ( "ExamplePersonalityInsights" , "word_count: {0}" , profile . word_count ) ;
49
+ if ( ! string . IsNullOrEmpty ( profile . word_count_message ) )
50
+ Log . Debug ( "ExamplePersonalityInsights" , "word_count_message: {0}" , profile . word_count_message ) ;
51
+
52
+ if ( profile . tree != null )
53
+ {
54
+ LogTraitTree ( profile . tree ) ;
55
+ }
56
+ }
57
+ else
58
+ {
59
+ Log . Debug ( "ExamplePersonalityInsights" , "Failed to get profile!" ) ;
60
+ }
61
+ }
62
+
63
+ private void LogTraitTree ( DataModels . TraitTreeNode traitTreeNode )
64
+ {
65
+ if ( ! string . IsNullOrEmpty ( traitTreeNode . id ) )
66
+ Log . Debug ( "ExamplePersonalityInsights" , "id: {0}" , traitTreeNode . id ) ;
67
+ if ( ! string . IsNullOrEmpty ( traitTreeNode . name ) )
68
+ Log . Debug ( "ExamplePersonalityInsights" , "name: {0}" , traitTreeNode . name ) ;
69
+ if ( ! string . IsNullOrEmpty ( traitTreeNode . category ) )
70
+ Log . Debug ( "ExamplePersonalityInsights" , "category: {0}" , traitTreeNode . category ) ;
71
+ if ( ! string . IsNullOrEmpty ( traitTreeNode . percentage ) )
72
+ Log . Debug ( "ExamplePersonalityInsights" , "percentage: {0}" , traitTreeNode . percentage ) ;
73
+ if ( ! string . IsNullOrEmpty ( traitTreeNode . sampling_error ) )
74
+ Log . Debug ( "ExamplePersonalityInsights" , "sampling_error: {0}" , traitTreeNode . sampling_error ) ;
75
+ if ( ! string . IsNullOrEmpty ( traitTreeNode . raw_score ) )
76
+ Log . Debug ( "ExamplePersonalityInsights" , "raw_score: {0}" , traitTreeNode . raw_score ) ;
77
+ if ( ! string . IsNullOrEmpty ( traitTreeNode . raw_sampling_error ) )
78
+ Log . Debug ( "ExamplePersonalityInsights" , "raw_sampling_error: {0}" , traitTreeNode . raw_sampling_error ) ;
79
+ if ( traitTreeNode . children != null && traitTreeNode . children . Length > 0 )
80
+ foreach ( DataModels . TraitTreeNode childNode in traitTreeNode . children )
81
+ LogTraitTree ( childNode ) ;
38
82
}
39
83
}
0 commit comments