    def test_from_instances_exclusive_embeddings_file_inside_archive(self):
        """Just for ensuring there are no problems when reading pretrained tokens from an archive"""
        # Read embeddings file from archive
        archive_path = str(self.TEST_DIR / "embeddings-archive.zip")

        with zipfile.ZipFile(archive_path, "w") as archive:
            file_path = "embedding.3d.vec"
            with archive.open(file_path, "w") as embeddings_file:
                embeddings_file.write("a 1.0 2.3 -1.0\n".encode("utf-8"))
                embeddings_file.write("b 0.1 0.4 -4.0\n".encode("utf-8"))

            with archive.open("dummy.vec", "w") as dummy_file:
                dummy_file.write("c 1.0 2.3 -1.0 3.0\n".encode("utf-8"))

        embeddings_file_uri = format_embeddings_file_uri(archive_path, file_path)
        vocab = Vocabulary.from_instances(
            self.dataset,
            min_count={"tokens": 4},
            pretrained_files={"tokens": embeddings_file_uri},
            only_include_pretrained_words=True,
        )

        words = set(vocab.get_index_to_token_vocabulary().values())
        assert "a" in words
        assert "b" not in words
        assert "c" not in words

        vocab = Vocabulary.from_instances(
            self.dataset,
            pretrained_files={"tokens": embeddings_file_uri},
            only_include_pretrained_words=True,
        )
        words = set(vocab.get_index_to_token_vocabulary().values())
        assert "a" in words
        assert "b" in words
        assert "c" not in words
Just for ensuring there are no problems when reading pretrained tokens from an archive
tests/data/vocabulary_test.py