0

I am trying to find words related to 'poss' to the word 'my' but it doesn't work. For example in reverse,


pattern = [
    {
        "RIGHT_ID": "anchor_founded",
        "RIGHT_ATTRS": {"ORTH": "CEO"}
    },
    {
        "LEFT_ID": "anchor_founded",
        "REL_OP": ">",
        "RIGHT_ID": "founded_subject",
        "RIGHT_ATTRS": {"DEP": "poss"},
    }
]

matcher.add("FOUNDED", [pattern])
doc = nlp("My experienced CEO, has founded two AI startups.")
matches = matcher(doc)

gives anchor_founded: CEO founded_subject: My

But if I anchor this in "My"

pattern = [
    {
        "RIGHT_ID": "anchor_founded",
        "RIGHT_ATTRS": {"ORTH": "My"}
    },
    {
        "LEFT_ID": "anchor_founded",
        "REL_OP": "<",
        "RIGHT_ID": "founded_subject",
        "RIGHT_ATTRS": {"DEP": "poss"},
    }
]

doesn't give any matches. Any thoughts? Ideally I want to get the second thing to work.

1 Answer 1

0

{"DEP": "poss"} is a token pattern, which doesn't match the attributes for "founded", only for "My".

Inspect token.dep_ for the whole sentence and while it may vary a bit by model version, it will be something like this:

doc = nlp("My experienced CEO, has founded two AI startups.")
print([t.dep_ for t in doc])
# ['poss', 'amod', 'nsubj', 'punct', 'aux', 'ROOT', 'nummod', 'compound', 'dobj', 'punct']
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.