You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
(58) |
May
(28) |
Jun
(308) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(3) |
Nov
(4) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(4) |
Feb
(8) |
Mar
(3) |
Apr
(3) |
May
(8) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
(2) |
26
(1) |
27
|
28
|
29
|
30
|
31
|
|
|
|
|
|
From: <ma...@us...> - 2008-03-26 02:18:26
|
Revision: 1594 http://tomoe.svn.sourceforge.net/tomoe/?rev=1594&view=rev Author: makeinu Date: 2008-03-25 19:18:17 -0700 (Tue, 25 Mar 2008) Log Message: ----------- Reverse search order. Modified Paths: -------------- tomoe/trunk/ChangeLog tomoe/trunk/module/dict/tomoe-unihan.c Modified: tomoe/trunk/ChangeLog =================================================================== --- tomoe/trunk/ChangeLog 2008-03-25 10:43:05 UTC (rev 1593) +++ tomoe/trunk/ChangeLog 2008-03-26 02:18:17 UTC (rev 1594) @@ -1,3 +1,7 @@ +2008-03-26 Takuro Ashie <as...@ho...> + + * module/dict/tomoe-unihan.c: Reverse search order. + 2008-03-25 Takuro Ashie <as...@ho...> * module/recognizer/tomoe-recognizer-simple.c Modified: tomoe/trunk/module/dict/tomoe-unihan.c =================================================================== --- tomoe/trunk/module/dict/tomoe-unihan.c 2008-03-25 10:43:05 UTC (rev 1593) +++ tomoe/trunk/module/dict/tomoe-unihan.c 2008-03-26 02:18:17 UTC (rev 1594) @@ -201,15 +201,15 @@ _tomoe_unihan_search (TomoeQuery *query) { GList *list = NULL; - guint i; + gint i; if (tomoe_query_is_empty (query)) { - for (i = 0; i < G_N_ELEMENTS(unihan_array); i++) + for (i = (gint) G_N_ELEMENTS(unihan_array) - 1; i >= 0; i--) collect_all_chars(unihan_array[i].get (), unihan_array[i].size (), &list); } else { - for (i = 0; i < G_N_ELEMENTS(unihan_array); i++) + for (i = (gint) G_N_ELEMENTS(unihan_array) - 1; i >= 0; i--) collect_chars_by_query(unihan_array[i].get (), unihan_array[i].size (), query, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2008-03-25 10:43:02
|
Revision: 1593 http://tomoe.svn.sourceforge.net/tomoe/?rev=1593&view=rev Author: makeinu Date: 2008-03-25 03:43:05 -0700 (Tue, 25 Mar 2008) Log Message: ----------- Make binary dictionary as default for handwriting recognition. Modified Paths: -------------- tomoe/trunk/ChangeLog tomoe/trunk/module/recognizer/tomoe-recognizer-simple.c Modified: tomoe/trunk/ChangeLog =================================================================== --- tomoe/trunk/ChangeLog 2008-03-25 10:09:58 UTC (rev 1592) +++ tomoe/trunk/ChangeLog 2008-03-25 10:43:05 UTC (rev 1593) @@ -1,5 +1,17 @@ 2008-03-25 Takuro Ashie <as...@ho...> + * module/recognizer/tomoe-recognizer-simple.c + I'll make binary dictionary as default handwriting dictionary. + If you have any objections, please show me alternative codes. + + TODO: + - C version of converter to build it without ruby. + - Install binary dictionaries to system wide directory. + - Fall back to XML dictionary if no binary dictionary exists. + - Add properties not only writings but also others (if possible). + +2008-03-25 Takuro Ashie <as...@ho...> + * module/dict/tomoe-unihan.[ch], module/dict/tomoe-dict-unihan.c: Reduce heavy, very heavy wasted memories. It's not completed yet but already works with tomoe-gtk. Modified: tomoe/trunk/module/recognizer/tomoe-recognizer-simple.c =================================================================== --- tomoe/trunk/module/recognizer/tomoe-recognizer-simple.c 2008-03-25 10:09:58 UTC (rev 1592) +++ tomoe/trunk/module/recognizer/tomoe-recognizer-simple.c 2008-03-25 10:43:05 UTC (rev 1593) @@ -186,12 +186,12 @@ language = tomoe_recognizer_get_language (TOMOE_RECOGNIZER (object)); if (language) - dict_name = g_strconcat ("handwriting-", language, ".xml", NULL); + dict_name = g_strconcat ("handwriting-", language, ".bin", NULL); else - dict_name = g_strdup ("handwriting.xml"); + dict_name = g_strdup ("handwriting.bin"); filename = g_build_filename (RECOGNIZER_DATADIR, dict_name, NULL); - recognizer->dict = tomoe_dict_new ("xml", + recognizer->dict = tomoe_dict_new ("binary", "filename", filename, NULL); if (recognizer->dict && !tomoe_dict_is_available (recognizer->dict)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2008-03-25 10:09:54
|
Revision: 1592 http://tomoe.svn.sourceforge.net/tomoe/?rev=1592&view=rev Author: makeinu Date: 2008-03-25 03:09:58 -0700 (Tue, 25 Mar 2008) Log Message: ----------- Reduce heavy wasted memories. Modified Paths: -------------- tomoe/trunk/ChangeLog tomoe/trunk/module/dict/tomoe-dict-unihan.c tomoe/trunk/module/dict/tomoe-unihan.c tomoe/trunk/module/dict/tomoe-unihan.h Modified: tomoe/trunk/ChangeLog =================================================================== --- tomoe/trunk/ChangeLog 2008-02-15 12:59:03 UTC (rev 1591) +++ tomoe/trunk/ChangeLog 2008-03-25 10:09:58 UTC (rev 1592) @@ -1,3 +1,9 @@ +2008-03-25 Takuro Ashie <as...@ho...> + + * module/dict/tomoe-unihan.[ch], module/dict/tomoe-dict-unihan.c: + Reduce heavy, very heavy wasted memories. + It's not completed yet but already works with tomoe-gtk. + 2008-02-15 Kouhei Sutou <ko...@co...> * test/tomoe-test-utils.rb: added benchmark related paths. Modified: tomoe/trunk/module/dict/tomoe-dict-unihan.c =================================================================== --- tomoe/trunk/module/dict/tomoe-dict-unihan.c 2008-02-15 12:59:03 UTC (rev 1591) +++ tomoe/trunk/module/dict/tomoe-dict-unihan.c 2008-03-25 10:09:58 UTC (rev 1592) @@ -38,7 +38,6 @@ #include <glib-utils.h> #include "tomoe-unihan.h" -#include "tomoe-dict-ptr-array.h" #define TOMOE_TYPE_DICT_UNIHAN tomoe_type_dict_unihan #define TOMOE_DICT_UNIHAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOMOE_TYPE_DICT_UNIHAN, TomoeDictUnihan)) @@ -58,17 +57,17 @@ typedef struct _TomoeDictUnihanClass TomoeDictUnihanClass; struct _TomoeDictUnihan { - TomoeDictPtrArray object; - gchar *name; + TomoeDict object; + gchar *name; }; struct _TomoeDictUnihanClass { - TomoeDictPtrArrayClass parent_class; + TomoeDictClass parent_class; }; static GType tomoe_type_dict_unihan = 0; -static TomoeDictPtrArray *parent_class; +static TomoeDict *parent_class; static TomoeDictUnihan *the_singleton = NULL; static GObject *constructor (GType type, @@ -89,6 +88,17 @@ static gboolean is_available (TomoeDict *dict); static gchar *get_available_private_utf8 (TomoeDict *dict); +static gboolean register_char (TomoeDict *dict, + TomoeChar *chr); +static gboolean unregister_char (TomoeDict *dict, + const gchar *utf8); +static TomoeChar *get_char (TomoeDict *dict, + const gchar *utf8); +static GList *search (TomoeDict *dict, + TomoeQuery *query); +static gboolean copy (TomoeDict *src_dict, + TomoeDict *dest_dict); + static void class_init (TomoeDictUnihanClass *klass) { @@ -106,6 +116,13 @@ dict_class = TOMOE_DICT_CLASS (klass); dict_class->get_name = get_name; +#if 1 + dict_class->register_char = register_char; + dict_class->unregister_char = unregister_char; + dict_class->get_char = get_char; + dict_class->search = search; + dict_class->copy = copy; +#endif dict_class->flush = flush; dict_class->is_editable = is_editable; dict_class->is_available = is_available; @@ -145,7 +162,7 @@ }; tomoe_type_dict_unihan = g_type_module_register_type (type_module, - TOMOE_TYPE_DICT_PTR_ARRAY, + TOMOE_TYPE_DICT, "TomoeDictUnihan", &info, 0); } @@ -189,12 +206,8 @@ GObjectClass *klass = G_OBJECT_CLASS (parent_class); if (!the_singleton) { - GPtrArray *chars; object = klass->constructor (type, n_props, props); the_singleton = TOMOE_DICT_UNIHAN (object); - - chars = tomoe_dict_ptr_array_get_array (TOMOE_DICT_PTR_ARRAY (object)); - _tomoe_unihan_create (chars); } else { object = g_object_ref (G_OBJECT (the_singleton)); } @@ -288,6 +301,44 @@ return NULL; } + +static gboolean +register_char (TomoeDict *dict, TomoeChar *chr) +{ + /* FIXME: need? */ + return FALSE; +} + +static gboolean +unregister_char (TomoeDict *dict, const gchar *utf8) +{ + /* FIXME: need? */ + return FALSE; +} + +static TomoeChar * +get_char (TomoeDict *dict, const gchar *utf8) +{ + g_return_val_if_fail (TOMOE_IS_DICT (dict), NULL); + + return _tomoe_unihan_get_char (utf8); +} + +static GList * +search (TomoeDict *dict, TomoeQuery *query) +{ + g_return_val_if_fail (TOMOE_IS_DICT (dict), NULL); + + return _tomoe_unihan_search (query); +} + +static gboolean +copy (TomoeDict *src_dict, TomoeDict *dest_dict) +{ + /* FIXME */ + return FALSE; +} + /* vi:ts=4:nowrap:ai:expandtab */ Modified: tomoe/trunk/module/dict/tomoe-unihan.c =================================================================== --- tomoe/trunk/module/dict/tomoe-unihan.c 2008-02-15 12:59:03 UTC (rev 1591) +++ tomoe/trunk/module/dict/tomoe-unihan.c 2008-03-25 10:09:58 UTC (rev 1592) @@ -6,122 +6,214 @@ */ +#include <tomoe-candidate.h> #include "tomoe-unihan.h" #include "tomoe-unihan-data.h" -static gint -_tomoe_unihan_append_infos (GPtrArray *array, TomoeUnihanInfo *infos, - gint infos_size, gint offset) +static struct UnihanArray { + TomoeUnihanInfo *(*get) (void); + gint (*size) (void); +} unihan_array[] = { + { _tomoe_unihan_data0, _tomoe_unihan_data0_size}, + { _tomoe_unihan_data1, _tomoe_unihan_data1_size}, + { _tomoe_unihan_data2, _tomoe_unihan_data2_size}, + { _tomoe_unihan_data3, _tomoe_unihan_data3_size}, + { _tomoe_unihan_data4, _tomoe_unihan_data4_size}, + { _tomoe_unihan_data5, _tomoe_unihan_data5_size}, + { _tomoe_unihan_data6, _tomoe_unihan_data6_size}, + { _tomoe_unihan_data7, _tomoe_unihan_data7_size}, + { _tomoe_unihan_data8, _tomoe_unihan_data8_size}, + { _tomoe_unihan_data9, _tomoe_unihan_data9_size}, +}; + +static TomoeChar * +_tomoe_char_from_unihan (TomoeUnihanInfo *info) { - gint i; + TomoeChar *chr; + gint j, len; - for (i = 0; i < infos_size; i++) { - TomoeUnihanInfo info; - TomoeChar *chr; - gint j, len; + g_return_val_if_fail(info, NULL); - info = infos[i]; + chr = tomoe_char_new (); + tomoe_char_set_utf8 (chr, info->utf8); - chr = tomoe_char_new (); - tomoe_char_set_utf8 (chr, info.utf8); + if (info->n_strokes) + tomoe_char_set_n_strokes (chr, info->n_strokes); - if (info.n_strokes) - tomoe_char_set_n_strokes (chr, info.n_strokes); + len = info->readings_size; + for (j = 0; j < len; j++) { + TomoeReading *reading; + TomoeUnihanReading *reading_info; - len = info.readings_size; - for (j = 0; j < len; j++) { - TomoeReading *reading; - TomoeUnihanReading reading_info; + reading_info = &info->readings[j]; + reading = tomoe_reading_new (reading_info->type, + reading_info->reading); + tomoe_char_add_reading (chr, reading); + g_object_unref (reading); + } - reading_info = info.readings[j]; - reading = tomoe_reading_new (reading_info.type, - reading_info.reading); - tomoe_char_add_reading (chr, reading); - g_object_unref (reading); - } + len = info->radicals_size; + for (j = 0; j < len; j++) { + tomoe_char_add_radical (chr, info->radicals[j]); + } - len = info.radicals_size; - for (j = 0; j < len; j++) { - tomoe_char_add_radical (chr, info.radicals[j]); - } + len = info->variants_size; + for (j = 0; j < len; j++) { + tomoe_char_set_variant (chr, info->variants[j]); + } - len = info.variants_size; - for (j = 0; j < len; j++) { - tomoe_char_set_variant (chr, info.variants[j]); - } + len = info->meta_data_size; + for (j = 0; j < len; j++) { + TomoeUnihanMetaData meta_data; - len = info.meta_data_size; - for (j = 0; j < len; j++) { - TomoeUnihanMetaData meta_data; + meta_data = info->meta_data[j]; + tomoe_char_register_meta_data (chr, meta_data.key, meta_data.value); + } - meta_data = info.meta_data[j]; - tomoe_char_register_meta_data (chr, meta_data.key, meta_data.value); + return chr; +} + +static gboolean +does_match_char_with_utf8 (TomoeUnihanInfo *info, const gchar *utf8) +{ + if (!utf8) + return TRUE; + + return g_utf8_collate (info->utf8, utf8) == 0; +} + +static gboolean +does_match_char_with_n_strokes (TomoeUnihanInfo *info, gint min, gint max) +{ + gint n_strokes; + + if (min < 0 && max < 0) + return TRUE; + + n_strokes = info->n_strokes; + if (n_strokes < 0) + return FALSE; + + return ((min < 0 || min <= n_strokes) && + (max < 0 || max >= n_strokes)); +} + +static gboolean +does_match_char_with_reading (TomoeUnihanInfo *info, TomoeReading *reading) +{ + TomoeReadingType type; + gint j; + + if (!reading) + return TRUE; + if (!tomoe_reading_get_reading (reading)) + return TRUE; + + type = tomoe_reading_get_reading_type (reading); + + for (j = 0; j < info->readings_size; j++) { + TomoeUnihanReading *reading_info; + + reading_info = &info->readings[j]; + + if (type != reading_info->type && + (type != TOMOE_READING_UNKNOWN && + reading_info->type != TOMOE_READING_UNKNOWN)) + { + return FALSE; } - array->pdata[i + offset] = chr; + if (g_str_has_prefix (reading_info->reading, + tomoe_reading_get_reading(reading))) + return TRUE; } - return i + offset; + return FALSE; } -void -_tomoe_unihan_create (GPtrArray *array) +static gboolean +does_match_char_with_readings (TomoeUnihanInfo *info, const GList *readings) { - gint offset, infos_size; + GList *node; - infos_size = - _tomoe_unihan_data0_size () + - _tomoe_unihan_data1_size () + - _tomoe_unihan_data2_size () + - _tomoe_unihan_data3_size () + - _tomoe_unihan_data4_size () + - _tomoe_unihan_data5_size () + - _tomoe_unihan_data6_size () + - _tomoe_unihan_data7_size () + - _tomoe_unihan_data8_size () + - _tomoe_unihan_data9_size (); - g_ptr_array_set_size (array, infos_size); - array->len = infos_size; + for (node = (GList *)readings; node; node = g_list_next (node)) { + TomoeReading *reading = node->data; + if (!does_match_char_with_reading (info, reading)) + return FALSE; + } - offset = 0; - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data0 (), - _tomoe_unihan_data0_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data1 (), - _tomoe_unihan_data1_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data2 (), - _tomoe_unihan_data2_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data3 (), - _tomoe_unihan_data3_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data4 (), - _tomoe_unihan_data4_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data5 (), - _tomoe_unihan_data5_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data6 (), - _tomoe_unihan_data6_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data7 (), - _tomoe_unihan_data7_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data8 (), - _tomoe_unihan_data8_size (), - offset); - offset = _tomoe_unihan_append_infos (array, - _tomoe_unihan_data9 (), - _tomoe_unihan_data9_size (), - offset); + return TRUE; } + +static void +collect_chars_by_query (TomoeUnihanInfo *infos, + gint size, + TomoeQuery *q, + GList **list) +{ + gint i; + + for (i = size - 1; i >= 0; i--) { + TomoeUnihanInfo *info = &infos[i]; + + /* FIXME: add remaining properties */ + if (does_match_char_with_utf8 ( + info, tomoe_query_get_utf8 (q)) && + does_match_char_with_n_strokes ( + info, + tomoe_query_get_min_n_strokes (q), + tomoe_query_get_max_n_strokes (q)) && + does_match_char_with_readings ( + info, + tomoe_query_get_readings (q))) + { + TomoeChar *chr = _tomoe_char_from_unihan(info); + if (!chr) continue; + *list = g_list_prepend (*list, tomoe_candidate_new (chr)); + g_object_unref(G_OBJECT(chr)); + } + } +} + +static void +collect_all_chars (TomoeUnihanInfo *infos, + gint size, + GList **list) +{ + gint i; + + for (i = size - 1; i >= 0; i--) { + TomoeUnihanInfo *info = &infos[i]; + TomoeChar *chr = _tomoe_char_from_unihan(info); + if (!chr) continue; + *list = g_list_prepend (*list, tomoe_candidate_new (chr)); + g_object_unref(G_OBJECT(chr)); + } +} + +TomoeChar *_tomoe_unihan_get_char (const gchar *utf8) +{ + /* FIXME */ + return NULL; +} + +GList * +_tomoe_unihan_search (TomoeQuery *query) +{ + GList *list = NULL; + guint i; + + if (tomoe_query_is_empty (query)) { + for (i = 0; i < G_N_ELEMENTS(unihan_array); i++) + collect_all_chars(unihan_array[i].get (), + unihan_array[i].size (), + &list); + } else { + for (i = 0; i < G_N_ELEMENTS(unihan_array); i++) + collect_chars_by_query(unihan_array[i].get (), + unihan_array[i].size (), + query, + &list); + } + return list; +} Modified: tomoe/trunk/module/dict/tomoe-unihan.h =================================================================== --- tomoe/trunk/module/dict/tomoe-unihan.h 2008-02-15 12:59:03 UTC (rev 1591) +++ tomoe/trunk/module/dict/tomoe-unihan.h 2008-03-25 10:09:58 UTC (rev 1592) @@ -24,10 +24,13 @@ #define __TOMOE_UNIHAN_H__ #include <glib.h> +#include <tomoe-char.h> +#include <tomoe-query.h> G_BEGIN_DECLS -void _tomoe_unihan_create (GPtrArray *array); +TomoeChar *_tomoe_unihan_get_char (const gchar *utf8); +GList *_tomoe_unihan_search (TomoeQuery *query); G_END_DECLS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |