Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngram settings bug #443

Open
musicnerd opened this issue Jan 24, 2017 · 0 comments
Open

ngram settings bug #443

musicnerd opened this issue Jan 24, 2017 · 0 comments

Comments

@musicnerd
Copy link
Collaborator

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]

@musicus musicus assigned musicnerd and unassigned musicnerd Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant