def to_conll_iob(annotated_sentence):
	"""
	`annotated_sentence` = list of triplets [(w1, t1, iob1), ...]
	Transform a pseudo-IOB notation: O, PERSON, PERSON, O, O, LOCATION, O
	to proper IOB notation: O, B-PERSON, I-PERSON, O, O, B-LOCATION, O
	"""
	proper_iob_tokens = []
	for idx, annotated_token in enumerate(annotated_sentence):
		tag, word, ner = annotated_token
 
		if ner != 'O':
			if idx == 0:
				ner = "B-" + ner
			elif annotated_sentence[idx - 1][2] == ner:
				ner = "I-" + ner
			else:
				ner = "B-" + ner
		proper_iob_tokens.append((tag, word, ner))
	return proper_iob_tokens