diff --git a/hed/models/hed_string.py b/hed/models/hed_string.py index 328316868..fe559689c 100644 --- a/hed/models/hed_string.py +++ b/hed/models/hed_string.py @@ -37,6 +37,7 @@ def __init__(self, hed_string, hed_schema, def_dict=None, _contents=None): super().__init__(hed_string, contents=contents, startpos=0, endpos=len(hed_string)) self._schema = hed_schema self._from_strings = None + self._def_dict = def_dict @classmethod def from_hed_strings(cls, hed_strings): @@ -55,7 +56,8 @@ def from_hed_strings(cls, hed_strings): hed_string = ",".join([group._hed_string for group in hed_strings]) contents = [child for sub_string in hed_strings for child in sub_string.children] first_schema = hed_strings[0]._schema - new_string.__init__(hed_string=hed_string, _contents=contents, hed_schema=first_schema) + first_dict = hed_strings[0]._def_dict + new_string.__init__(hed_string=hed_string, _contents=contents, hed_schema=first_schema, def_dict=first_dict) new_string._from_strings = hed_strings return new_string @@ -344,7 +346,7 @@ def validate(self, allow_placeholders=True, error_handler=None): """ from hed.validator import HedValidator - validator = HedValidator(self._schema) + validator = HedValidator(self._schema, def_dicts=self._def_dict) return validator.validate(self, allow_placeholders=allow_placeholders, error_handler=error_handler) def find_top_level_tags(self, anchor_tags, include_groups=2):