예제 #1
0
def tc2(node, start): #N->NP. alfa def
	v = start + "0"

	node_app = DRSnode()
	node_app.type = "app"
	node_var1 = DRSnode()
	node_var1.type = "var"
	node_var1.text = "v1"
	node_var2 = DRSnode()
	node_var2.type = "var"
	node_var2.text = v
	node_app.expression.append(node_var1)
	node_app.expression.append(node_var2)

	node_merge = DRSnode()
	node_merge.type = "alfa"
	node_merge.attrib = {"type": "def"}

	node_last, idx = modify_attrib(node, "v1", v)
	node.add_variable(v, True)
	
	node_merge.expression.append(node_last.expression[idx])
	node_merge.expression.append(node_app)
	node_last.expression[idx] = node_merge

	normal_variables(node)
	return node
예제 #2
0
def ftr(node):
    node_lam = DRSnode()
    node_lam.type = "lam"

    node_var = DRSnode()
    node_var.type = "var"
    node_var.text = "v0"
    node_lam.expression.append(node_var)

    node_app = DRSnode()
    node_app.type = "app"
    node_var = DRSnode()
    node_var.type = "var"
    node_var.text = "v0"
    node_app.expression.append(node_var)
    node_app.expression.append(node)

    node_lam.expression.append(node_app)

    normal_variables(node_lam)

    return node_lam