本文整理匯總了Python中regparser.layer.key_terms.KeyTerms.process_node_text方法的典型用法代碼示例。如果您正苦於以下問題:Python KeyTerms.process_node_text方法的具體用法?Python KeyTerms.process_node_text怎麽用?Python KeyTerms.process_node_text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類regparser.layer.key_terms.KeyTerms
的用法示例。
在下文中一共展示了KeyTerms.process_node_text方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: process
# 需要導入模塊: from regparser.layer.key_terms import KeyTerms [as 別名]
# 或者: from regparser.layer.key_terms.KeyTerms import process_node_text [as 別名]
def process(self, node):
label = node.label_id()
if label in self.model_forms_nodes and self.model_forms_nodes[label]:
keyterm = KeyTerms.get_keyterm(node)
if keyterm:
end = '</E>'
node_text = node.text[
node.text.find(end) + len(end):].split(' ')
else:
node_text = KeyTerms.process_node_text(node).split(' ')
start_of_model_form = node_text[0]
end_of_model_form = node_text[-1]
if start_of_model_form and end_of_model_form:
list_of_ends = [w for w in node_text if w == end_of_model_form]
location_end = len(list_of_ends) - 1
layer_el = [{
'start_word': start_of_model_form,
'start_locations': [0],
'end_word': end_of_model_form,
'end_locations':[location_end]
}]
return layer_el