Ok here is the deal: I am working on an endangered language project. The data is contained in a MySQL database. I can run a query to produce a hierarchy, but the hierarchy is difficult for humans to read.
See the MySQL query output here:
"Body Parts",NULL,"Human","Kopf",NULL,NULL "Clothing","flechten",NULL,NULL,NULL,NULL "Numbers","zwei",NULL,NULL,NULL,NULL "Body Parts",NULL,"Human","Haar",NULL,NULL "Body Parts",NULL,"Human","Auge",NULL,NULL
The structure of the CSV output is as follows, but the tree is arbitrarily large:
FOLDER, LEXEME, SUBFOLDER, LEXEME, SUBSUBFOLDER, LEXEME
The nodes function much like folders on a filesystem. They contain both folders and files (the lexemes/words). For the example output below, I will make folders bold and lexemes italicized. This would also be good to have in the latex output, in order to differentiate between lexemes and folders (categories).
I would like the output to be ordered alphabetically (although I might be able to do work that into my query, but it would still be nice to have). Keep in mind there could be lexemes and folders inside every folder:
Visually Pleasing Tree:
- Body Parts
I should mention that I am using
UTF-8 encoding and compiling with
fontspec. This is a project dealing with phonetics, therefore the IPA will be used.
I spent the last hour on the following Python script, which should give an overview how to tackle this problem.
I use SQLite, I could get Python to connect to my MySQL server. I just retrieve each row and check, if the corresponding column is "None" (strangely SQLite does not return NULL) and use
easylist's simple list setup to avoid all the
In your case this will be a bit more complicated as e.g. you need to select all the items below 'Human'. One way could be to sort the result set after all columns, then you'd have to check at each row if the last row contained an item at this level with the same name and omit this.
It is solveable however takes a lot of time & brain...