medcat.utils.legacy.legacy_converter
Attributes
Classes
Converts v1 models to v2 models. |
|
Describes the available serialisers. |
Functions
|
Perform the conversion from v1 to v2. |
|
Module Contents
- class medcat.utils.legacy.legacy_converter.Converter(medcat1_model_pack_path, new_model_pack_path, ser_type=AvailableSerialisers.dill)
Converts v1 models to v2 models.
- Parameters:
medcat1_model_pack_path (str)
new_model_pack_path (Optional[str])
- cdb_name = 'cdb.dat'
- vocab_name = 'vocab.dat'
- config_name = 'config.json'
- __init__(medcat1_model_pack_path, new_model_pack_path, ser_type=AvailableSerialisers.dill)
- Parameters:
medcat1_model_pack_path (str)
new_model_pack_path (Optional[str])
- old_model_folder
- new_model_folder
- ser_type
- property expected_files_in_folder
The base names of the required files in a folder for a v1 model.
- _validate()
- convert()
Use the gathered information to convert to a v2 model.
This converts the CDB, Vocab, and Config, in order and then created the model pack.
If self.new_model_folder is set, the model will be saved as well.
- Returns:
CAT – The model pack.
- Return type:
- medcat.utils.legacy.legacy_converter.clogger
- class medcat.utils.legacy.legacy_converter.AvailableSerialisers
Bases:
enum.EnumDescribes the available serialisers.
- dill
- json
- write_to(file_path)
- Parameters:
file_path (str)
- Return type:
None
- classmethod from_file(file_path)
- Parameters:
file_path (str)
- Return type:
- __new__(value)
- _generate_next_value_(start, count, last_values)
Generate the next value when not given.
name: the name of the member start: the initial start value or None count: the number of existing members last_value: the last value assigned or None
- classmethod _missing_(value)
- __repr__()
- __str__()
- __dir__()
Returns all members and all public methods
- __format__(format_spec)
Returns format using actual value type unless __str__ has been overridden.
- __hash__()
- __reduce_ex__(proto)
- name()
The name of the Enum member.
- value()
The value of the Enum member.
- medcat.utils.legacy.legacy_converter.hlogger
- medcat.utils.legacy.legacy_converter.do_conversion(file_from, file_to, save_format)
Perform the conversion from v1 to v2.
- Parameters:
file_from (str) – The v1 model pack path.
file_to (str) – The v2/target model pack path.
save_format (AvailableSerialisers) – The type of serialiser for v2.
- medcat.utils.legacy.legacy_converter.main(argv=None)
- Parameters:
argv (Optional[list[str]])