Conversation
|
It is possible to add order AND distance constraints. # Create some identifiers
a, b, c = Identifier(), Identifier(), Identifier()
examples = [
# a has to be before b
Constraint(a, b, enforces_order=True),
# The distance between a and c will be 3 tokens
Constraint(a, c, distance=3),
]
Query(tokens=[Token(i) for i in (a, b, c)], constraints=examples)By default The distance is probably a bit broken, as it only uses the distance constraint in the places where the two tokens follow each other in the generated query. For this example, you would get the following two alternatives (using a, b and c as placeholder for the tokens): Note that a is always before b and that there are exactly 3 tokens between a and c in the second line. |
|
Seems promising! Unfortunately we don't have the time mental space to make any more progress on this this week (we implemented this during a break from the validator, and we're not done with that yet), but I'll try to get back to this as soon as I can once I'm back to Sweden (so, late September at the earliest). |
Initial support for the format used here (i.e. @ellepannitto's format).
The parser for this format is under development. It will be possible to fetch newer versions from here.
Support is currently very partial, missing:
IDENTITYcolumn (format:COLNAME=ID), which is used to specify that a certain field of a given token is the same as a certain field of another token with idID, e.g. "day by day", "year by year"... (as far as I understand, this is actually possible to do with the current backend)ADJACENCYfield, which is used to add order constraints (@Niklas-Deworetzki: am I right that this isn't supported by the backend yet?)WITHOUTfield: this is the most challenging (at least when it comes to structural properties, e.g.CHILDREN:DEPREL=advmod) because it requires universal quantification, a bit likeTREEin deptreepyREQUIRED, which, if set to 0, makes the token optional (not sure about this one).