summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-04-27 17:01:08 +0800
committerPeng Wu <alexepico@gmail.com>2011-04-27 17:01:08 +0800
commit0b173665c29bd5a2d3b81625e7112cb503d357a9 (patch)
tree31e0aa7940f2ef17820ac63680af46cd8d44a955 /src
parent844ff3da1745e9433f893390e85eb64c5c3fd5aa (diff)
downloadlibpinyin-0b173665c29bd5a2d3b81625e7112cb503d357a9.tar.gz
libpinyin-0b173665c29bd5a2d3b81625e7112cb503d357a9.tar.xz
libpinyin-0b173665c29bd5a2d3b81625e7112cb503d357a9.zip
add remove method to flexible n-gram
Diffstat (limited to 'src')
-rw-r--r--src/storage/flexible_ngram.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/storage/flexible_ngram.h b/src/storage/flexible_ngram.h
index 0141367..3fa452d 100644
--- a/src/storage/flexible_ngram.h
+++ b/src/storage/flexible_ngram.h
@@ -325,6 +325,19 @@ public:
return ret == 0;
}
+ bool remove(phrase_token_t index){
+ if ( !m_db )
+ return false;
+
+ DBT db_key;
+ memset(&db_key, 0, sizeof(DBT));
+ db_key.data = &index;
+ db_key.size = sizeof(phrase_token_t);
+
+ int ret = m_db->del(m_db, NULL, &db_key, 0);
+ return ret == 0;
+ }
+
/* array of phrase_token_t items, for parameter estimation. */
bool get_all_items(GArray * items){
g_array_set_size(items, 0);