Skip to content

Align age separator handling with the Java implementation #54

Description

@jzonthemtn

Parity with philterd/phileas#332, which reports that the Java age filter does not detect Age: 47, the form age most often takes in a structured clinical or intake record.

This port is already ahead of Java here. phileas/filters/age_filter.py allows an optional colon:

re.compile(r"\b(age)(d)?(\s*:?\s*)[0-9.]+\b", re.IGNORECASE),

So Age: 47, Age : 47, age:47, and Age 47 are all detected today, while Age - 47 and Age = 47 are not.

This issue is therefore about converging on one answer rather than adding a missing feature. philterd/phileas#332 asks whether = and - should be accepted as separators alongside the colon; whatever it settles on, this implementation should match, so a policy behaves the same whichever language runs it.

A second, separate drift is worth recording here: Java carries two spelled-out patterns (age thirty-five, thirty-five years old) that neither this port nor the .NET port implements. That is a larger gap than the separator question and should be tracked on its own.

Acceptance Criteria

  • The separator set matches what Detect ages written with a separator, such as "Age: 47" phileas#332 lands on, so Java and Python agree
  • The existing colon forms (Age: 47, Age : 47, age:47, Age 47) continue to be detected
  • Dates such as 2026-01-15 are still not detected as ages
  • Tests cover the separator forms alongside the existing phrasings

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions