Forced-Alignment-and-Vowel-Extraction/new-fave

View on GitHub
src/new_fave/utils/fasttrack_config.py

Summary

Maintainability
A
0 mins
Test Coverage
import yaml
from pathlib import Path
from fasttrackpy import Smoother


def read_fasttrack(config = str|Path)->dict:
    if type(config) is str:
        config = Path(config)
    
    with config.open('r') as c:
        config_dict = yaml.safe_load(c)
    
    smoother = Smoother()
    if "smoother" in config_dict:
        smoother = Smoother(**config_dict["smoother"])
    
    config_dict["smoother"] = smoother

    return config_dict