Skip to content

Unexpected behavior with custom regex + pronouns from Ark #21

Description

@AbeHandler

This is a weird corner case, but worth noting and perhaps fixing. If you are using the library with the ARK tagger you might get pronouns tagged with "O".

Because phrasemachine marks tokens that are not in the coarsemap with "O" (i.e. other) this does weird things when you have a custom regex that involves pronoun tags.

tokens = "I drive a red car".split()
postags = "P V D A N".split()

pronouns = "O"
phrasemachine.get_phrases(tokens=tokens, postags=postags, regex=pronouns, minlen=1)["counts"]

Counter({'drive': 1})

I think an easy fix is to change "O" to another, rare-r character internally. Another option (better?) is just not to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions