kiwi.utils.io
BaseConfig
Base class for all pydantic configs. Used to configure base behaviour of configs.
default_map_location(storage, loc)
default_map_location
load_torch_file(file_path, map_location=None)
load_torch_file
save_file(file_path, data, token_sep=' ', example_sep='\n')
save_file
save_predicted_probabilities(directory, predictions, prefix='')
save_predicted_probabilities
read_file(path)
read_file
Read a file into a list of lists of words.
target_gaps_to_target(batch)
target_gaps_to_target
Extract target tags from wmt18 format file.
target_gaps_to_gaps(batch)
target_gaps_to_gaps
Extract gap tags from wmt18 format file.
generate_slug(text, delimiter='-')
generate_slug
Convert text to a normalized “slug” without whitespace.
kiwi.utils.io.
logger
Bases: pydantic.BaseModel
pydantic.BaseModel
Config
extra
Borrowed from the nice https://humanfriendly.readthedocs.io, by Peter Odding.
text – the original text, for example Some Random Text!.
Some Random Text!
delimiter – the delimiter to use for separating words (defaults to the - character).
-
the slug text, for example some-random-text.
some-random-text
ValueError – in an empty slug.
kiwi.utils.data_structures
kiwi.utils.tensors