Skip to content

Age filter matches implausible numbers after an "age" keyword #56

Description

@jzonthemtn

The age filter keeps any number that follows an age or aged keyword, with no plausibility check, so clearly non-age values are redacted as ages:

Input Matched as an age
form AGE 2024 AGE 2024
Bronze Age 1200 Age 1200

An age written after a label is realistically 0 to about 125. Bounding the value on the keyword pattern in phileas/filters/age_filter.py drops these while keeping Age: 47 and age 39.5. The bound must apply only to the keyword pattern, not to the y/o and years old forms.

This trades a little recall for precision, since a genuine Age: 130 would stop being redacted, so the ceiling should be set generously rather than at a typical maximum lifespan.

Tracked for Java in philterd/phileas#334.

Acceptance Criteria

  • A number outside 0 to 125 following an age/aged keyword is not detected as an age, covering form AGE 2024 and Bronze Age 1200
  • Age: 47 and aged 39 are still detected
  • Decimal ages such as age 39.5 are still detected
  • The boundary behaves as specified: age 125 is detected, age 126 is not
  • The bound applies only to the keyword pattern; the y/o and years old forms are unaffected
  • Dates such as 2026-01-15 are still not detected as ages
  • Tests cover the boundary and the false-positive cases in tests/test_age_detection.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions