Repository navigation
A patch release: more vessel-name prefixes for remove_obj_prefixes, a standalone jaro() similarity, and a configurable cutoff for Jaro and Jaro-Winkler.
Changes
Vessel-name prefixes
remove_obj_prefixes now recognises dotted and spaced spellings of M/V (M.V, M V) and tanker prefixes (MT, M/T, M.T, M T, SS). Prefixes only match as whole words, so names like Mtwara Dawn or Ssangyong Star stay as they are (#304).
from rigour.names.prefix import remove_obj_prefixes
remove_obj_prefixes("M.V. Oceanic") # "Oceanic"
remove_obj_prefixes("M/T Oceanic") # "Oceanic"
remove_obj_prefixes("SS Oceanic") # "Oceanic"
remove_obj_prefixes("Mtwara Dawn") # "Mtwara Dawn"jaro() and a cutoff argument
rigour.text.distance.jaro (also exported from rigour.text) computes plain Jaro similarity, for callers that apply their own prefix weighting or none at all. jaro and jaro_winkler both take a cutoff argument (default 0.6, the previous hard-coded value): scores at or below it are returned as 0.0. Pass cutoff=0.0 to get the unaltered score (#305).
from rigour.text import jaro, jaro_winkler
jaro("MARTHA", "MARHTA") # 0.944…
jaro_winkler("MARTHA", "MARHTA") # 0.961…
jaro_winkler("abc", "xyz", cutoff=0.0) # unaltered scoreBreaking changes
NamePartandSpanno longer implement__len__, solen(part)andlen(span)now raiseTypeError. Uselen(part.form)for a part's length, orlen(span.parts)for the number of parts in a span (#305).