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

adding tools to repo
author christopherh
date Mon, 06 May 2013 14:43:47 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/evaluationtools/indictionary.m	Mon May 06 14:43:47 2013 +0100
@@ -0,0 +1,56 @@
+%INDICTIONARY
+%found = indictionary(chord, dictionary, cardinality)
+
+
+
+function found = indictionary(chord, dictionary, comparison, cardinality)
+
+found = 0;
+
+switch lower(comparison)
+    case 'ov'
+        % pnset comparison used so inclusion should be calculated with
+        % rlsets
+        comp = 'oi';
+   
+    case 'op'
+        % pcset comparison used so inclusion should be calculated with
+        % rcsets
+        comp = 'or';
+ 
+    otherwise
+        % assume this is not a dictionary evaluation
+        found = 1;
+end
+
+if ~found 
+    
+    if isempty(dictionary)
+        found = 1; 
+    
+    else
+        
+        chordslength = length(dictionary);
+
+        chord = striproot(chord);
+
+
+        for indexc = 1:chordslength
+
+            %do a comparison of the current chord symbol and a member of the
+            %found list
+            [found, success, error] = comparechords2(chord, dictionary{indexc}, comp, cardinality,0);
+
+            if ~success
+                display(error)
+            end
+
+            % if found = 1
+            if found
+                % exit because the chord is in the dictionary
+                break;
+            end
+
+        end
+    end
+end
\ No newline at end of file