annotate evaluationtools/indictionary.m @ 1:8973548174c1 tip

adding tools to repo
author christopherh
date Mon, 06 May 2013 14:43:47 +0100
parents
children
rev   line source
christopherh@1 1 %INDICTIONARY
christopherh@1 2 %found = indictionary(chord, dictionary, cardinality)
christopherh@1 3
christopherh@1 4
christopherh@1 5
christopherh@1 6 function found = indictionary(chord, dictionary, comparison, cardinality)
christopherh@1 7
christopherh@1 8 found = 0;
christopherh@1 9
christopherh@1 10 switch lower(comparison)
christopherh@1 11 case 'ov'
christopherh@1 12 % pnset comparison used so inclusion should be calculated with
christopherh@1 13 % rlsets
christopherh@1 14 comp = 'oi';
christopherh@1 15
christopherh@1 16 case 'op'
christopherh@1 17 % pcset comparison used so inclusion should be calculated with
christopherh@1 18 % rcsets
christopherh@1 19 comp = 'or';
christopherh@1 20
christopherh@1 21 otherwise
christopherh@1 22 % assume this is not a dictionary evaluation
christopherh@1 23 found = 1;
christopherh@1 24 end
christopherh@1 25
christopherh@1 26 if ~found
christopherh@1 27
christopherh@1 28 if isempty(dictionary)
christopherh@1 29 found = 1;
christopherh@1 30
christopherh@1 31 else
christopherh@1 32
christopherh@1 33 chordslength = length(dictionary);
christopherh@1 34
christopherh@1 35 chord = striproot(chord);
christopherh@1 36
christopherh@1 37
christopherh@1 38 for indexc = 1:chordslength
christopherh@1 39
christopherh@1 40 %do a comparison of the current chord symbol and a member of the
christopherh@1 41 %found list
christopherh@1 42 [found, success, error] = comparechords2(chord, dictionary{indexc}, comp, cardinality,0);
christopherh@1 43
christopherh@1 44 if ~success
christopherh@1 45 display(error)
christopherh@1 46 end
christopherh@1 47
christopherh@1 48 % if found = 1
christopherh@1 49 if found
christopherh@1 50 % exit because the chord is in the dictionary
christopherh@1 51 break;
christopherh@1 52 end
christopherh@1 53
christopherh@1 54 end
christopherh@1 55 end
christopherh@1 56 end