How to use your FLEx database to create a digital grammar
Cite as:
Matter, Florian. 2022. How to use your FLEx database to create a digital grammar. https://github.com/fmatter/flex-grammar-tutorial/releases/tag/v0.0.2
The goal of this tutorial is to showcase a workflow that starts with a glossed corpus from FLEx and creates a web app serving an interactive digital grammar. It can be divided into three distinct steps:
- convert FLEx exports to a CLDF corpus dataset with
cldflex
- write linguistic description in a
pylingdocs
project - set up and serve a
clld
database using this template
Requirements
- knowledge prerequisites: command line literacy (this tutorial by Johannes Englisch or this LaunchSchool book may help)
- software prerequisites:
- a working python 3.7+ installation
- git
- system-specific:
- macOS: Xcode Command Line Tools (
xcode-select --install
) - windows: ?
- Linux: you should be fine
- macOS: Xcode Command Line Tools (
- optional: Pandoc if you want to use
pylingdocs
for output formats other than a CLLD app
Running into problems?
- please check first if your case is covered in common problems. If this does not solve your problem, continue.
- if it's evident that the error comes from one of the used python packages (cldflex, pylingdocs, indicogram): click the respective link and open an issue. Otherwise, continue.
- open an issue here.
0 Preliminaries
It is highly recommended that you create a virtual environment and then run all parts of this tutorial in that environment:
1 Workflow
Note: the Makefile contains a list of command definitions.
Where applicable, steps below will have an make X
instruction in parentheses.
1.2 Export your FLEx data
- export your FLEx text database as
.flextext
(into this folder) - export your FLEx lexicon as
.lift
(into this folder)
If you just want to see the demo 🔥right now🔥: run make all
and visit localhost:6543
in your webbrowser.
(If you don't have usable FLEx data, the cldflex
repo contains example flextext and lift files that you can use [make demofiles
])
1.3 Set up software dependencies
Install the python packages needed for the next two steps (make install
):
1.4 Set up the glottolog catalog
If you want to follow this tutorial to the letter, you will need to download the glottolog catalog with cldfbench
so that language metadata can be looked up.
To do so, run the following command and say y
to installing the glottolog catalog (make glottolog
).
cldfbench
will tell you where the catalog is stored so you can delete it if you don't want to keep it.
Alternatively, you can provide a languages.csv
file to cldflex
(minimal example).
1.5 Create a CLDF version of your corpus
Next, use cldflex
to transform the contents of your .flextext
and .lift
files to a CLDF dataset (make cldflex
):1
Note that you can also create a CLDF dataset in some other way, e.g. by using cldfbench
, or you can work with an existing dataset.
1.6 Create a pylingdocs project based on that CLDF dataset
- create a pylingdocs project (the Makefile looks for an ID ending in
grammar
!)
cldf/metadata.json
) should work; otherwise, enter the path to your dataset.
- (optional) write stuff! (how to use pylingdocs)
- create another CLDF dataset combining data and description (
make pylingdocs
):
1.7 Set up a CLLD app
- fork, clone or download this repo into this folder and install it (
make indicogram
does both):
- build the
clld
database and serve it (make clld
):
cd indicogram
clld initdb development.ini --cldf ../your-grammar/output/cldf/metadata.json
pserve --reload development.ini
- view the app in your webbroser at
localhost:6543
2 FAQ
3 Common problems
Problems will be listed here.