More progress in preparing for DH
Posted by mholmes on 01 Jun 2010 in Activity log
Today I've written the bash script I'm going to be using to create arrays of data points to compare ShingleCloud with USM. This is what it does right now:
- Reads some template files from disk, to assist in building two kinds of output: an XHTML page with tabular data, and a spreadsheet in FODS (Flat Open Document Spreadsheet) format, for use in OOo Calc.
- Reads the test data in from a text file. Right now, the file contains all the test data, with one pair of text items on each line, separated by a slash. This may be quite sufficient, since I don't anticipate running tests with items larger than paragraphs, but it would also be feasible to read in a list of filenames from which to retrieve larger bits of data.
- Calls USM on each bit of the test data and retrieves the scores.
- Calls ShingleCloud twice, once with --containmentneedle and once with --containmenthaystack, and then averages their scores. With ShingleCloud, these two scores can be radically different, so averaging them is one crude approach to creating a single similarity measure. I've written to AM to ask if he uses anything more sophisticated in TEIComparator.
- Creates an XHTML document showing the input data and the results in a table.
- Creates a FODS document with the data in a table.
- Opens the XHTML file in Firefox, and the FODS file in OOo Calc.
Learned a few things I didn't know out of this process. For instance, bash can't do floating-point math (call awk instead); a FODS file is much easier to create than a full-scale Open Document file (it's just a single flat XML file); and this is how you call an external application from a bash script and return immediately, without getting your shell session hijacked by errors from the external application: `soffice -calc -nologo $FODSFILE 2>/dev/null` &