M1-Arborator-NaijaSUD/arborator/lib/database.py
def addFeatsMiscs2Tree(baseTree, featTree, miscOnly=False):
	"""
	Copies the the features and misc fields from featTree onto baseTree.
	If called with miscOnly, only copies misc.

	input: Tree, Tree, Boolean
	output: Tree
	"""

	changed = False

	featTree = featTree.get("tree")
	if not featTree:
		raise BaseException("Weird tree format")

	try:
		assert len(baseTree) == len(featTree)
	except AssertionError:
		# print(baseTree)
		# print("\n\n")
		# print(featTree)
		raise BaseException("Les arbres n'ont pas la même longueur")

	for i in range(1, len(baseTree)+1):
		for k in featTree[i]:
			if not miscOnly:
				if k in ["xpos", "lemma", "tag", "tag2", "t", "upos", "egov", "gov", "id"]:
					continue
				else:
					changed = True
					baseTree[i].update({k:featTree[i][k]})
			else:
				if k == "misc":
					changed = True
					baseTree[i].update({k:featTree[i][k]})
	# if not changed:
	# 	print("has not changed :(")
	return baseTree

	Copies the the features and misc fields from featTree onto baseTree.
	If called with miscOnly, only copies misc.

	input: Tree, Tree, Boolean
	output: Tree
	
Copies the the features and misc fields from featTree onto baseTree.
If called with miscOnly, only copies misc.


Copies the the features and misc fields from featTree onto baseTree . If called with miscOnly only copies misc .
def addFeatsMiscs2Tree(baseTree, featTree, miscOnly=False):
	changed = False
	featTree = featTree.get("tree")
	if not featTree:
		raise BaseException("Weird tree format")
	try:
		assert len(baseTree) == len(featTree)
	except AssertionError:
		raise BaseException("Les arbres n'ont pas la même longueur")
	for i in range(1, len(baseTree)+1):
		for k in featTree[i]:
			if not miscOnly:
				if k in ["xpos", "lemma", "tag", "tag2", "t", "upos", "egov", "gov", "id"]:
					continue
				else:
					changed = True
					baseTree[i].update({k:featTree[i][k]})
			else:
				if k == "misc":
					changed = True
					baseTree[i].update({k:featTree[i][k]})
	return baseTree
def addFeatsMiscs2Tree ( baseTree , featTree , miscOnly = False ) : changed = False featTree = featTree . get ( "tree" ) if not featTree : raise BaseException ( "Weird tree format" ) try : assert len ( baseTree ) == len ( featTree ) except AssertionError : raise BaseException ( "Les arbres n'ont pas la même longueur") for i in range ( 1 , len ( baseTree ) + 1 ) : for k in featTree [ i ] : if not miscOnly : if k in [ "xpos" , "lemma" , "tag" , "tag2" , "t" , "upos" , "egov" , "gov" , "id" ] : continue else : changed = True baseTree [ i ] . update ( { k : featTree [ i ] [ k ] } ) else : if k == "misc" : changed = True baseTree [ i ] . update ( { k : featTree [ i ] [ k ] } ) return baseTree
Copies the the features and misc fields from featTree onto baseTree.
Copies the the features and misc fields from featTree onto baseTree .
"""
	Copies the the features and misc fields from featTree onto baseTree.
	If called with miscOnly, only copies misc.

	input: Tree, Tree, Boolean
	output: Tree
	""" # print(baseTree) # print("\n\n") # print(featTree) # if not changed: # 	print("has not changed :(")
baseTree
featTree
miscOnly