def add_and_switch_to_new_task(self, task_name, label_dictionary: Union[(List, Set, Dictionary, str)], label_type: str, multi_label: bool=True, force_switch: bool=False):
    "\n        Adds a new task to an existing TARS model. Sets necessary attributes and finally 'switches'\n        to the new task. Parameters are similar to the constructor except for model choice, batch\n        size and negative sampling. This method does not store the resultant model onto disk.\n        :param task_name: a string depicting the name of the task\n        :param label_dictionary: dictionary of the labels you want to predict\n        :param label_type: string to identify the label type ('ner', 'sentiment', etc.)\n        :param multi_label: whether this task is a multi-label prediction problem\n        :param force_switch: if True, will overwrite existing task with same name\n        "
    if ((task_name in self._task_specific_attributes) and (not force_switch)):
        log.warning('Task `%s` already exists in TARS model. Switching to it.', task_name)
    else:
        if isinstance(label_dictionary, Dictionary):
            label_dictionary = label_dictionary.get_items()
        if (type(label_dictionary) == str):
            label_dictionary = [label_dictionary]
        tag_dictionary = Dictionary(add_unk=False)
        for tag in label_dictionary:
            if ((tag == '<unk>') or (tag == 'O')):
                continue
            if (tag[1] == '-'):
                tag = tag[2:]
                tag_dictionary.add_item(tag)
            else:
                tag_dictionary.add_item(tag)
        self._task_specific_attributes[task_name] = {'label_dictionary': tag_dictionary, 'label_type': label_type, 'multi_label': multi_label}
    self.switch_to_task(task_name)
Adds a new task to an existing TARS model. Sets necessary attributes and finally 'switches'
to the new task. Parameters are similar to the constructor except for model choice, batch
size and negative sampling. This method does not store the resultant model onto disk.
:param task_name: a string depicting the name of the task
:param label_dictionary: dictionary of the labels you want to predict
:param label_type: string to identify the label type ('ner', 'sentiment', etc.)
:param multi_label: whether this task is a multi-label prediction problem
:param force_switch: if True, will overwrite existing task with same name
def add_and_switch_to_new_task(self, task_name, label_dictionary: Union[(List, Set, Dictionary, str)], label_type: str, multi_label: bool=True, force_switch: bool=False):
    "\n        Adds a new task to an existing TARS model. Sets necessary attributes and finally 'switches'\n        to the new task. Parameters are similar to the constructor except for model choice, batch\n        size and negative sampling. This method does not store the resultant model onto disk.\n        :param task_name: a string depicting the name of the task\n        :param label_dictionary: dictionary of the labels you want to predict\n        :param label_type: string to identify the label type ('ner', 'sentiment', etc.)\n        :param multi_label: whether this task is a multi-label prediction problem\n        :param force_switch: if True, will overwrite existing task with same name\n        "
    if ((task_name in self._task_specific_attributes) and (not force_switch)):
        log.warning('Task `%s` already exists in TARS model. Switching to it.', task_name)
    else:
        if isinstance(label_dictionary, Dictionary):
            label_dictionary = label_dictionary.get_items()
        if (type(label_dictionary) == str):
            label_dictionary = [label_dictionary]
        tag_dictionary = Dictionary(add_unk=False)
        for tag in label_dictionary:
            if ((tag == '<unk>') or (tag == 'O')):
                continue
            if (tag[1] == '-'):
                tag = tag[2:]
                tag_dictionary.add_item(tag)
            else:
                tag_dictionary.add_item(tag)
        self._task_specific_attributes[task_name] = {'label_dictionary': tag_dictionary, 'label_type': label_type, 'multi_label': multi_label}
    self.switch_to_task(task_name)