DEP-PATTERN GRAMMAR

Author: 
Pablo Gamallo Otero, Isaac González
Grupo Gramatica do Espanhol
University of Santiago de Compostela
Spain


DESCRIPTION
This package contains a deppattern grammar and its configuration files.

HOW TO COMPILE THE GRAMMAR
Put this directory in the "grammars" directory and run the following commands: 

(1)
DepPattern/grammars/grammar-es_gl_pt-beta-1$ cp *.conf ../../src/.

(2)
DepPattern/grammars/grammar-es_gl_pt-beta-1$ cd ../../

(3)
DepPattern$ ./dp.sh <type_of_output> <tagger> <lang> <file> <parser> <grammar>

      type_of_output= -a (dependency analysis), -fa (full dependency analysis), -c (correct tagged text)
      tagger=freeling, treetagger
      lang=es, gl, pt
      file=path of the file input
      parser=name of the parser generated from the grammar
      grammar=path of the grammar: 
	     ./grammars/grammar-es-beta-1/grammar-es-beta-1.dp
             ./grammars/grammar-gl-beta-1/grammar-gl-beta-1.dp
             ./grammars/grammar-pt-beta-1/grammar-pt-beta-1.dp

Note: if you haven't installed Freeling, don't select 'freeling'.


INPUT FILE

The input file must be in plain text format. 
File codification must be ISO-8859-1.


GRAMMAR FILE
The file containing the grammar must be in plain text format. 
Below, you'll find a toy example of a grammar with 4 dependency-based rules:

###### GRAMMAR #########

AdjnR:  NOUN  ADJ
Agr: number, genre
%

SpecL:  DT  NOUN
Agr: number, genre
%

SubjL:  NOUN  [ADV]* VERB
Agr: number
%

DobjR:  VERB [ADV]* NOUN
%

########### END GRAMMAR ################

Look up the tutorial stored in the doc directory.


OUTPUT FORMAT (flag -a):
Option -a means that the dp.sh generates a file with a dependency-based analysis. Each analysed sentence consists of two elements:

1. a line containing the POS tagged lemmas of the sentence. This line begins with the tag SENT. The set of tags used here are listed in file TagSet.txt. All lemmas are identified by means of a position number from 1 to N, where N is the size of the sentence.

2. All dependency triplets identified by the grammar. A triplet consists of:

(relation;head_lemma;dependent_lemma)

For instance, the sentence "I am a man." generates the following output:

################
SENT::<I_PRO_0_<number:0|lemma:I|possessor:0|case:0|genre:0|person:0|politeness:0|type:P|token:I|> am_VERB_1_<number:0|mode:0|lemma:be|genre:0|tense:0|person:0|type:S|token:am|> a_DT_2_<number:0|lemma:a|possessor:0|genre:0|person:0|type:0|token:a|> man_NOUN_3_<number:S|lemma:man|genre:0|person:3|type:C|token:man|> ._SENT>
(Lobj;be_VERBF_1;I_PN_0)
(Spec;man_NOM_3;a_DT_2)
(Robj;be_VERBF_1;man_NOM_3)
################

The set of dependency relationships used by the 5 grammars can be consulted and modified in the corresponding configuration file: src/dependencies.conf.

Morpho-syntactic information is provided by a POS tagger, either tree-tagger or freeling. 

OUTPUT FORMAT (flag -fa):
Option -fa gives rise to a full represention of the depedency-based analysis. Each triplet is associated with two pieces of information: morpho-syntactic features of both the head and the dependent. 


OUTPUT FORMAT (flag -c):
Option -c allows dp.sh to generate a file with the same input (a tagged text) but with some corrections proposed by the grammar. This option is useful to identify and correct regular errors of PoS taggers using grammatical rules. 


CoNLL OUTPUT FILE FORMAT
It is also possible to get an output file with the format defined by CoNLL-X, inspired by Lin (1998):

Lin, D., 1998. Dependency-based Evaluation of MINIPAR. In Proceedings of the Workshop on the Evaluation of Parsing Systems, First International Conference on Language Resources and Evaluation. Granada, Spain. 12

This format was adopted by the evaluation tasks defined in CoNLL.

To get this ouput format file, you have to run ./scripts/saidaCoNLL.perl taking as input the output of 'dp.sh -a'. 


EXTENSIONS
You can use the output of the parser to build a cooccurrences file. This file contains all coocurrences between lemmas and dependency contexts. It consists of 3 columns:

context	lemm frequency

To get this cooccurrence information, you have to run ./scripts/contextsDep.perl taking as input the output file generated with -a and the default parsers. 





	
