Exemplo n.º 1
0
    def test_enumerate_variations_all_db(self):
        gitdb = GitInterface(
            origin='https://github.com/plevyieml/ieml-language.git')
        gitdb.pull()
        db = IEMLDatabase(folder=gitdb.folder)

        usls = db.list(type=Word, parse=True) + db.list(
            type=PolyMorpheme, parse=True) + db.list(type=Lexeme, parse=True)
        for u in tqdm.tqdm(usls):
            dim, partitions = enumerate_partitions(u)
Exemplo n.º 2
0
    def test_expand_compose_into_paths(self):
        # parser = IEMLParser().parse
        gitdb = GitInterface(
            origin='https://github.com/plevyieml/ieml-language.git')
        gitdb.pull()
        db = IEMLDatabase(folder=gitdb.folder)

        usls = db.list(type=Word, parse=True) + db.list(
            type=PolyMorpheme, parse=True) + db.list(type=Lexeme, parse=True)
        for u in tqdm.tqdm(usls):
            p_u = list(u.iter_structure_path_by_script_ss())
            res = usl_from_path_values(p_u)
            self.assertEqual(str(u), str(res),
                             "expand_compose_into_paths failed on: " + str(u))
Exemplo n.º 3
0
WORDS_FILENAME = "resources/words_sample.json"
DICTIONARY_FILENAME = "resources/dictionary.json"

resource_dir = "resources"
if not os.path.isdir(resource_dir):
    os.mkdir(resource_dir)


def get_word_structure(w: Word):
    return get(
        "https://dev.intlekt.io/api/words/{}/?repository=IEMLdev".format(
            str(w))).json()


gitdb = GitInterface(origin="https://github.com/plevyieml/ieml-language")
gitdb.pull()  # download database in ~/.cache/ieml/ folder

# instanciate a ieml.ieml_database.IEMLDatabase from the downloaded git repository
db = IEMLDatabase(folder=gitdb.folder)

# usls = db.list(parse=True, type='word')
#
# parsed_usls = list()
# for e in tqdm(usls):
#     parsed_usls.append(get_word_structure(e))
#
# with bz2.open(WORDS_FILENAME + ".bz2", "wt") as fout:
#     json.dump(parsed_usls, fout, indent=2)

descriptors = db.get_descriptors()
Exemplo n.º 4
0
if __name__ == '__main__':

    folder = '/tmp/migrate_script_iemldb'
    if os.path.isdir(folder):
        shutil.rmtree(folder)

    git_address = "https://github.com/IEMLdev/ieml-language.git"

    credentials = pygit2.Keypair('git', '~/.ssh/id_rsa.pub', '~/.ssh/id_rsa',
                                 None)
    gitdb = GitInterface(origin=git_address,
                         credentials=credentials,
                         folder=folder)
    #
    gitdb.pull()

    signature = pygit2.Signature("Louis van Beurden",
                                 "*****@*****.**")

    db = IEMLDatabase(folder=folder, use_cache=False)

    desc = db.get_descriptors()
    struct = db.get_structure()

    to_migrate = {}
    to_remove = []

    parser = IEMLParser(dictionary=db.get_dictionary())

    all_db = db.list()