def _load_assets(self, path): vocab_tags = load_vocab(path + "/tags.txt") vocab_chars = load_vocab(path + "/chars.txt") vocab_words = load_vocab(path + "/words.txt") self.proc_fn = get_processing_word(vocab_words, vocab_chars, lowercase=True, chars=True) self.id_to_tag = {idx: v for v, idx in vocab_tags.items()} self.n_words = len(vocab_words) self.n_char = len(vocab_chars) n_tags = len(vocab_tags) self.pad_tag = n_tags self.n_labels = n_tags + 1
def _load_assets(self, path): vocab_tags = load_vocab(path + "/tags.txt") vocab_chars = load_vocab(path + "/chars.txt") vocab_words = load_vocab(path + "/words.txt") self.proc_fn = get_processing_word(vocab_words, vocab_chars, lowercase=True, chars=True) # Adding outside tag to the padding number self.id_to_tag = {idx: v for v, idx in vocab_tags.items()} dict_vocal_tags_len = len(vocab_tags) self.id_to_tag.update({dict_vocal_tags_len: 'O'}) self.n_words = len(vocab_words) self.n_char = len(vocab_chars) n_tags = len(vocab_tags) self.pad_tag = n_tags # print('padding tags.....', self.pad_tag) self.n_labels = n_tags + 1