wongc7 / ontosem

OntoSem TMR and Intermediate Results Visualizer
0 stars 0 forks source link

attrVal displays as "[object Object]" #9

Closed wongc7 closed 7 years ago

wongc7 commented 7 years ago

Currently the TMR Viewer doesn't display the contents of OrderedDicts, and simply outputs them as [object Object]. This may also be the case with other data types as well.

Example TMR:

[{'results': [{'TMR': {'ANY-NUMBER-1': {'VALUE': ',',
                                       'concept': 'ANY-NUMBER',
                                       'from-sense': 'CD-NUM',
                                       'is-in-subtree': 'OBJECT',
                                       'lex-source': 'NER',
                                       'preference': 3,
                                       'sent-word-ind': [0, [6]],
                                       'token': ','},
                      'EVENT-1': {'AGENT': 'HUMAN-2',
                                  'CONTRAST-OF': 'SIGN-EVENT-1',
                                  'SCOPE-OF': 'MODALITY-1',
                                  'TIME': ['<', 'FIND-ANCHOR-TIME'],
                                  'concept': 'EVENT',
                                  'from-sense': 'DO-V1',
                                  'is-in-subtree': 'EVENT',
                                  'preference': -3,
                                  'sent-word-ind': [0, [9]],
                                  'token': 'did'},
                      'HUMAN-1': {'AGENT-OF': 'SIGN-EVENT-1',
                                  'HAS-PERSONAL-NAME': 'KONY',
                                  'concept': 'HUMAN',
                                  'from-sense': 'PERSON-NAME',
                                  'is-in-subtree': 'OBJECT',
                                  'lex-source': 'NER',
                                  'preference': 3,
                                  'sent-word-ind': [0, [0]],
                                  'token': 'Kony'},
                      'HUMAN-2': {'AGENT-OF': 'EVENT-1',
                                  'GENDER': 'MALE',
                                  'concept': 'HUMAN',
                                  'from-sense': 'HE-N1',
                                  'is-in-subtree': 'OBJECT',
                                  'preference': 1,
                                  'sent-word-ind': [0, [8]],
                                  'token': 'he'},
                      'MODALITY-1': {'SCOPE': 'EVENT-1',
                                     'TYPE': 'EPISTEMIC',
                                     'VALUE': 0,
                                     'concept': 'MODALITY',
                                     'from-sense': 'NOT-ADV1',
                                     'sent-word-ind': [0, [10]],
                                     'token': "n't"},
                      'SET-1': {'COMPLETE': 'YES',
                                'ELEMENTS': OrderedDict([('SATURDAY', 'SUNDAY')]),
                                'SATURDAY': 'SUNDAY',
                                'THEME-OF': 'SIGN-EVENT-1',
                                'concept': 'SET',
                                'from-sense': 'WEEKEND-N1',
                                'is-in-subtree': 'PROPERTY',
                                'preference': 1,
                                'sent-word-ind': [0, [5]],
                                'token': 'weekend'},
                      'SIGN-EVENT-1': {'AGENT': 'HUMAN-1',
                                       'CONTRAST': 'EVENT-1',
                                       'THEME': 'SET-1',
                                       'TIME': ['<', 'FIND-ANCHOR-TIME'],
                                       'concept': 'SIGN-EVENT',
                                       'from-sense': 'SIGN-V1',
                                       'is-in-subtree': 'EVENT',
                                       'preference': 1,
                                       'sent-word-ind': [0, [3, 7]],
                                       'token': 'signed'},
                      'total_preference': 6},
              'concept_counts': {'ANY-NUMBER': {'count': 1, 'word-info': [[6, 'top']]},
                                 'EVENT': {'count': 1, 'word-info': [[9, 'top']]},
                                 'HUMAN': {'count': 2, 'word-info': [[0, 'top'], [8, 'top']]},
                                 'MODALITY': {'count': 1, 'word-info': [[10, 'top']]},
                                 'SET': {'count': 1, 'word-info': [[5, 'top']]},
                                 'SIGN-EVENT': {'count': 1, 'word-info': [[3, 'top']]}},
              'words': {0: 'PERSON-NAME',
                        3: 'SIGN-V1',
                        5: 'WEEKEND-N1',
                        6: 'CD-NUM',
                        7: 'BUT-CONJ1',
                        8: 'HE-N1',
                        9: 'DO-V1',
                        10: 'NOT-ADV1'}}],
 'sent-num': 0,
 'sentence': "Kony should have signed this weekend , but he did n't .",
 'timestamp': '2017-Jan-05 15:18:21'}]

SET-1 does such for attribute ELEMENTS.