def sepdata(fname, gname, hname, pos_dictionary):
    vocab_dict = pos_dictionary['words2idx']
    tag_dict = pos_dictionary['labels2idx']
    char_dict = pos_dictionary['chars2idx']

    # of all sets
    dataset_words = []
    dataset_labels = []
    dataset_chars = []
    for f in [fname, gname, hname]:
        data = open(f, "rb").readlines()

        # of a whole set
        words_set = []
        tag_labels_set = []
        chars_set = []

        # of a whole sentence
        example_words = []
        example_tag_labels = []
        example_char = []
        count = 0
        for line in data:
            line = line.replace('\n', '').replace('\r', '')
            line = line.split("\t")

            if (not line[0].isdigit()) and (line != ['']):
                continue # this is the heading line

            # this means a example finishes
            if (line == ['', ''] or line == ['']) and (len(example_words) > 0):
                words_set.append(np.array(example_words, dtype = "int32"))
                tag_labels_set.append(np.array(example_tag_labels, dtype = "int32"))
                chars_set.append(np.array(example_char, dtype = "int32"))

                # restart a new example after one finishes
                example_words = []
                example_tag_labels = []
                example_char = []
                count += 1

            else:  # part of an example
                vocab = line[1]
                tag = line[3]
                if is_number(vocab):  # check if the term is a number
                    vocab = digits(len(vocab))
                if is_url(vocab):
                    vocab = "URL"
                if is_user(vocab):
                    vocab = "USR"

                example_words.append(vocab_dict[vocab])
                example_tag_labels.append(tag_dict[tag])
                char_word_list = map(lambda u: char_dict[u], list(vocab))
                example_char.append(char_word_list)
                example_char = format_chars(example_char)
                # for each example do a padding

        dataset_words.append(words_set)
        dataset_labels.append(tag_labels_set)
        dataset_chars.append(chars_set)

    train_pos= [dataset_words[0], dataset_chars[0], dataset_labels[0]]

    valid_pos = [dataset_words[1], dataset_chars[1], dataset_labels[1]]

    test_pos = [dataset_words[2], dataset_chars[2], dataset_labels[2]]

    assert len(dataset_words[0]+dataset_words[1]+dataset_words[2]) == len(train_pos[0]) + len(valid_pos[0]) + len(test_pos[0])

    return train_pos, valid_pos, test_pos