def split_multi_keywords(sentence, keyword): """ 如果关键词为一对(e.g. [因为, 所以]), 则调用此方法. 此方法列出各种关键词对对应的分句规则, 如果符合其一, 则返回该规则分句结果. 都不满足则返回None :param sentence: 输入句子 :param keyword: 关联词对 :return: """ # ..., ...因为, ..., ...所以, ... rst = pattern.rule_scskcscskcs(sentence, keyword, comma2=True, comma4=True) if rst: return [[rst['left'], rst['right']]] # ..., ...因为, ..., ...所以... rst = pattern.rule_scskcscskcs(sentence, keyword, comma2=True) if rst: return [[rst['left'], rst['right']]] # ..., ...因为..., ...所以, ... rst = pattern.rule_scskcscskcs(sentence, keyword, comma4=True) if rst: return [[rst['left'], rst['right']]] # ..., ...因为..., ...所以 ... rst = pattern.rule_scskcscskcs(sentence, keyword) if rst: return [[rst['left'], rst['right']]] # ...因为, ..., ...所以, ... rst = pattern.rule_skcscskcs(sentence, keyword, comma1=True, comma3=True) if rst: return [[rst['left'], rst['right']]] # ...因为 ..., ...所以, ... rst = pattern.rule_skcscskcs(sentence, keyword, comma3=True) if rst: return [[rst['left'], rst['right']]] # ...因为, ..., ...所以 ... rst = pattern.rule_skcscskcs(sentence, keyword, comma1=True) if rst: return [[rst['left'], rst['right']]] # ...因为 ..., ...所以... rst = pattern.rule_skcscskcs(sentence, keyword) if rst: return [[rst['left'], rst['right']]] # ...因为...所以... rst = pattern.rule_sksks(sentence, keyword) if rst: return [[rst['left'], rst['right']]] return None
def rule12(sentence, keyword): # 匹配模式: ...因为..., ...所以, ... return pattern.rule_skcscskcs(sentence, keyword, comma3=True)
def rule21(sentence, keyword): # 匹配模式: ...之所以..., ...是因为... return pattern.rule_skcscskcs(sentence, keyword, reverse=True)
def rule13(sentence, keyword): # 匹配模式: ...因为..., ...所以... return pattern.rule_skcscskcs(sentence, keyword)
def rule101(sentence, keyword): # 匹配模式: ...不仅..., ...还... return pattern.rule_skcscskcs(sentence, keyword)
def rule23(sentence, keyword): # 匹配模式: ...只有..., ...才能... return pattern.rule_skcscskcs(sentence, keyword)
def rule22(sentence, keyword): # 匹配模式: ...只有..., ...才能, ... return pattern.rule_skcscskcs(sentence, keyword, comma3=True)
def rule11(sentence, keyword): # 匹配模式: ...如果..., ...就... return pattern.rule_skcscskcs(sentence, keyword)