ELVIS-Project / vis-framework

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

ngram settings bug #443

Open musicnerd opened 7 years ago

musicnerd commented 7 years ago

In the ngram indexer, at present only the 'vertical' setting allows 'all' as input, despite that in the examples in the documentation it implies that 'all' could also be passed as an argument to the 'horizontal' setting (see lines 296-298).

The larger bug within this bug is that the horizontal arguments at present only allow 'upper' or 'lower' but cannot be both. Even if you manually type in a list of the necessary horizontal arguments, the ngrams can only be properly calculated for one column of data (i.e. one vertical setting or pair of voices). If you try to pass it multiple columns in the 'vertical' setting and then calculate both the upper and lower horizontal intervals by manually passing a list, it outputs the ngrams incorrectly (see code below for clarification.)

Code for single column, which calculates both sets of melodic intervals in the ngram:

ngram_settings = { 'n': 2, 'vertical': [('0,1',)], 'horizontal': [('0','1',)], 'brackets': True } ng = my_score.get_data('ngram', data=[hint, mint], settings=ngram_settings)

ng.head() Indexer ngram.NGramIndexer Parts 0,1 : 0 1 0.0 [Rest] ( P4) [Rest] 4.0 [Rest] (Rest ) [P1] 8.0 [P1] ( -M2) [M2] 10.0 [M2] ( -m2) [m3] 12.0 [m3] (_ -M2) [P4]

Code for multiple columns, which outputs the following:

ngram_settings = { 'n': 2, 'vertical': [('0,1','0,3')], 'horizontal': [('0','1','0','3')], 'brackets': True }

ng.head() Indexer ngram.NGramIndexer Parts 0,1 0,3 : 0 1 0 3 0.0 [Rest Rest] ( P4 ) [Rest Rest] 4.0 [Rest Rest] (Rest Rest ) [P1 Rest] 8.0 [P1 Rest] ( -M2 ) [M2 Rest] 10.0 [M2 Rest] ( -m2 Rest) [m3 P8] 12.0 [m3 P8] ( -M2 _) [P4 P8]