def BIO_tag(self, dialogue_acts, utterance, mode):
        """
        Compute Begin In Out tags for the given utterance

        :param dialogue_acts: the dialogue acts
        :param utterance: the utterance to compute tags for
        :param mode: system or user
        :return: intents and BIO tags
        """

        utterance = self.correct_synonyms(utterance)

        if mode == 'sys' or mode == 'system':
            acts_with_slots = {'inform', 'deny', 'confirm'}
        elif mode == 'usr' or mode == 'user':
            acts_with_slots = {'canthelp', 'select', 'canthelp.exception',
                               'impl-conf',
                               'offer', 'inform', 'expl-conf'}
        else:
            acts_with_slots = {'canthelp', 'select', 'canthelp.exception',
                               'impl-conf',
                               'offer', 'inform', 'expl-conf'}

        curr_intents = set()

        for act in dialogue_acts:
            curr_act = act['act']
            if curr_act == 'request':
                curr_act = '{}_{}'.format(curr_act, act['slots'][0][1])

            # Alex: Correction for 'dontcare'
            if curr_act == 'inform' and act['slots'][0][1] == 'dontcare':
                curr_act = 'dontcare_{}'.format(act['slots'][0][0])

            curr_intents.add(curr_act)

        firstword2split = {}
        split2tag = {}
        for act in dialogue_acts:
            curr_act = act['act']
            if curr_act in acts_with_slots and len(act['slots']) > 0:
                for curr_slot in act['slots']:
                    slot_name = curr_slot[0]
                    if isinstance(curr_slot[1], int):
                        curr_slot[1] = str(curr_slot[1])

                    # Special case for 'asian' and 'asian oriental' (there is
                    # no ambiguity in this case).
                    if curr_slot[
                        1] in ['asian oriental', 'australian asian'] and \
                            'asian' in utterance and \
                            'asian oriental' not in utterance and \
                            'australian asian' not in utterance:
                        curr_slot[1] = 'asian'

                    slot_value_split = curr_slot[1].split()

                    splits = \
                        firstword2split.get(slot_value_split[0].lower(), [])
                    splits.append(slot_value_split)
                    firstword2split[slot_value_split[0]] = splits

                    split2tag[tuple(slot_value_split)] = \
                        '{}-{}'.format(curr_act, slot_name)

        transcript_split = utterance.split()
        iob_tags = []
        len_transcript = len(transcript_split)
        i = 0
        while i < len_transcript:
            word = transcript_split[i].lower()

            if word in firstword2split:
                splits = firstword2split[word]

                for split in splits:

                    full_split_matches = True
                    for j in range(len(split)):
                        if i + j < len(transcript_split):
                            if split[j].lower() != \
                                    transcript_split[i + j].lower():
                                full_split_matches = False
                                break
                        else:
                            break

                    if full_split_matches:
                        tag = split2tag[tuple(split)]
                        for k in range(len(split)):
                            if k == 0:
                                iob_tags.append('{}-{}'.format('B', tag))
                            else:
                                iob_tags.append('{}-{}'.format('I', tag))

                        i += len(split)
                        break

                    else:
                        i += 1

            else:
                iob_tags.append('O')
                i += 1

        return curr_intents, iob_tags

        Compute Begin In Out tags for the given utterance

        :param dialogue_acts: the dialogue acts
        :param utterance: the utterance to compute tags for
        :param mode: system or user
        :return: intents and BIO tags
        
plato/utilities/parser/parse_dstc2.py