Computations Syntax Lectures: Outline
Lecture 1
Coursenotes: Chapter 1
Participants' native languages: Chinese (2), Dutch, English, Finnish, French (2), Greek, Hebrew, Italian (3), Korean, Persian (2), Polish, Portuguese, Romanian (3), Russian, Spanish, Swedish (2), Swiss German, West-Assyrian - 24 students, 17 languages + 2 teachers, 1 more language
Formal grammar is no more expected to match natural language exactly
- analysis: should be wider than the language (we will use UD)
- generation: should be contained in the language (we will use GF)
- in both formats, we aim to use universal concepts for many languages
Phrase structure grammars, context-free = BNF, grammar rules, trees
- example: english.cf
- testing grammars in GF: import, generate_random, parse, linearize, visualize_parse, help
GF grammars: dividing .cf into abstract and concrete .gf
- example: Intro*.gf
- forms of rules: cat, fun, lincat, lin
- word order switch English-Italian
- to solve next time:
Experiments in GF:
- https://cloud.grammaticalframework.org/minibar/minibar.html
- Grammar: ResourceDemo, Startcat: S
Lecture 2
Agreement, parameter definitions, variable and inherent features, linearization types
For you to do:
- write a concrete syntax for some other language, carefully thinking about
Instructions for ARM Mac users
The GF Download page contains a binary for the Mac with an Intel processor, but it will not work for newer Macs, which use an ARM Processor (called M1, M2, or M3 by Apple).
We have therefore prepared a binary for these newer Macs. To download it, open a terminal and do:
cd # go to your home directory
mkdir tmp # if the directory tmp does not exist already
cd tmp
wget https://www.grammaticalframework.org/~aarne/gf-mac.gz
This is better than downloading via a browser, because your Mac OS may then block the use of the program as "unreliable".
After download, stay in the terminal and do:
gunzip gf-mac.gz
mv gf-mac gf
chmod a+x gf
./gf
You should now see the GF promt. Type 'help' to see if it works!
Hint: if any of the terminal commands used above are unfamiliar to you, it is a good time to learn them now.
They will be useful throughout your future career as a programmer!
The readily available method is the man command, for instance,
man gunzip
The next thing is to move it to a place where you can find it from anywhere in your system. One standard place is
mv gf /usr/local/bin
If you get "permission denied", you will have to write
sudo mv gf /usr/local/bin
and type your computer's password.
Then you can try
cd
gf
to verify that GF works in your home directory.
After that, you can test it in the course GitHub directory
cd comp-syntax-gu-mlt/lectures/lecture-02
gf
> import IntroEng.gf # in GF
You can work here for a while. The next step will be to install the RGL, but this can wait a bit. The instructions in https://www.grammaticalframework.org/download/index-3.11.html should work even for the ARM Mac.
Lecture 3
Course notes: Chapter 2, Chapter 5
Analysing UD data with shell commands:
cat treebanks/UD_Swedish-Talbanken/sv_talbanken-ud-train.conllu | cut -f4 | grep -v "#" | sort
cat treebanks/UD_Swedish-Talbanken/sv_talbanken-ud-train.conllu | cut -f4 | grep -v "#" | sort -u
cat treebanks/UD_Swedish-Talbanken/sv_talbanken-ud-train.conllu | cut -f4 | grep -v "#" | sort -u | wc
Again, make sure to learn to use these shell commands!
Adding deptreepy to the pipeline:
cat treebanks/UD_English-EWT/en_ewt-ud-train.conllu | ./deptreepy.py "statistics POS"
cat treebanks/UD_English-EWT/en_ewt-ud-train.conllu | ./deptreepy.py "match_wordlines (POS X)"
cat treebanks/UD_English-EWT/en_ewt-ud-train.conllu | ./deptreepy.py "statistics FEATS"
cat treebanks/UD_English-EWT/en_ewt-ud-train.conllu | ./deptreepy.py "match_wordlines (POS NOUN) | statistics FEATS"
Download deptreepy and the UD treebanks, and do the same for other treebanks of other languages!
Confirmed Swedish inflection table by looking up a word at https://svenska.se/ and also learn what is inherent and what is variable.
Started MorphologyEng.gf and MorphologySwe.gf in lecture-03/.