aboutsummaryrefslogtreecommitdiffstats
path: root/snips_inference_agl/dataset/yaml_wrapper.py
diff options
context:
space:
mode:
Diffstat (limited to 'snips_inference_agl/dataset/yaml_wrapper.py')
-rw-r--r--snips_inference_agl/dataset/yaml_wrapper.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/snips_inference_agl/dataset/yaml_wrapper.py b/snips_inference_agl/dataset/yaml_wrapper.py
new file mode 100644
index 0000000..ba8390d
--- /dev/null
+++ b/snips_inference_agl/dataset/yaml_wrapper.py
@@ -0,0 +1,11 @@
+import yaml
+
+
+def _construct_yaml_str(self, node):
+ # Override the default string handling function
+ # to always return unicode objects
+ return self.construct_scalar(node)
+
+
+yaml.Loader.add_constructor("tag:yaml.org,2002:str", _construct_yaml_str)
+yaml.SafeLoader.add_constructor("tag:yaml.org,2002:str", _construct_yaml_str)