[Tomoe-cvs 1180] CVS update: tomoe/recognizer

Zurück zum Archiv-Index

Kouhei Sutou kous****@users*****
2006年 11月 27日 (月) 17:52:01 JST


Index: tomoe/recognizer/Makefile.am
diff -u tomoe/recognizer/Makefile.am:1.2 tomoe/recognizer/Makefile.am:1.3
--- tomoe/recognizer/Makefile.am:1.2	Fri Nov 17 10:50:25 2006
+++ tomoe/recognizer/Makefile.am	Mon Nov 27 17:52:01 2006
@@ -21,6 +21,7 @@
 CLEANFILES = *~ *.bak
 
 AM_CPPFLAGS =							\
+	-DG_LOG_DOMAIN=\"TOMOE-RECOGNIZER\"			\
 	-DSYSCONFDIR=\""$(sysconfdir)"\"			\
 	-DDATADIR=\""$(datadir)"\"				\
 	-DTOMOESYSCONFDIR=\""$(sysconfdir)/$(PACKAGE)"\"	\
Index: tomoe/recognizer/tomoe-recognizer-simple-logic.c
diff -u tomoe/recognizer/tomoe-recognizer-simple-logic.c:1.31 tomoe/recognizer/tomoe-recognizer-simple-logic.c:1.32
--- tomoe/recognizer/tomoe-recognizer-simple-logic.c:1.31	Mon Nov 27 17:30:05 2006
+++ tomoe/recognizer/tomoe-recognizer-simple-logic.c	Mon Nov 27 17:52:01 2006
@@ -17,7 +17,7 @@
  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  *  Boston, MA  02111-1307  USA
  *
- *  $Id: tomoe-recognizer-simple-logic.c,v 1.31 2006/11/27 08:30:05 kous Exp $
+ *  $Id: tomoe-recognizer-simple-logic.c,v 1.32 2006/11/27 08:52:01 kous Exp $
  */
 
 #include <stdlib.h>
@@ -78,8 +78,7 @@
     GPtrArray *matches = NULL;
     GPtrArray *cands = NULL;
     GPtrArray *first_cands = NULL;
-    guint letters_num = 0;
-    const GPtrArray *letters = NULL;
+    GList *target_chars, *node;
     const GList *input_strokes, *list;
     guint input_stroke_num, i, j;
     TomoeWriting *sparse_writing;
@@ -87,33 +86,22 @@
     g_return_val_if_fail (input, NULL);
     g_return_val_if_fail (dict, NULL);
 
-    letters = tomoe_dict_get_letters(dict);
-    g_return_val_if_fail (letters, NULL);
-
     sparse_writing = create_sparse_writing (input);
     input_stroke_num = tomoe_writing_get_number_of_strokes (sparse_writing);
     g_return_val_if_fail (input_stroke_num > 0, NULL);
 
-    first_cands = g_ptr_array_new ();
-    letters_num = letters->len;
-
-    for (i = 0; i < letters_num; i++) {
-        TomoeChar *p = (TomoeChar *) g_ptr_array_index (letters, i);
-        TomoeWriting *writing;
-        cand_priv *cand = NULL;
-
-        /* check for available writing data */
-        writing = tomoe_char_get_writing (p);
-        if (!writing) continue;
-
-        /* check the number of stroke */
-        if (input_stroke_num > tomoe_writing_get_number_of_strokes (writing))
-            continue;
+    target_chars = tomoe_dict_search_by_n_strokes (dict, input_stroke_num, -1);
+    if (!target_chars) return NULL;
 
-        /* append a candidate to candidate list */
-        cand = cand_priv_new (p);
+    first_cands = g_ptr_array_new ();
+    for (node = target_chars; node; node = g_list_next (node)) {
+        TomoeCandidate *candidate = node->data;
+        cand_priv *cand;
+        cand = cand_priv_new (tomoe_candidate_get_character (candidate));
         g_ptr_array_add (first_cands, cand);
+        g_object_unref (candidate);
     }
+    g_list_free (target_chars);
 
     input_strokes = tomoe_writing_get_strokes (sparse_writing);
 


tomoe-cvs メーリングリストの案内
Zurück zum Archiv-Index