Backend for songs.zachdecook.com
* Make chordline detection more discerning
Zach DeCook 2018-04-15
parent 82837c9 · commit d9fe293
-rw-r--r--page.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/page.php b/page.php
index 6367001..47f39d3 100644
--- a/page.php
+++ b/page.php
@@ -274,13 +274,14 @@ function chordline($line)
$badtokens = 0;
$ambtokens = 0;
+ $goodtokens = 0;
foreach ($tokens as $token) {
- if( in_array( substr($token, 0,2), $chords ) ) return TRUE;
+ if( in_array( substr($token, 0,2), $chords ) ) $goodtokens++;
else if ( in_array( substr( $token, 0,2), $ambiguous) ) $ambtokens++;
else if( $badtokens > 10 ) return FALSE;
else $badtokens++;
}
- return $ambtokens >= $badtokens;
+ return ($goodtokens *2)+ $ambtokens >= $badtokens;
}
function normalizechords($line, $space=TRUE)