flexible

Scripts to facilitate import/export between ELAN and FLEx

Warnings

From ELAN to FLEx

The purpose of this part of flibl is to let FLEx display conversational texts (i.e. non-monologic) in a way that can be understood to involve multiple people. Namely, we put a note at the bottom of each utterance to say who is speaking/signing.

Screenshot of ELAN, displaying the example sentence

becomes

Screenshot of FLEx db, displaying example sentence

You can run elan_tiers.py to create a file where you can view the IDs, Types, and Participants for each of the tiers in your EAF file; this will be helpful if you want to specify if certain tiers are to be excluded or considered translation tiers.

1. elan_tiers.py

elan_tiers.py is a Python script you can use to identify what tiers you have in your ELAN file. Within the file, enter the name of the EAF you would like to examine where indicated (below the line saying # Give the file name (using the relative path to this Python file or absolute path)). Make sure to include the path to that file, so if it’s within another folder specify by filling out the line as:

eaf_file = "./inner_folder/deeper_folder/file_name.eaf"

The period . at the beginning means that you’re referring the current folder, where the Python program is located. If your EAF is located outside of the folder with elan_tiers.py, you can use the absolute path of the text here, something like eaf_file = "/home/username/Documents/field_files/session01/file_name.eaf"

The output of the script will be in a text file that has the name of your EAF file suffixed with “_tiers.txt” (in this case, it will be file_name_tiers.txt). You’ll find it in the folder where the original EAF is located. The information displayed will be each tier ID accompanied by the ELAN “type” you gave that tier and the participant speaking/signing in that tier:

TIER_ID: 
LINGUISTIC_TYPE_REF: 
PARTICIPANT: 

That information is important for using flibl, because you’ll need to specify information about which tiers to include when you run it.

2. flibl_config.json

flibl_config.json is the file where you will put the information for flibl to use while processing your EAF. Open this file in a text editor. If you have a Mac, you can use TextEdit; on Windows, you can use Notepad; and on Linux you can use gedit. Those are just the default text editors though–feel free to use whatever you prefer if it’s not those. This kind of file, JSON, is used to define things in pairs of corresponding values as well as lists. When something is enclosed in {braces}, it is part of an object, i.e. something that will use corresponding value pairs called a key and value. For example:

{
    "my_favorite_food":"cheese"
}

When something is enclosed in [brackets], it is part of an array, i.e. a list of things. For example:

[
    "cheese",
    "apples"
]

They can also be nested:

{
    "my_favorite_foods":[
        "cheese",
        "apples"
    ]
}

The way flibl_config.json is structured is as follows:

3. flextext_construction

Assuming you know how to run a Python program: go into the FLExible directory where you downloaded this folder, then run the program! python flextext_construction_base-v03-0.py (or replace python with python3 if that’s your command for running Python 3.x)

Then, in FLEx, import the text. Click “FLExText Interlinear…”

The way to import a flextext into FLEx from the toolbar