예제 #1
0
	def get_actor_and_actant (cls, root_node):
		idx = 0
		actor = None
		actant = None
		while idx < len (root_node.children):
			child = root_node.children[idx]
			if child.type == PropositionTreeNodeType.linkage:
				if child.linkage.name == LanguageHelper.translate ("who") or child.linkage.name == LanguageHelper.translate ("what"):
					parent = child
					child = child.children[0]
					if child.type == PropositionTreeNodeType.concept:
						if child.side == PropositionTreeNodeSide.left:
							actor = child
							if root_node.concept.subroot != True:
								ContextProvider.set_actor_node (actor)
						elif child.side == PropositionTreeNodeSide.right:
							actant = child
			if actor != None and actant != None:
				break
			idx += 1
		if actor == None:
			actor = ContextProvider.get_actor_node ()
		return actor, actant