craigsapp / humlib

Humdrum data parsing library in C++
http://humlib.humdrum.org
BSD 2-Clause "Simplified" License
31 stars 8 forks source link

`tandeminfo` options `-u`, `-x`, and `--help` #99

Open bel28kent opened 2 months ago

bel28kent commented 2 months ago

Options u and x have the same specification. I think u should be something like "only print unknown interpretations".

Screen Shot 2024-08-18 at 12 51 08 PM

x should also be "show exclusive interpretation context" based on current behavior:

Screen Shot 2024-08-18 at 12 54 22 PM Screen Shot 2024-08-18 at 12 55 45 PM

I also notice when I use -h or --help that it is undefined. Does the library you're using employ a different option for documentation?

craigsapp commented 2 months ago

Thanks! I have updated the description of -u and -x (previously it was -X to remove exclusive interpretations, but I changed it to requiring -x to include exclusive interpretations.

For Humdrum Extras and humlib, the equivalent of -h in the Humdrum Toolkit is --options, somewhat terse:

c|count=b                                 show only unique list of interpretations with counts
d|description|m|meaning=b                 give description of tandem interpretation
f|filename=b                              show filename
h|header-only=b                           only process interpretations before first data line
H|body-only=b                             only process interpretations after first data line
l|location=b                              show location of interpretation in file (row, column)
n|sort-by-count=b                         sort entries by unique counts from low to high (when -c is used)
N|sort-by-reverse-count=b                 sort entries by unique counts from high to low (when -c is used)
s|sort=b                                  sort entries alphabetically by tandem interpretation
t|table=b                                 embed analysis withing input data
u|unknown-tandem-interpretations-only=b   only list unknown interpretations
x|exclusive-interpretations=b             show exclusive interpretation context
z|zero-indexed-locations=b                locations are 0-indexed
close=b                                   close <details> by default in HTML output

The format is:

option-name|option-alias|option-alias2=data-type:default-value          description

The first option name is typically a single letter option name, and there are also other long-form aliases for the short form. Then follows an equals sign followed by the data type letter: b for boolean, i for integer, d for double (floating-point), and s for string. Followed by an optional colon and the default value if the option is not used.

For boolean options, no arguments (operands) for the option are given, but the others requre an option of the given type: string, integer, or double. Single-letter options can be glued together (unless they are other than type boolean).

Otherwise, for Humdrum Extras commands, the format for more verbose documentation (if I wrote it :-), is https://extras.humdrum.org/man/command, while for humlib it is https://doc.verovio.humdrum.org/filter/command. I will create a draft for the tandeminfo filter documentation soon.

Today I created a VHV interface for tandeminfo, although it is misbehaving currently when I put it online, so I will have to do more debugging to see what the problem is.

There is a new -c option which is equivalent to uniq where only the unique interpretations are listed. But this is only implement in HTML output for VHV and not on the command-line yet. The -n option will sort the counts from low to high, and -N will sort from high to low.

craigsapp commented 2 months ago

I also changed -m for meaning to -d for description, but left -m as an alias option, so both can be used.

craigsapp commented 2 months ago

Example of tandeminfo running as a filter in VHV:

https://verovio.humdrum.org/?file=poly/R308B_Fal-w6p111h10m1-7.krn&filter=tandeminfo%20-cN

Screenshot 2024-08-18 at 4 14 54 PM

Unkown interpretation meanings are highlighted in red:

Screenshot 2024-08-18 at 4 15 30 PM

And you can click on a row in the list to move the cursor in the text to that tandem interpretations (when using -c, only one of the duplicate interpretations will be accessible by clicking).