templates

18 views
Skip to first unread message

Michi Amsler

unread,
Mar 2, 2017, 12:06:29 PM3/2/17
to Constraint Grammar
Hi there!

Today I had to reimplement some of my grammars and I wondered if there was a more elegant way to do it.
So my question is:
- I want to formulate constraints which check for given the verb-frames (i.e. restrictions on what may be dependent to the verb)

--> there are some children that must be there (on the c axis) ~ required
--> there are some tags that must not be there (also on the c axis) ~ prohibitive
--> there are maybe some other children but I don't care about them (this is important because it prevents the solutions based on "ALL c X")
(this last group should be left open)


can I pack these constraints into a TEMPLATE? as far as I found out, I can combine contexts in template with OR but I cannot combine context in a TEMPLATE with "AND" - or am I mistaken?
(I know that I can LINK them using cx to backrefer to the verb each time or taking the cumbercome route of something like  "LINK c DEP_OBJA LINK p (*) LINK DEP_OBJD" and so on, i.e. always jumping back to the parent to define multiple instances of requirement/prohibitive at once in a template) ...  but this version is not suitable in combination with "NONE c DEP_X" approaches (because - and of course very logically - it makes not very much sense to LINK p (*) (to go back to the verb) from a "NONE c" context ).

I tried several versions but but with none of them I could reach what I wanted: defining a template based on dependencies with some requirements that must be met, some prohibitives which must not be present while leaving open the occurrence of some other tags (open third group)

Any help appreciated,
thanks
Michi

Tino Didriksen

unread,
Mar 3, 2017, 5:40:38 AM3/3/17
to constrain...@googlegroups.com
Replied inline...

On 2 March 2017 at 18:06, Michi Amsler <michi....@gmail.com> wrote:
So my question is:
- I want to formulate constraints which check for given the verb-frames (i.e. restrictions on what may be dependent to the verb)

--> there are some children that must be there (on the c axis) ~ required
--> there are some tags that must not be there (also on the c axis) ~ prohibitive
--> there are maybe some other children but I don't care about them (this is important because it prevents the solutions based on "ALL c X")
(this last group should be left open)


can I pack these constraints into a TEMPLATE? as far as I found out, I can combine contexts in template with OR but I cannot combine context in a TEMPLATE with "AND" - or am I mistaken?

I can't think of a clean way to say all those conditions in a reusable fashion.

Conceptually, how should AND work with templates and linking on from them? E.g., given Template X = (-1 x) AND (1 y LINK 1 z) ; used in a context (1 m LINK T:X LINK 1 n) where does the n look at?

With OR, this is simple - look at the context that matched. With AND, it should conceptually look at both branches? That almost certainly doesn't make sense linguistically. Could make a new modifier to mark which branch to continue from.

-- Tino Didriksen

Michi Amsler

unread,
Mar 7, 2017, 11:31:22 AM3/7/17
to Constraint Grammar, ma...@tinodidriksen.com
replied inline; sorry for possible confusion upcoming ...




I can't think of a clean way to say all those conditions in a reusable fashion.

ok, so at least I'm not the only one ... 

 
Conceptually, how should AND work with templates and linking on from them? E.g., given Template X = (-1 x) AND (1 y LINK 1 z) ; used in a context (1 m LINK T:X LINK 1 n) where does the n look at?

considering your example, it makes it much clearer to me why there i no implementation the way I expected. Anyway: an AND would/could/should mean that the context from the TEMPLATE X would have to hold for all constraints, i.e.  in your example (and I think this gets a little complex now): 
- for the original context: since m must be on position 1: check that and if match, proceed with the following:
     from m we start the template, we would than first check:
     - from m on position -1 is x
     - from m on position 1 is y LINKed to 1 z
 --> if all that holds (otherwise we stop and get no match):
      - since we have the still the LINK 1 n we would have to fullfill this on both parts of the AND expression ...

Anyway: that turns into a weird case because of the positional constraints. I wanted to use the dependency axis to implement something like:

ADD (VERB_subj_obja) TARGET (V) IF (c SUBJ)(c OBJA)(NONE c PP)(NONE c OBJD)(NONE c OBJI)(NONE c OBJC)(NONE c NEGATOR_V); # ...

(and in this way, I get what I want: 
in words: There must be SUBJ and OBJA but no child must be a PP, an OBJI, an OBJC or a NEGATOR 
-->  "c SUBJ AND  c OBJA AND NOT c PP AND NOT c OBJD AND NOT c OBJC AND NOT c NEGATOR"; 
so basically all the contexts are "ANDed" (which turns into AND NOT through NONE)

The question was just if I could integrate that into a template; maybe using something like 
TEMPLATE V_SO =  (c SUBJ LINK cx OBJA NEGATE LINK cx PP)

and then putting it into the rule:

ADD (VERB_subj_obja) TARGET (V) IF (T:V_SO);

The idea is pretty simple: an enumeration of what is needed, what is forbidden and for the other possible children, I don't care. 
If I'd used NONE in the template, then I cannot LINK further (reasonably ...)
If I'd used NOT c X that would mean something else, like you pointed out in the group-thread https://groups.google.com/forum/#!topic/constraint-grammar/tpN42ZtFii4 
--> "there exists a child which does not match X" 
so my only way to come up with was the NEGATE cx X LINK NEGATE cx Y etc. approach - but that breaks "AND-NOT"-chains ("I forbid A as child and B as child and ...") since it considers the whole linked chain (and therefore __not__ acting as a logical NOT (also according to the manual); and this makes the sequence of the children which I want to forbid important - and that is something I want to avoid; I wanted just to enumerate a set of must-not-be-children in a template)


So what works in the end for me is just adding the contexts (to the list of contexts); there is no abbreviation for that:
ADD (VERB_subj_obja) TARGET (V) IF (c SUBJ)(c OBJA)(NONE c PP)(NONE c OBJI)(NONE c OBJC) etc. 

A bit more elegant seems to be if I define SETs with the except-operator: 
given that I have all verb_dep_roles something like
SET ALL_VERB_DEP_ROLES = ... #
SET SUBJ_OBJA =  ...#
SET ALL_VERB_DEP_ROLES_BUT_SUBJ_OBJA =  ALL_VERB_DEP_ROLES -  SUBJ_OBJA

then

ADD (VERB_subj_obja) TARGET (V) IF (c SUBJ LINK cx OBJA)(NONE c ALL_VERB_DEP_ROLES_BUT_SUBJ_OBJA)
(and maybe template-ify the first part of the SET of needed children)

 
With OR, this is simple - look at the context that matched. With AND, it should conceptually look at both branches? That almost certainly doesn't make sense linguistically. Could make a new modifier to mark which branch to continue from.

--> by no means I'd consider my strange question as a point for which something should be added; neither is it logically thought through nor does it have much relevance for normal constraint grammar approaches


best
Michi

 
-- Tino Didriksen

Reply all
Reply to author
Forward
0 new messages