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 whilelast_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
oriterable
thereof, defaultNone
) – Additional search criteria. - approximate_match (
bool
, defaultNone
) – Overrides the default behavior of theFuzzyTable
approximate_match
parameter. Deprecated in v0.18. To be removed in v1.0. Usemode
instead. - min_ratio (
float
, defaultNone
) – Overrides the default behavior of theFuzzyTable
min_ratio
parameter. - contains_match (
bool
, defaultFalse
) – 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. Usemode
instead. - multifield (
bool
, defaultFalse
) – - 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
, defaultFalse
) – 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
, defaultTrue
) – Used when seeking header row and matching Fields to FieldPatterns.
- name (