summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-05-19 10:33:05 +0800
committerPeng Wu <alexepico@gmail.com>2016-05-19 10:33:05 +0800
commit060b98ca0da4ecb939bebdc86b483cc3f5335246 (patch)
tree15aa3a621e6b6464c6b7620ba8719a60874ebb00
parent3fb08cfc9707cf241cb3d782733bf1116a5a474b (diff)
downloadlibpinyin-060b98ca0da4ecb939bebdc86b483cc3f5335246.tar.gz
libpinyin-060b98ca0da4ecb939bebdc86b483cc3f5335246.tar.xz
libpinyin-060b98ca0da4ecb939bebdc86b483cc3f5335246.zip
comment out code
-rw-r--r--src/pinyin.cpp7
-rw-r--r--src/storage/pinyin_parser2.cpp32
2 files changed, 15 insertions, 24 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 5b5f0bc..99b29dc 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1726,7 +1726,7 @@ bool pinyin_guess_candidates(pinyin_instance_t * instance,
return true;
}
-
+#if 0
static bool _try_divided_table(pinyin_instance_t * instance,
PhraseIndexRanges ranges,
size_t offset,
@@ -1946,6 +1946,7 @@ static bool _try_resplit_table(pinyin_instance_t * instance,
return found;
}
+#endif
bool pinyin_guess_full_pinyin_candidates(pinyin_instance_t * instance,
size_t offset){
@@ -1989,6 +1990,7 @@ bool pinyin_guess_full_pinyin_candidates(pinyin_instance_t * instance,
GArray * items = g_array_new(FALSE, FALSE, sizeof(lookup_candidate_t));
+#if 0
if (1 == pinyin_len) {
/* because there is only one pinyin left,
* the following for-loop will not produce 2 character candidates.
@@ -2022,11 +2024,13 @@ bool pinyin_guess_full_pinyin_candidates(pinyin_instance_t * instance,
}
}
}
+#endif
for (i = pinyin_len; i >= 1; --i) {
bool found = false;
g_array_set_size(items, 0);
+#if 0
if (2 == i) {
/* handle fuzzy pinyin segment here. */
if (options & USE_DIVIDED_TABLE) {
@@ -2038,6 +2042,7 @@ bool pinyin_guess_full_pinyin_candidates(pinyin_instance_t * instance,
found;
}
}
+#endif
ChewingKey * keys = &g_array_index
(pinyin_keys, ChewingKey, offset);
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 67c734f..16f4b1e 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -302,29 +302,6 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
value.m_num_keys == nextstep->m_num_keys) {
#if 0
- /* prefer the complete pinyin with shengmu
- * over without shengmu,
- * ex: "kaneiji" -> "ka'nei'ji".
- */
- if ((value.m_key.m_initial != CHEWING_ZERO_INITIAL &&
- !(value.m_key.m_middle == CHEWING_ZERO_MIDDLE &&
- value.m_key.m_final == CHEWING_ZERO_FINAL)) &&
- nextstep->m_key.m_initial == CHEWING_ZERO_INITIAL)
- *nextstep = value;
-
- /* prefer the complete pinyin 'er'
- * over the in-complete pinyin 'r',
- * ex: "xierqi" -> "xi'er'qi."
- */
- if ((value.m_key.m_initial == CHEWING_ZERO_INITIAL &&
- value.m_key.m_middle == CHEWING_ZERO_MIDDLE &&
- value.m_key.m_final == CHEWING_ER) &&
- (nextstep->m_key.m_initial == CHEWING_R &&
- nextstep->m_key.m_middle == CHEWING_ZERO_MIDDLE &&
- nextstep->m_key.m_final == CHEWING_ZERO_FINAL))
- *nextstep = value;
-#endif
-
/* prefer the 'a' at the end of clause,
* ex: "zheyanga$" -> "zhe'yang'a$".
*/
@@ -335,6 +312,7 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
value.m_key.m_middle == CHEWING_ZERO_MIDDLE &&
value.m_key.m_final == CHEWING_A))
*nextstep = value;
+#endif
}
}
}
@@ -343,10 +321,12 @@ int FullPinyinParser2::parse (pinyin_option_t options, ChewingKeyVector & keys,
/* final step for back tracing. */
gint16 parsed_len = final_step(step_len, keys, key_rests);
+#if 0
/* post processing for re-split table. */
if (options & USE_RESPLIT_TABLE) {
post_process2(options, keys, key_rests, str, len);
}
+#endif
g_free(input);
return parsed_len;
@@ -409,6 +389,7 @@ bool FullPinyinParser2::set_scheme(FullPinyinScheme scheme){
return true;
}
+#if 0
bool FullPinyinParser2::post_process2(pinyin_option_t options,
ChewingKeyVector & keys,
ChewingKeyRestVector & key_rests,
@@ -590,6 +571,8 @@ const resplit_table_item_t * FullPinyinParser2::retrieve_resplit_item_by_resplit
return NULL;
}
+#endif
+
#define IS_KEY(x) (('a' <= x && x <= 'z') || x == ';')
bool DoublePinyinParser2::parse_one_key(pinyin_option_t options,
@@ -942,6 +925,9 @@ bool resplit_step(pinyin_option_t options,
for (k = 0; k < G_N_ELEMENTS(resplit_table); ++k) {
item = resplit_table + k;
+ /* As no resplit table used in the FullPinyinParser2,
+ only one-way match is needed, this is simpler. */
+
/* "'" is filled by zero key of ChewingKey. */
if (key == item->m_orig_structs[0] &&
next_key == item->m_orig_structs[1])