def detect_operation(self, statement: Statement):
    query_text = statement.text
    seg_word = statement.search_text.split(const.SEG_SEPARATOR)
    operation = {}
    phrase = []
    for op in self.operation_pattern.keys():
        for (pattern, slot_type, word, unit) in self.operation_pattern[op]:
            match = re.search(pattern, query_text)
            if match:
                operation['op'] = op
                operation['slot_type'] = slot_type
                words = match.groups()[0]
                for w in seg_word:
                    if (w in words):
                        phrase.append(w)
                operation['phrase'] = phrase
                operation['word'] = word
                operation['unit'] = unit
                return operation
    return operation
def detect_operation(self, statement: Statement):
    query_text = statement.text
    seg_word = statement.search_text.split(const.SEG_SEPARATOR)
    operation = {}
    phrase = []
    for op in self.operation_pattern.keys():
        for (pattern, slot_type, word, unit) in self.operation_pattern[op]:
            match = re.search(pattern, query_text)
            if match:
                operation['op'] = op
                operation['slot_type'] = slot_type
                words = match.groups()[0]
                for w in seg_word:
                    if (w in words):
                        phrase.append(w)
                operation['phrase'] = phrase
                operation['word'] = word
                operation['unit'] = unit
                return operation
    return operation