Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi token inflection and copying #46

Open
melisa-writer opened this issue Jun 19, 2020 · 5 comments
Open

Support multi token inflection and copying #46

melisa-writer opened this issue Jun 19, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@melisa-writer
Copy link
Collaborator

Currently replaCy assumes token matches and text suggestions are single tokens:

Idea:
Single token match enforcement: fail json validation if patterns include FROM_TEMPLATE_ID or PATTERN_REF pointing to a token with OP?

@melisa-writer melisa-writer added the bug Something isn't working label Jun 19, 2020
@sam-writer
Copy link
Contributor

sam-writer commented Jun 19, 2020

I agree with the second two, but is it bad that

PATTERN_REF copies only the first matched token

? That was intentional. I guess I can see use cases for removing this restriction though... what would the API be, also support a dict with start and end? Something like

{
  "PATTERN_REF": {"start": 1, "end": 4}
}

or a list?

{
  "PATTERN_REF": [0, 3, 7]
}

?

@sam-writer
Copy link
Contributor

sam-writer commented Jun 19, 2020

Also, related to #41 and #33

@melisa-writer
Copy link
Collaborator Author

melisa-writer commented Jun 21, 2020

I agree with the second two, but is it bad that

PATTERN_REF copies only the first matched token

? That was intentional. I guess I can see use cases for removing this restriction though... what would the API be, also support a dict with start and end? Something like

{
  "PATTERN_REF": {"start": 1, "end": 4}
}

or a list?

{
  "PATTERN_REF": [0, 3, 7]
}

?

Haha, actually I don't need the second and third, I just need the first one ie. PATTERN_REF.

The use case:

imagine you want to match : to (very) quickly go
and turn it into: (very) quickly going

So you would want to copy stuff between TO and infinitive, which in general can be even a few words long.

Of course here one can do it manually and play with indices after finding the match (remove first and second, move middle stuff), but then you need to separately use pyinflect/lemminflect/replaCy wrapper to make the gerund (so at this point you don't need replaCy at all since you are making it fully manually, you could just use the spaCy matcher).

(A few days ago spent 2h trying to confirm its a spaCy matcher bug, then discovered this in replaCy. 😞 The second and the third added for design consistency. )

Copy stuff you matched seems more natural than copy the first token from the phrase you matched
By default would assume we always copy everything.

@melisa-writer
Copy link
Collaborator Author

Another use case:

  • matching a token and moving it to the end of the sentence. If you can't copy more than one token - this won't work.

It's more difficult to imagine a use case when the pattern would be multi-token, but we would want to copy just the first one imo.

@sam-writer
Copy link
Contributor

Some of the notes in #47 might also be relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants