ELVIS-Project / vis-framework

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

Datatype of indexers in metre.py is float. #386

Closed alexandermorgan closed 8 years ago

alexandermorgan commented 8 years ago

The three indexers in metre.py (duration, notebeatstrength, and measure) all return data frames with float or integer values. These are the only indexers that do this. The new_gram indexer requires all data to be strings. If we want to support a variety of n-gram types (i.e. n-grams that include duration, beat strength, etc.) then we need this datatype to be a string. There are two basic ways of solving this problem:

  1. Make all the metre indexers output their values as strings
  2. Make the new_ngram indexer check the datatype of passed data frames and convert them to strings if necessary.

Both would be easy but my vote is for the first one since we never used the data as numbers. It doesn't even make sense to use beat strength data as number in many cases (i.e. you never add beat strengths together, though you do admittedly compare them).

alexandermorgan commented 8 years ago

This is actually more of an issue with the ngram indexer, so I fixed the problem there with this commit to alex_devel: d0fd9ecff7a3f6eda42bbf7da3ee0377d7b63359 I changed the way new_ngram works because @mrbannon mentioned that he wants users to be able to pass any dataframe to an indexer, not just dataframes that were produced by VIS. If that happens, we won't be able to be sure that only dataframes with string-type values are used in the ngram indexer, even if we changed the type of the metre.py indexers to strings. If we wanted the indexers in metre.py to be strings anyway, we could still do that but now I don't see the point.