# Path: poetry/apps/corpus/scripts/settings.py
# MARKUPS_DUMP_RAW_PATH = os.path.join(BASE_DIR, "datasets", "corpus", "markup_dump.txt")


import os
from poetry.apps.corpus.scripts.settings import MARKUPS_DUMP_RAW_PATH
from rupo.files.writer import Writer, FileType
from rupo.api import Engine
# -*- coding: utf-8 -*-
# Автор: Гусев Илья
# Описание: Генерация, загрузка и сохранение разметок по текстам.




def get_paths(path: str, ext: str):
    """
    Получение всех файлов заданного типа по заданному пути.

    :param path: путь к файлу/папке.
    :param ext: требуемое расширение.
    """
    if os.path.isfile(path):
        if ext == os.path.splitext(path)[1]:
            yield path
    else:
        for root, folders, files in os.walk(path):
            for file in files:
                if ext == os.path.splitext(file)[1]:
                    yield os.path.join(root, file)
            for folder in folders:
                return get_paths(folder, ext)


def run(stress_model_path, g2p_model_path, grapheme_set, g2p_dict_path, aligner_dump_path, raw_stress_dict_path,
        stress_trie_path, zalyzniak_dict, ru_wiki_dict, cmu_dict):

# Path: poetry/apps/corpus/scripts/settings.py
# MARKUPS_DUMP_RAW_PATH = os.path.join(BASE_DIR, "datasets", "corpus", "markup_dump.txt")


# Path: poetry/apps/corpus/scripts/stihi.py
import os
from poetry.apps.corpus.scripts.settings import MARKUPS_DUMP_RAW_PATH
from rupo.files.writer import Writer, FileType
from rupo.api import Engine

# -*- coding: utf-8 -*-
# Автор: Гусев Илья
# Описание: Генерация, загрузка и сохранение разметок по текстам.




def get_paths(path: str, ext: str):
    """
    Получение всех файлов заданного типа по заданному пути.

    :param path: путь к файлу/папке.
    :param ext: требуемое расширение.
    """
    if os.path.isfile(path):
        if ext == os.path.splitext(path)[1]:
            yield path
    else:
        for root, folders, files in os.walk(path):
            for file in files:
                if ext == os.path.splitext(file)[1]:
                    yield os.path.join(root, file)
            for folder in folders:
                return get_paths(folder, ext)


def run(stress_model_path, g2p_model_path, grapheme_set, g2p_dict_path, aligner_dump_path, raw_stress_dict_path,
        stress_trie_path, zalyzniak_dict, ru_wiki_dict, cmu_dict):

    raw_writer = Writer(FileType.RAW, MARKUPS_DUMP_RAW_PATH)