yaml_util
Author: Heli Qi Affiliation: NAIST Date: 2022.09
load_yaml(yaml_file)
Loads a YAML file and returns its content as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
yaml_file
|
str or IO
|
The path to the YAML file or a file-like object. |
required |
Returns:
Name | Type | Description |
---|---|---|
Dict |
Dict
|
The parsed YAML content as a dictionary. |
Raises:
Type | Description |
---|---|
AssertionError
|
If the input YAML file does not exist. |
Source code in speechain/utilbox/yaml_util.py
reform_config_dict(input_config)
Recursively reformat a configuration dictionary to convert rumel.yaml data types into normal Python data types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_config
|
Dict or List or ScalarFloat or PlainScalarString
|
The input configuration dictionary. |
required |
Returns:
Type | Description |
---|---|
Dict or List or float or str: The reformatted configuration dictionary with normal Python data types. |
Source code in speechain/utilbox/yaml_util.py
remove_representer(parent_node, reference, curr_key=None)
Recursively removes representers from a configuration dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_node
|
Dict or List
|
The parent node in the configuration dictionary. |
required |
reference
|
Dict
|
The reference dictionary for resolving references. |
required |
curr_key
|
str
|
The current key within the parent node. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
Dict or List or any: The updated configuration dictionary with removed representers. |
Source code in speechain/utilbox/yaml_util.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|