FieldPattern

class fuzzytable.FieldPattern(name, alias=None, approximate_match: Optional[bool] = None, min_ratio: Optional[float] = sentinel.DefaultValue, contains_match: [<class 'bool'>] = False, multifield: [<class 'bool'>] = False, cellpattern=None, mode=sentinel.DefaultValue, searchterms_excludename=False, case_sensitive=sentinel.DefaultValue)

Optional argument for FuzzyTable subfields parameter.

FieldPattern arguments override FuzzyTable arguments of the same name. In the following example, the first_name FieldPattern uses approximate matching while last_name uses exact matching.

>>> from fuzzytable import FuzzyTable
>>> subfields = [
...     FieldPattern('first_name', approximate_match=False),
...     FieldPattern('last_name')
... ]
>>> FuzzyTable(approximate_match=True, subfields=subfields)
Parameters:
  • name (str) – SingleField name. This is the name that will given to a matched field. This parameter, along with any aliases supplied, are the search criteria.
  • alias (str or iterable thereof, default None) – Additional search criteria.
  • approximate_match (bool, default None) – Overrides the default behavior of the FuzzyTable approximate_match parameter. Deprecated in v0.18. To be removed in v1.0. Use mode instead.
  • min_ratio (float, default None) – Overrides the default behavior of the FuzzyTable min_ratio parameter.
  • contains_match (bool, default False) – Overrides the standard ratio-based approximate matching. Instead, a match succeeds if any of this field’s terms are contained in a cell string. Deprecated in v0.18. To be removed in v1.0. Use mode instead.
  • multifield (bool, default False) –
  • cellpattern (CellPattern or any callable) – This normalizes this field’s data.
  • mode (None or str) – Choose from 'exact', 'approx', or 'contains'. mode overrides approximate_match and contains_match.
  • searchterms_excludename (bool, default False) – If True, the FieldPattern name is not used as a search term; only aliases are used. This means a FieldPattern with searchterms_excludename and no aliases will produce no matches!
  • case_sensitive (None or bool, default True) – Used when seeking header row and matching Fields to FieldPatterns.