Python script to convert backslash codes to tabbed text

Sophia Gilman is a Yale student who’s been working on my NSF Pama-Nyungan project this year. One of the things she’s been working on is a script to convert irregularly ordered backslash codes to a tabbed text file (for further import into database programs). The script takes the backslash file, detects the headword code, asks you a bunch of questions about it, and sets up a file with each backslash code as a column in a table.

The script was developed specifically for our project and its needs, but it’s flexible enough that it might be useful for others too. We’re making the script available for free, but it’s Sophia’s work, and she (and the NSF project BCS-844550) should be acknowledged if you use the script in work that results in publications.

A couple of notes on the script:

  • It’s a python script. You need to have python installed on your computer to run it. If you don’t have python and you have backslash coded files for Australian languages that you would like to convert, we can help. If you’re working on another area, though, I’m afraid we can’t provide any support for script use.
  • SIL’s MDF (Toolbox) standard codes are hard-coded into the program.
  • Some features are specific to the needs of my NSF project and may be irritating to others:
  • Subentries are converted to main entries. The program makes some effort to treat material appropriate to the entry as a whole as belong to each newly created record.
  • Multiple glosses are converted to multiple records.
  • Examples are not split into multiple table columns; they are grouped into a single column.

The script is available here. If you modify it for your own use, we’d appreciate a copy.

5 responses to “Python script to convert backslash codes to tabbed text

  1. James Crippen

    I get a 404 on that link.

  2. It’s working now.

  3. I searched “sil toolbox backslash codes” and your blog post is the first entry. Nice. Will take a look at this later, btw. It sounds very useful.

  4. Do I need Python 2 or 3 for this?

  5. I use 2.7 Not sure if it works with 3.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s