def _get_event(self, event, find_str):
        """Get a concept referred from the event by the given string."""
        # Get the term with the given element id
        element = event.find(find_str)
        if element is None:
            return None
        element_id = element.attrib.get('id')
        element_term = self.tree.find("*[@id='%s']" % element_id)
        if element_term is None:
            return None
        time, location = self._extract_time_loc(element_term)

        # Now see if there is a modifier like assoc-with connected
        # to the main concept
        assoc_with = self._get_assoc_with(element_term)

        # Get the element's text and use it to construct a Concept
        element_text_element = element_term.find('text')
        if element_text_element is None:
            return None
        element_text = element_text_element.text
        element_db_refs = {'TEXT': element_text}
        element_name = sanitize_name(element_text)

        element_type_element = element_term.find('type')
        if element_type_element is not None:
            element_db_refs['CWMS'] = element_type_element.text
            # If there's an assoc-with, we tack it on as extra grounding
            if assoc_with is not None:
                element_db_refs['CWMS'] += ('|%s' % assoc_with)

        concept = Concept(element_name, db_refs=element_db_refs)
        if time or location:
            context = WorldContext(time=time, geo_location=location)
        else:
            context = None
        event_obj = Event(concept, context=context)
        return event_obj
def _get_event ( self , event , find_str ) : element = event . find ( find_str ) if element is None : return None element_id = element . attrib . get ( 'id' ) element_term = self . tree . find ( "*[@id='%s']" % element_id ) if element_term is None : return None time , location = self . _extract_time_loc ( element_term ) assoc_with = self . _get_assoc_with ( element_term ) element_text_element = element_term . find ( 'text' ) if element_text_element is None : return None element_text = element_text_element . text element_db_refs = { 'TEXT' : element_text } element_name = sanitize_name ( element_text ) element_type_element = element_term . find ( 'type' ) if element_type_element is not None : element_db_refs [ 'CWMS' ] = element_type_element . text if assoc_with is not None : element_db_refs [ 'CWMS' ] += ( '|%s' % assoc_with ) concept = Concept ( element_name , db_refs = element_db_refs ) if time or location : context = WorldContext ( time = time , geo_location = location ) else : context = None event_obj = Event ( concept , context = context ) return event_obj
Get a concept referred from the event by the given string.