Differences between @Tags and other Tags

24 views
Skip to first unread message

Michi Amsler

unread,
Jan 5, 2012, 4:14:14 AM1/5/12
to Constraint Grammar
Hello there

I'm currently experimenting with vislcg3 and how we can use it in some
projects.
One of them is about polarities which should be applied first on the
level of words (where we match the lemma) and on a second level some
rules are applied to build "polarity chunks". The second step is done
via a set of rules which rely on the context around the word in
question for which VISLCG3 seemed to be a very suitable grammar
mechanism.


Now I come with a simple question:


if we wanted to use vislcg3 as a "tagger" in the first place to add
the polarity (via lemma matching) to the words and if we wanted to
separate this process in a own cg-grammar file, do we have to add tags
without the @-Prefix since it doesn't seem to work within a piped
chain with several vislcg3 processes?
(no rule is applied to a line with an @tag on the posterous
processes)

I tested it this way and it works, but I couldn't find any
documentation if this is the way to do it - maybe because this is an
abuse of vislcg3 to use is as "tagger" but we wanted to check out what
is possible only with vislcg3 onboard-features.


Thanks for response
best regards
Michi Amsler
(Student of Computational Linguistics at University of Zürich)

Tino Didriksen

unread,
Jan 5, 2012, 5:41:56 AM1/5/12
to Constraint Grammar
Nice to see more people experimenting with CG!

Mapping tags are treated slightly different by default, but it should
behave identically regardless of when in the chain you do things.

Got an example / minimal testcase where it doesn't work?

-- Tino Didriksen
CG-3 Developer

Francis Tyers

unread,
Jan 5, 2012, 5:34:42 AM1/5/12
to constrain...@googlegroups.com
El dj 05 de 01 de 2012 a les 01:14 -0800, en/na Michi Amsler va
escriure:

Hi,

@tags are MAPped and a reading can only contain one mapped tag. If you
just want to add tags, try using ADD perhaps with a different prefix,
e.g. & or %

Fran

Trond Trosterud

unread,
Jan 5, 2012, 5:48:44 AM1/5/12
to constrain...@googlegroups.com

Michi Amsler kirjoitti 5.1.2012 kello 10.14:

> if we wanted to use vislcg3 as a "tagger" in the first place to add
> the polarity (via lemma matching) to the words and if we wanted to
> separate this process in a own cg-grammar file, do we have to add tags
> without the @-Prefix since it doesn't seem to work within a piped
> chain with several vislcg3 processes?
> (no rule is applied to a line with an @tag on the posterous
> processes)

The premise here is not right. We routineously make piped chains with several vislcg3 processes. And you may choose prefix yourself.

So my advise is that you solve that, and then look at the original problem again.

Otherwise your plans seem good, and in line with how vislcg3 is used already.

Trond Trosterud.

Michi Amsler

unread,
Jan 5, 2012, 7:44:43 AM1/5/12
to Constraint Grammar
Hello Tino Didriksen

Thanks for the answer (also to the others who wrote back).

Example case:
lets say i have this sentence (example.txt) in cg format:

"<Er>"
"Er" er PPER
"<zeigte>"
"zeigte" zeigen VVFIN NEU
"<seine>"
"seine" sein PPOSAT
"<beliebte>"
"beliebte" beliebt ADJA POS
"<Heiterkeit>"
"Heiterkeit" Heiterkeit NN POS
"<.>"
"." . $.

and I have a (simplified) cg-file polartmarker.cgf:

SECTION

DELIMITERS = "<.>" "<!>" "<?>" "<\;>" "<:>" "<-->" "<¶>"; # define
sentence boundary

#Lemma-Sets
LIST positive_lemma = besiegen beliebt Heiterkeit;
LIST negative_lemma = fehlschlagen rückläufig;
LIST neutrale_lemma = zeigen verhalten kühl;


ADD (POS) (*) (0 positive_lemma);
ADD (NEG) (*) (0 negative_lemma);
ADD (NEU) (*) (0 neutrale_lemma);




then i add polarities (match by lemma), so i get:

~$ cat example.txt | vislcg3 -g polartmarker.cgf


"<Er>"
"Er" er PPER
"<zeigte>"
"zeigte" zeigen VVFIN @NEU
"<seine>"
"seine" sein PPOSAT
"<beliebte>"
"beliebte" beliebt ADJA @POS
"<Heiterkeit>"
"Heiterkeit" Heiterkeit NN @POS
"<.>"
"." . $.

If I wanted now to pipe this into the next vislcg3 process (which is a
kind of "polarity-chunker"), rules which should add further @-Tags
won't be applied:

~$ cat example.txt | vislcg3 -g polartmarker.cgf | vislcg3 -g
polaritychunker.cgf



Expected output:

"<Er>"
"Er" er PPER
"<zeigte>"
"zeigte" zeigen VVFIN @NEU
"<seine>"
"seine" sein PPOSAT
"<beliebte>"
"beliebte" beliebt ADJA @POS @>POS-CHUNK-PART
"<Heiterkeit>"
"Heiterkeit" Heiterkeit NN @POS @POS-CHUNK-HEAD
"<.>"
"." . $.

but the @>POS-CHUNK-PART and @POS-CHUNK-HEAD are not appended
(although they would if i did not use the polartmarker.cgf before).

So I see now why this happens and I know that I could use a specifical
prefix for each chained vislcg3-process, but I tried it without any
prefix (just added "POS" and "NEU" not "@POS" and "@NEU") and this
worked well too. For this very simple case of just lemma-based tagging
(I just need those addional tags in the readings for following
processes) I wonder if you would say that adding tags without prefixes
isn't the way to go or what are the general consequences when using
Tags without prefixes.

I hope this clarifies it a little bit.

regards
Michi

Michi Amsler

unread,
Jan 5, 2012, 7:49:01 AM1/5/12
to Constraint Grammar
sorry folks, should be:

ADD (@POS) (*) (0 positive_lemma);
ADD (@NEG) (*) (0 negative_lemma);
ADD (@NEU) (*) (0 neutrale_lemma);

Tino Didriksen

unread,
Jan 5, 2012, 7:59:23 AM1/5/12
to Constraint Grammar
Ah, so you did hit the difference between mapping tags and other
tags...thought this was something else.

By default, prefix @ makes it a mapping tag. Each reading can only
have 1 mapping tag, but they are merged in output for easier human
viewing.

E.g.
"<beliebte>"
"beliebte" beliebt ADJA @POS @>POS-CHUNK-PART
...is actually understood by CG-3 as:
"<beliebte>"
"beliebte" beliebt ADJA @POS
"beliebte" beliebt ADJA @>POS-CHUNK-PART

The mapping prefix can be changed with --prefix, or you can simply use
something other than @. Separate CG-3 processes can have separate
mapping prefixes for dealing with separate parts of the analysis. It
is also possible to use MAPPING-PREFIX in the grammar to bind a prefix
to a grammar so you don't forget it.

-- Tino Didriksen

Michi Amsler

unread,
Jan 5, 2012, 8:05:45 AM1/5/12
to Constraint Grammar
ok, so then the use of un-prefixed tags is no problem.

thanks
Reply all
Reply to author
Forward
0 new messages