(concord_opened_feature_list_limit): Changed to 640.
authorMORIOKA Tomohiko <tomo.git@chise.org>
Sat, 25 May 2013 06:43:56 +0000 (15:43 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Sat, 25 May 2013 06:43:56 +0000 (15:43 +0900)
(concord_tenure_feature_list): New variable.
(concord_tenure_feature_list_last): New variable.
(concord_tenure_feature_list_length): New variable.
(concord_genre_open_feature): Initialize `table->number_of_hits'.
(concord_feature_setup_db): Use `concord_tenure_feature_list' for hit
features.

concord.c

index 4e220e9..4dd37ec 100644 (file)
--- a/concord.c
+++ b/concord.c
 COS_Feature concord_opened_feature_list = NULL;
 COS_Feature concord_opened_feature_list_last = NULL;
 size_t concord_opened_feature_list_length = 0;
-size_t concord_opened_feature_list_limit = 96;
+size_t concord_opened_feature_list_limit = 640 /* 480 */;
+
+COS_Feature concord_tenure_feature_list = NULL;
+COS_Feature concord_tenure_feature_list_last = NULL;
+size_t concord_tenure_feature_list_length = 0;
 
 COS_Feature_INDEX concord_opened_index_list = NULL;
 COS_Feature_INDEX concord_opened_index_list_last = NULL;
@@ -557,6 +561,10 @@ concord_genre_open_feature (CONCORD_Genre genre, const char* feature)
   strcpy (table->name, feature);
   table->value_table = NULL;
   table->next = NULL;
+  table->number_of_hits = 0;
+#if 0
+  table->number_of_closes = 0;
+#endif
   return table;
 }
 
@@ -629,10 +637,48 @@ concord_feature_setup_db (CONCORD_Feature feature, int writable)
        {
          CONCORD_Feature top_feature = concord_opened_feature_list;
 
-         CONCORD_BDB_close (top_feature->db);
-         top_feature->db = NULL;
          concord_opened_feature_list = top_feature->next;
-         top_feature->next = NULL;
+         if ( top_feature->number_of_hits >= 1 )
+           {
+             if ( concord_tenure_feature_list == NULL )
+               {
+                 concord_tenure_feature_list = top_feature;
+                 concord_tenure_feature_list_last = top_feature;
+               }
+             else
+               {
+                 concord_tenure_feature_list_last->next = feature;
+                 concord_tenure_feature_list_last = feature;
+               }
+             concord_tenure_feature_list_length++;
+             top_feature->next = NULL;
+#if 0
+             printf ("<<%02d: feature `%s' (%d hits, %d closes) was changed to tenure>>\n",
+                     concord_tenure_feature_list_length,
+                     top_feature->name,
+                     top_feature->number_of_hits,
+                     top_feature->number_of_closes);
+#endif
+           }
+         else
+           {
+#if 0
+             if ( (top_feature->number_of_closes >= 2048) &&
+                  (top_feature->number_of_hits >= 0) )
+               printf ("{{%02d: close feature `%s' (%d hits, %d closes)}}\n",
+                       concord_opened_feature_list_length,
+                       top_feature->name,
+                       top_feature->number_of_hits,
+                       top_feature->number_of_closes);
+#endif
+             CONCORD_BDB_close (top_feature->db);
+             top_feature->db = NULL;
+             top_feature->next = NULL;
+             top_feature->number_of_hits = 0;
+#if 0
+             top_feature->number_of_closes++;
+#endif
+           }
          concord_opened_feature_list_length--;
        }
       feature->db
@@ -655,6 +701,10 @@ concord_feature_setup_db (CONCORD_Feature feature, int writable)
        }
       concord_opened_feature_list_length++;
     }
+  else
+    {
+      feature->number_of_hits++;
+    }
   return 0;
 }