curiosity-ai/catalyst

Help needed in the pattern composition

GalawynRM opened this issue · 4 comments

mp => mp.Add(
                    new PatternUnit(P.Single().WithTokens(quadriTokens)),
                    new PatternUnit(P.Single().WithLength(1, 2).HasNumeric()),
                    new PatternUnit(P.SingleOptional().WithTokens(colTokens)),
                    new PatternUnit(P.SingleOptional().WithLength(1, 2).HasNumeric())
                    )

i would able to detect this kinda pattern:
a letter (A,B,C,D,E,F,G,H)
1, 2 numeric digits
optionally "col" or "col."
optionally 1, 2 numeric digits.
example
"A01", or "A01 col. 1", or "A01 col.1" or "A01 col 1", "A01 col. 1"
i'm able to make it work, when is only the first patternunit so "A"
but i'm not able to make it recognize "A01" even removing the optionals.
where i mistake?

I corrected the pattern

mp => mp.Add(
                        new PatternUnit(
                            P.And(
                                P.Single().WithChars(quadri.ToCharArray()),
                                P.Single().HasNumeric()
                                )
                        )
                        , new PatternUnit(P.SingleOptional().WithToken("col"))
                        , new PatternUnit(P.SingleOptional().HasNumeric())

quadri contains ABCDEFGH
but now the number 100, that doesn't contain the characters, is recognized with this pattern

Hi @GalawynRM - is the issue still happening?

Yes. I need to try to update to latest just in case

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.