ELVIS-Project / vis-framework

Thoroughly modern symbolic musical data analysis suite.
http://elvisproject.ca/
31 stars 6 forks source link

'align' setting for new_ngram indexer. #402

Closed alexandermorgan closed 7 years ago

alexandermorgan commented 8 years ago

In our recent discussion on how to refactor the n-gram indexer (see issue #360) we proposed a couple of new ideas on how to handle n-grams better. The new_ngram indexer solved many of our problems but does not contain all the metadata about each n-gram that we may want. Practically speaking, the most useful piece of data about n-grams that we don't currently support is knowing when they finish. This is important because if you don't use the offset indexer there's no way of knowing how long or short the ngrams you have are. A new setting for the new_ngram indexer could solve this problem. An 'align' could default to 'left' (the current functionality) or beginning alignment meaning that the index value of each ngram would be the ngram onset point. 'right' could be another option wherein the onset of the last vertical slice of the n-gram is given. This would be useful if you are looking for cadential ngrams and you want to know when the last interval is arrived at (i.e. the arrival point of the cadence) rather than when the cadential approach began. Another setting could be 'end' which could be the next valid offset of the voice combination. This would tell you when the last event stops. By subtracting original 'left' value from this 'end' value, you would get the duration of an n-gram. We could even offer a multiindex for the index showing two or more of these values. This would be the first time that we use a multiindex for the index (as opposed to the columns) of a dataframe in VIS.

alexandermorgan commented 7 years ago

This new setting is present and tested for on alex_devel as of commit f603f28550324fa42e15c5589a920b480934777b.