textflint.common.utils.shift_utils¶
-
textflint.common.utils.shift_utils.
shift_maker
(sign_idx, shf)[source]¶ - Makes shift, which is a basic shift function to be composed.
shift: if idx >= sign_idx, right shift shf for the idx.
- Parameters
sign_idx (int) – word after this idx should shift
shf (int) – word shift
-
textflint.common.utils.shift_utils.
shift_collector
(shifts)[source]¶ - Collect and compose shift`s to a general `shift, to be applied to
each span (or sth else).
- Parameters
shifts (list) – the shift functions
- Return ~types.FunctionType
the collected shift function
-
textflint.common.utils.shift_utils.
shift_decor
(shift_func)[source]¶ - Make shift error-free on non-int values. Decorated shift keeps non-int
values original.
- Parameters
FunctionType – a shift function that only processes int values
- Return ~types.FunctionType
a shift function that processes all types of values