def build_weights(train_test_vec, pweights, train_test):
	"""Builds a weight vector.

	Args:
		train_test_vec (list of boolean): Boolean value which indicates for each language whether it belongs to the train set (true) or the test set (false)
		pweights (list of float): (phylogenetic) weights for all languages in the train/test set.
		train_test (boolean): True if the weight vector is for the train set; False if it is for the test set.
	
	Returns:
		list of float: Weights for all languages.

	"""
	pweights_ = []
	j = 0
	for t in train_test_vec:
		if t == train_test:
			pweights_.append(pweights[j])
			j += 1
		else:
			pweights_.append(0)
	return pweights_