medcat.utils.regression.editing
Module Contents
Functions
|
Combine two dictionaries that define RegressionCheckers. |
|
Combined the contents of two yaml strings that describe RegressionCheckers. |
|
Combined the contents of two yaml files that describe RegressionCheckers. |
Attributes
- medcat.utils.regression.editing.logger
- medcat.utils.regression.editing.combine_dicts(base_dict, add_dict, in_place=False, ignore_identicals=True)
Combine two dictionaries that define RegressionCheckers.
The idea is to combine them into one that defines cases from both.
If two cases have identical filters, their phrases are combined.
If an additional case has the same name as one in the base dict, its name is changed before adding it.
- Parameters:
base_dict (dict) – The base dict to which we shall add
add_dict (dict) – The additional dict
in_place (bool) – Whether or not to modify the existing (base) dict. Defaults to False.
ignore_identicals (bool) – Whether to ignore identical cases (otherwise they get duplicated). Defaults to True.
- Returns:
dict – The combined dict
- Return type:
dict
- medcat.utils.regression.editing.combine_contents(base_yaml, add_yaml, ignore_identicals=True)
Combined the contents of two yaml strings that describe RegressionCheckers.
This method simply loads in teh yamls and uses the combine_dicts method.
- Parameters:
base_yaml (str) – The yaml of the base checker
add_yaml (str) – The yaml of the additional checker
ignore_identicals (bool) – Whether or not to ignore identical cases. Defaults to True.
- Returns:
str – The combined yaml contents
- Return type:
str
- medcat.utils.regression.editing.combine_yamls(base_file, add_file, new_file=None, ignore_identicals=True)
Combined the contents of two yaml files that describe RegressionCheckers.
This method simply reads the data and uses the combined_contents method.
The results are saved into the new_file (if specified) or to the base_file otherwise.
- Parameters:
base_file (str) – The base file
add_file (str) – The additional file
new_file (Optional[str]) – The new file name. Defaults to None.
ignore_identicals (bool) – Whether or not to ignore identical cases. Defaults to True.
- Returns:
str – The new file name
- Return type:
str