📄 pinyinengine.cpp.rej
字号:
****************** 26,32 ****
PinyinEngine::PinyinEngine(const char *table_file,const char *phrase_index_file)
:m_table(NULL,table_file),m_table_filename(table_file),
- m_phrases_table(phrase_index_file),m_phrase_idx_filename(phrase_index_file)
{
}
--- 26,32 ----
PinyinEngine::PinyinEngine(const char *table_file,const char *phrase_index_file)
:m_table(NULL,table_file),m_table_filename(table_file),
+ m_phrases_table(phrase_index_file),m_phrase_idx_filename(phrase_index_file),table_changed(0)
{
}
****************** 70,88 **** if(isPhrase()){
m_phrases_table.set_frequency(m_offset_freq_pairs[index].first,
m_offset_freq_pairs[index].second+1);
}
else{
PinyinKey& key=m_key.get_key_by_index(0);
uint32 freq=m_table.get_char_frequency(m_chars[index],key)+1;
m_table.set_char_frequency(m_chars[index],freq,key);
}
}
void PinyinEngine::save_table()
{
m_table.save_table(m_table_filename.c_str());
m_phrases_table.save_index(m_phrase_idx_filename.c_str());
printX86("table saved\n");
}
void PinyinEngine::append_phrase(QString& phrase,const char* pinyin)
--- 70,93 ---- if(isPhrase()){
m_phrases_table.set_frequency(m_offset_freq_pairs[index].first,
m_offset_freq_pairs[index].second+1);
+ table_changed|=2;
}
else{
PinyinKey& key=m_key.get_key_by_index(0);
uint32 freq=m_table.get_char_frequency(m_chars[index],key)+1;
m_table.set_char_frequency(m_chars[index],freq,key);
+ table_changed|=1;
}
}
void PinyinEngine::save_table()
{
+ if(table_changed&1)
m_table.save_table(m_table_filename.c_str());
+ if(table_changed&2)
m_phrases_table.save_index(m_phrase_idx_filename.c_str());
printX86("table saved\n");
+ table_changed=0;
}
void PinyinEngine::append_phrase(QString& phrase,const char* pinyin)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -