Skip to content

donaldsoncd/tsv-to-md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tsv-to-md

A python script to convert a tab-separated value (tsv) file of an aligned parallel text to a markdown text file in a prose-like format.

It is the counterpart to md-to-tsv, which converts in the opposite direction.

Instructions

  • Download the python script to-md.py

  • Place it in the folder along with the TSV file that you would like to convert to a markdown file.

  • Open your terminal and navigate to the folder where the script and your file are

  • Run the script by typing in python to-md.py PLUS the name of your file.

    All together, this means you type something like this, for example:

    python to_md.py manuscript.tsv

Formatting specifications

Input file notes:

  • The input file must be a tab-separated value file
  • The first row must be a series of headers (e.g., ID --> Arabic --> Soninke --> English)
  • The first column must be identifiers for the segments
  • The TSV can have as many columns as you want

Output file notes:

  • Identifiers become level three markdown headers via three hashtag marks (###)
  • Language segments become markdown paragraphs (that is, with an empty line between them)

Ajami Lab Use

This script was designed in the context of the Ajami Lab to facilitate the conversion of Ajami annotation data extracted from a Tropy project into a format conducive to prose-like publication (as a critical edition style chapter, appendix, etc).

Once a TSV is put into markdown format, it can easily be edited further using pandoc flavored markdown that allows for footnotes, etc., and then easily exported as a static html page or common word-processing file for Word, LibreOffice, etc.

From this perspective, the Tropy project is the single or master "source code" for export to other formats (tabular or text) designed for further analysis or publication.

Screenshots

Go from something like this:

tabbedo

To this:

prose

About

Program to convert a tsv to a markdown txt file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages