def read_chunk(file: BinaryIO) -> 'ExplicitVocab': length, ngram_length, min_n, max_n = _read_required_binary( file, "<QQII") words = _read_items(file, length) ngram_list, ngram_index = _read_items_with_indices(file, ngram_length) indexer = ExplicitIndexer(ngram_list, min_n, max_n, ngram_index) return ExplicitVocab(words, indexer)
def read_chunk(file: BinaryIO) -> 'FastTextVocab': length, min_n, max_n, buckets = _read_required_binary(file, "<QIII") words = _read_items(file, length) indexer = FastTextIndexer(buckets, min_n, max_n) return FastTextVocab(words, indexer)
def read_chunk(file: BinaryIO) -> 'SimpleVocab': length = _read_required_binary(file, "<Q")[0] words = _read_items(file, length) return SimpleVocab(words)