Contains the version number of the Text-Fabric library.
Contains the name and the version of the Text-Fabric library.
Error and informational messages can be issued, with a time indication.
silentOn(), silentOff(), isSilent(), setSilent()
Suppress or enable informational messages, i.e. messages issued through
This is no influence on error messages, i.e. messages issued through
Suppress informational messages. If
deep=True also suppresses warnings.
Enable informational messages.
1 2 3
setSilent(False) setSilent(True) setSilent('deep')
Enable or suppress informational/warning messages dependent on
Whether informational messages are currently suppressed or not.
info(), warning(), error()
1 2 3
info(msg, tm=True, nl=True) warning(msg, tm=True, nl=True) error(msg, tm=True, nl=True)
Sends a message to standard output, possibly with time and newline.
info()is being used, the message is suppressed if the silent mode is currently on;
- if the silent mode is not
warnings()will also be suppressed;
error()messages always come through;
info()or warning is being used, the message is sent to
error()is being used, the message is sent to
In a Jupyter notebook, the standard error is displayed with a reddish background colour.
True, an indicator of the elapsed time will be prepended to the message.
True a newline will be appended.
Changes the level of indentation of messages and possibly resets the time.
The level of indentation, an integer. Subsequent
error() will display their messages with this indent.
True, the elapsed time to will be reset to 0 at the given level. Timers at different levels are independent of each other.
Clearing the cache¶
Text-Fabric precomputes data for you, so that it can be loaded faster. If the original data is updated, Text-Fabric detects it, and will recompute that data.
But there are cases, when the algorithms of Text-Fabric have changed, without any changes in the data, where you might want to clear the cache of precomputed results.
Calling this function just does it, and it is equivalent with manually removing all
.tfx files inside the hidden
.tf directory inside your dataset.
See also clean() below
From version 7.7.7 onwards, Text-Fabric uses a parameter called
PACK_VERSION to mark the stored pre-computed data. Whenever there are incompatible changes in the packed data format, this version number will be increased and Text-Fabric will not attempt to load the older pre-computed data.
The older data will not be removed, however. Use the function
clean() below to get rid of pre-computed data that you no longer need.
No need to load
It is not needed to execute a
from tf.clean import clean clean(tfd=True, gh=False, dry=False, specific=None, current=False)
Removes all precomputed data resulting from other
PACK_VERSIONs than the one currently used by Text-Fabric.
You find the current pack version in the parameters file.
By default, your
~/text-fabric-data is traversed and cleaned, but if you pass
tfd=False it will be skipped.
By default, your
~/github will be skipped, but if you pass
gh=True it will be traversed and cleaned.
You can pass a specific directory here. The standard directories
~/text-fabric-data will not be used, only the directory you pass here.
~ will be expanded to your home directory.
If current=True, also the precomputed results of the current version will be removed.
By default, nothing will be deleted, and you only get a list of what will be deleted if it were not a dry run. If you pass
dry=False the delete actions will really be executed.