def __init__(self, input_file, pret_embeddings=None, min_occur_count=<NUM_LIT:2>):
super().__init__()<EOL>word_counter = Counter()<EOL>tag_set = set()<EOL>rel_set = set()<EOL>with open(input_file) as f:<EOL><INDENT>for line in f:<EOL><INDENT>info = line.strip().split()<EOL>if info:<EOL><INDENT>if len(info) == <NUM_LIT:10>:<EOL><INDENT>arc_offset = <NUM_LIT:6><EOL>rel_offset = <NUM_LIT:7><EOL><DEDENT>elif len(info) == <NUM_LIT:8>:<EOL><INDENT>arc_offset = <NUM_LIT:5><EOL>rel_offset = <NUM_LIT:6><EOL><DEDENT>word, tag, head, rel = info[<NUM_LIT:1>].lower(), info[<NUM_LIT:3>], int(info[arc_offset]), info[rel_offset]<EOL>word_counter[word] += <NUM_LIT:1><EOL>tag_set.add(tag)<EOL>if rel != '<STR_LIT:root>':<EOL><INDENT>rel_set.add(rel)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>self._id2word = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>self._id2tag = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>self._id2rel = ['<STR_LIT>', '<STR_LIT:root>']<EOL>reverse = lambda x: dict(list(zip(x, list(range(len(x))))))<EOL>for word, count in word_counter.most_common():<EOL><INDENT>if count > min_occur_count:<EOL><INDENT>self._id2word.append(word)<EOL><DEDENT><DEDENT>self._pret_embeddings = pret_embeddings<EOL>self._words_in_train_data = len(self._id2word)<EOL>if pret_embeddings:<EOL><INDENT>self._add_pret_words(pret_embeddings)<EOL><DEDENT>self._id2tag += list(tag_set)<EOL>self._id2rel += list(rel_set)<EOL>self._word2id = reverse(self._id2word)<EOL>self._tag2id = reverse(self._id2tag)<EOL>self._rel2id = reverse(self._id2rel)<EOL>
Vocabulary, holds word, tag and relation along with their id.
            Load from conll file
            Adopted from https://github.com/jcyk/Dynet-Biaffine-dependency-parser with some modifications

        Parameters
        ----------
        input_file : str
            conll file
        pret_embeddings : tuple
            (embedding_name, source), used for gluonnlp.embedding.create(embedding_name, source)
        min_occur_count : int
            threshold of word frequency, those words with smaller frequency will be replaced by UNK