summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2014-07-30 04:18:47 -0700
committerJohn Hawthorn <john.hawthorn@gmail.com>2014-07-30 10:25:21 -0700
commitdeee6d505299c0504dd6b40cf2669b18068d3c95 (patch)
tree84e234e5648d23ffac78821dd044a42380cf7c1a /match.c
parentb76c67f554085652e4128e2ea8e85f24fd26ba17 (diff)
Lesser penalty for leading and trailing gaps
Diffstat (limited to 'match.c')
-rw-r--r--match.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/match.c b/match.c
index eb4cb72..b815c8f 100644
--- a/match.c
+++ b/match.c
@@ -29,9 +29,9 @@ void mat_print(score_t *mat, int n, int m){
for(j = 0; j < m; j++){
score_t val = mat[i*m + j];
if(val == SCORE_MIN){
- fprintf(stderr, " -inf");
+ fprintf(stderr, " -inf");
}else{
- fprintf(stderr, " %.2f", val);
+ fprintf(stderr, " % .2f", val);
}
}
fprintf(stderr, "\n");
@@ -65,8 +65,8 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio
* M[][] Stores the best possible score at this position.
*/
-#define SCORE_GAP_LEADING -0.01
-#define SCORE_GAP_TRAILING -0.01
+#define SCORE_GAP_LEADING -0.005
+#define SCORE_GAP_TRAILING -0.005
#define SCORE_GAP_INNER -0.01
#define SCORE_MATCH_CONSECUTIVE 1.0
#define SCORE_MATCH_SLASH 1.5
@@ -129,8 +129,10 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio
}
#if 0
+ printf("\"%s\" =~ \"%s\"\n", needle, haystack);
mat_print(&D[0][0], n, m);
mat_print(&M[0][0], n, m);
+ printf("\n");
#endif
/* backtrace to find the positions of optimal matching */