[CWB] Bug in the Macro Language?

Stefan Evert stefan.evert at uos.de
Thu Aug 30 17:41:24 CEST 2007


> I tried to use prototypes to generalize my two passive-verbform  
> macros into a single one, but I get errors and problems.
>
> 1) The prototype values do not seem to allow quotes for something  
> like $1="la le lo".
> 2) When I try to specify ".*" or .* I get a Syntax Error.
>

Sorry, that's a misunderstanding: the $1=... syntax doesn't specify  
default values, but only descriptive names for the macro parameters  
(which are displayed in some interactive functions, e.g. command-line  
completion).  So in your example below, you would have

MACRO passive($0=attribute $1=verb)

and it would display accordingly when you do "show macro passive(2)"  
in CQP.  In order to implement defaults, you would have to define  
additional Macros with the same name, but 1 or 0 arguments.  For this  
reason, it would make more sense to have the arguments in reverse  
order, because setting the attribute doesn't make sense if you don't  
specify a pattern.  Hence:

MACRO passive($0=pattern $1=attribute)
...
;

MACRO passive($0=pattern)
	/passive["$0", word]
;

MACRO passive()
	/passive[".*"]
;

Note how the variants with default arguments are implemented in terms  
of the more general macros, so there is not much loss in generality  
and elegance.

The reason, of course, is simply that I was too lazy to implement  
default arguments and went for the simpler approach, which doesn't  
make it too difficult to simulate default arguments.  Perhaps this is  
another nook of the code where volunteers could relatively easily  
contribute a new feature.

Best & thanks a lot for your contributions!
Stefan

> I'm using Version 2.2.b99 (from SourceForge) on OS X.
>
> # Find passived of a particular verb.
> #
> # Positional parameters
> #	pos	Part-of-Speech (Penn Tagset as in TreeTagger)
> #
> # Arguments
> #	$0	Positional attribute to match (default: word)
> #	$1	Pattern (default: any)
> #
> # Example
> #	/passive[lemma, know]
>
> MACRO passive($0=word $1=.*)
>     (
> 		(
> 		    [pos="(V([BH]|(B[PZDNG])))"]
> 		    []{0,3}
> 		    [pos="VVN"]
> 		)
> 		|
> 		(
> 		    [pos="VH[ZP]"]
> 		    []{0,3}
> 		    [pos="VBN"]
> 		)
>     )
>     [$0="$1" & pos="VVN"]
> ;
>
>
> Richard Eckart
>
> Darmstadt University of Technology
> Institute of Linguistics and Literary Studies
> Department of English Linguistics
>
> Hochschulstrasse 1
> 64289 Darmstadt
> Germany
>
>
>
> _______________________________________________
> CWB mailing list
> CWB at sslmit.unibo.it
> http://devel.sslmit.unibo.it/mailman/listinfo/cwb
>



More information about the CWB mailing list