def get_base_types(directory): project_conf = ProjectConfiguration(directory) keymap = project_conf.get_kb_shortcuts() hotkey_by_type = dict((v, k) for k, v in keymap.iteritems()) # fill config for nodes for which annotation is configured # calculate once only (this can get heavy) all_connections = project_conf.all_connections() event_hierarchy = project_conf.get_event_type_hierarchy() event_types = _fill_type_configuration(event_hierarchy, project_conf, hotkey_by_type, all_connections) entity_hierarchy = project_conf.get_entity_type_hierarchy() entity_types = _fill_type_configuration(entity_hierarchy, project_conf, hotkey_by_type, all_connections) relation_hierarchy = project_conf.get_relation_type_hierarchy() relation_types = _fill_relation_configuration(relation_hierarchy, project_conf, hotkey_by_type) # make visual config available also for nodes for which there is # no annotation config. Note that defaults (SPAN_DEFAULT etc.) # are included via get_drawing_types() if defined. unconfigured = [ l for l in (project_conf.get_labels().keys() + project_conf.get_drawing_types()) if not project_conf.is_configured_type(l) ] unconf_types = _fill_visual_configuration(unconfigured, project_conf) return event_types, entity_types, relation_types, unconf_types
def get_base_types(directory): project_conf = ProjectConfiguration(directory) keymap = project_conf.get_kb_shortcuts() hotkey_by_type = dict((v, k) for k, v in keymap.iteritems()) # fill config for nodes for which annotation is configured # calculate once only (this can get heavy) all_connections = project_conf.all_connections() event_hierarchy = project_conf.get_event_type_hierarchy() event_types = _fill_type_configuration(event_hierarchy, project_conf, hotkey_by_type, all_connections) entity_hierarchy = project_conf.get_entity_type_hierarchy() entity_types = _fill_type_configuration(entity_hierarchy, project_conf, hotkey_by_type, all_connections) relation_hierarchy = project_conf.get_relation_type_hierarchy() relation_types = _fill_relation_configuration(relation_hierarchy, project_conf, hotkey_by_type) # make visual config available also for nodes for which there is # no annotation config. Note that defaults (SPAN_DEFAULT etc.) # are included via get_drawing_types() if defined. unconfigured = [l for l in (project_conf.get_labels().keys() + project_conf.get_drawing_types()) if not project_conf.is_configured_type(l)] unconf_types = _fill_visual_configuration(unconfigured, project_conf) return event_types, entity_types, relation_types, unconf_types
def get_span_types(directory): project_conf = ProjectConfiguration(directory) keymap = project_conf.get_kb_shortcuts() hotkey_by_type = dict((v, k) for k, v in keymap.iteritems()) # fill config for nodes for which annotation is configured event_hierarchy = project_conf.get_event_type_hierarchy() event_types = _fill_type_configuration(event_hierarchy, project_conf, hotkey_by_type) entity_hierarchy = project_conf.get_entity_type_hierarchy() entity_types = _fill_type_configuration(entity_hierarchy, project_conf, hotkey_by_type) attribute_hierarchy = project_conf.get_attribute_type_hierarchy() attribute_types = _fill_attribute_configuration(attribute_hierarchy, project_conf) relation_hierarchy = project_conf.get_relation_type_hierarchy() relation_types = _fill_relation_configuration(relation_hierarchy, project_conf, hotkey_by_type) # make visual config available also for nodes for which there is # no annotation config ... unconfigured = [ l for l in project_conf.get_labels() if not project_conf.is_configured_type(l) ] # ... and include the defaults. unconfigured += [VISUAL_SPAN_DEFAULT, VISUAL_ARC_DEFAULT] unconf_types = _fill_visual_configuration(unconfigured, project_conf) return event_types, entity_types, attribute_types, relation_types, unconf_types
def get_span_types(directory): project_conf = ProjectConfiguration(directory) keymap = project_conf.get_kb_shortcuts() hotkey_by_type = dict((v, k) for k, v in keymap.iteritems()) # fill config for nodes for which annotation is configured event_hierarchy = project_conf.get_event_type_hierarchy() event_types = _fill_type_configuration(event_hierarchy, project_conf, hotkey_by_type) entity_hierarchy = project_conf.get_entity_type_hierarchy() entity_types = _fill_type_configuration(entity_hierarchy, project_conf, hotkey_by_type) attribute_hierarchy = project_conf.get_attribute_type_hierarchy() attribute_types = _fill_attribute_configuration(attribute_hierarchy, project_conf) relation_hierarchy = project_conf.get_relation_type_hierarchy() relation_types = _fill_relation_configuration(relation_hierarchy, project_conf, hotkey_by_type) # make visual config available also for nodes for which there is # no annotation config ... unconfigured = [l for l in project_conf.get_labels() if not project_conf.is_configured_type(l)] # ... and include the defaults. unconfigured += [VISUAL_SPAN_DEFAULT, VISUAL_ARC_DEFAULT] unconf_types = _fill_visual_configuration(unconfigured, project_conf) return event_types, entity_types, attribute_types, relation_types, unconf_types
def get_attribute_types(directory): project_conf = ProjectConfiguration(directory) keymap = project_conf.get_kb_shortcuts() hotkey_by_type = dict((v, k) for k, v in keymap.iteritems()) entity_attribute_hierarchy = project_conf.get_entity_attribute_type_hierarchy() entity_attribute_types = _fill_attribute_configuration(entity_attribute_hierarchy, project_conf, hotkey_by_type) relation_attribute_hierarchy = project_conf.get_relation_attribute_type_hierarchy() relation_attribute_types = _fill_attribute_configuration(relation_attribute_hierarchy, project_conf, hotkey_by_type) event_attribute_hierarchy = project_conf.get_event_attribute_type_hierarchy() event_attribute_types = _fill_attribute_configuration(event_attribute_hierarchy, project_conf, hotkey_by_type) return entity_attribute_types, relation_attribute_types, event_attribute_types
def get_span_types(directory): project_conf = ProjectConfiguration(directory) keymap = project_conf.get_kb_shortcuts() hotkey_by_type = dict((v, k) for k, v in keymap.iteritems()) event_hierarchy = project_conf.get_event_type_hierarchy() event_types = _get_subtypes_for_type(event_hierarchy, project_conf, hotkey_by_type, directory) entity_hierarchy = project_conf.get_entity_type_hierarchy() entity_types = _get_subtypes_for_type(entity_hierarchy, project_conf, hotkey_by_type, directory) attribute_hierarchy = project_conf.get_attribute_type_hierarchy() attribute_types = _get_attribute_type_info(attribute_hierarchy, project_conf, directory) relation_hierarchy = project_conf.get_relation_type_hierarchy() relation_types = _get_subtypes_for_type(relation_hierarchy, project_conf, hotkey_by_type, directory) return event_types, entity_types, attribute_types, relation_types