Hello community, here is the log from the commit of package sunpinyin for openSUSE:Factory checked in at 2016-03-16 10:35:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sunpinyin (Old) and /work/SRC/openSUSE:Factory/.sunpinyin.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sunpinyin" Changes: -------- --- /work/SRC/openSUSE:Factory/sunpinyin/sunpinyin.changes 2015-08-27 08:57:19.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.sunpinyin.new/sunpinyin.changes 2016-03-16 10:36:05.000000000 +0100 @@ -1,0 +2,11 @@ +Sun Mar 06 05:02:17 UTC 2016 - [email protected] + +- update to version 2.0.4+git20160225.844ad0f: + + Fixed SunPinyinLookupTable::cursor_up() + + slm/thread: be more tolerant when looking up a float + + SLM-train.mk: publish SLM*_TEXT_FILE instead of + TSLM*_TEXT_FILE. +- libsunpinyin3 should requires sunpinyin-data, or the + input method can't be used + +------------------------------------------------------------------- @@ -4 +15 @@ -- Update to version 2.0.4+git20150706.cf18102: +- update to version 2.0.4+git20150706.cf18102: Old: ---- sunpinyin-2.0.4+git20150706.cf18102.tar.xz New: ---- sunpinyin-2.0.4+git20160225.844ad0f.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sunpinyin.spec ++++++ --- /var/tmp/diff_new_pack.TqNAqt/_old 2016-03-16 10:36:06.000000000 +0100 +++ /var/tmp/diff_new_pack.TqNAqt/_new 2016-03-16 10:36:06.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package sunpinyin # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,13 +17,14 @@ Name: sunpinyin -Version: 2.0.4+git20150706.cf18102 +Version: 2.0.4+git20160225.844ad0f Release: 0 Summary: A Statistical Language Model Based Chinese Input Method License: LGPL-2.1+ Group: System/I18n/Chinese Url: https://github.com/sunpinyin/sunpinyin Source: %{name}-%{version}.tar.xz +# https://sourceforge.net/projects/open-gram Source1: http://jaist.dl.sourceforge.net/project/open-gram/lm_sc.3gm.arpa-20140820.tar.bz2 Source2: http://jaist.dl.sourceforge.net/project/open-gram/dict.utf8-20131214.tar.bz2 Source3: sunpinyin-dictgen-local.mk.in @@ -45,6 +46,7 @@ %package -n lib%{name}3 Summary: Libraries for Sunpinyin Group: System/Libraries +Requires: %{name}-data >= %{version} %description -n lib%{name}3 Sunpinyin is a statistical language model based Chinese input method engine. to model the Chinese language, it use a backoff bigram and trigram language model. @@ -69,7 +71,7 @@ %package devel Summary: Development Files for Sunpinyin -Group: Development/Libraries/Other +Group: Development/Libraries/C and C++ Requires: lib%{name}3 = %{version} Requires: sunpinyin-tools = %{version} Provides: lib%{name}-devel = %{version} ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.TqNAqt/_old 2016-03-16 10:36:06.000000000 +0100 +++ /var/tmp/diff_new_pack.TqNAqt/_new 2016-03-16 10:36:06.000000000 +0100 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/sunpinyin/sunpinyin/</param> - <param name="changesrevision">cf1810220bf3d3f5a8b990b0a9d3e9df21b1942c</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">844ad0fe49751d6a09fdfe531668769b06c66459</param></service></servicedata> \ No newline at end of file ++++++ sunpinyin-2.0.4+git20150706.cf18102.tar.xz -> sunpinyin-2.0.4+git20160225.844ad0f.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sunpinyin-2.0.4+git20150706.cf18102/doc/SLM-train.mk new/sunpinyin-2.0.4+git20160225.844ad0f/doc/SLM-train.mk --- old/sunpinyin-2.0.4+git20150706.cf18102/doc/SLM-train.mk 2015-08-23 17:25:48.000000000 +0200 +++ new/sunpinyin-2.0.4+git20160225.844ad0f/doc/SLM-train.mk 2016-03-06 06:02:16.000000000 +0100 @@ -101,10 +101,10 @@ rm -f ${BIGRAM_STAT} ${SLM2_RAW_FILE} rm -f ${TRIGRAM_STAT} ${SLM3_RAW_FILE} -mmseg_bigram: mmseg_ids tslm2_info -mmseg_trigram: mmseg_ids tslm3_info -slm_bigram: slm2_ids tslm2_info -slm_trigram: slm3_ids tslm3_info +mmseg_bigram: mmseg_ids slm2_info +mmseg_trigram: mmseg_ids slm3_info +slm_bigram: slm2_ids slm2_info +slm_trigram: slm3_ids slm3_info bootstrap2: make mmseg_bigram diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sunpinyin-2.0.4+git20150706.cf18102/src/slm/thread/slmthread.cpp new/sunpinyin-2.0.4+git20160225.844ad0f/src/slm/thread/slmthread.cpp --- old/sunpinyin-2.0.4+git20150706.cf18102/src/slm/thread/slmthread.cpp 2015-08-23 17:25:48.000000000 +0200 +++ new/sunpinyin-2.0.4+git20160225.844ad0f/src/slm/thread/slmthread.cpp 2016-03-06 06:02:16.000000000 +0100 @@ -226,6 +226,26 @@ CThreadSlm::TNode* levels[16]; CThreadSlm::TLeaf* lastLevel; +// be more tolerant when looking up a float in a map by applying an epsilon of +// 1e-5, if key is not found. +template<typename K, typename V> +typename std::map<K, V>::const_iterator approx_find(const std::map<K, V>& m, K key) +{ + typename std::map<K, V>::const_iterator i = m.find(key); + if (i != m.end()) { + return i; + } + K tolerance = key / 1e5; + K lower_bound = key - tolerance; + K upper_bound = key + tolerance; + i = m.lower_bound(lower_bound); + if (i != m.end() && i->first < upper_bound) { + return i; + } else { + return m.end(); + } +} + int main(int argc, char* argv[]) { @@ -356,11 +376,11 @@ CSIMSlm::TNode* pn = (CSIMSlm::TNode*)slm.getNodePtr(it); CThreadSlm::TNode& nn = levels[lvl][it.m_history.back()]; - std::map<float, int>::iterator prit = pr_map.find(pn->pr); + std::map<float, int>::const_iterator prit = approx_find(pr_map, pn->pr); if (prit == pr_map.end()) { // This would be cause by precision error - double val = EffectivePr(pn->pr); + float val = EffectivePr(pn->pr); val = OriginalPr(val); - prit = pr_map.find(val); + prit = approx_find(pr_map, val); assert(prit != pr_map.end()); } int idx_pr = prit->second; @@ -370,11 +390,11 @@ nn.set_bon(bon); nn.set_bol(bol); - std::map<float, int>::iterator bowit = bow_map.find(pn->bow); + std::map<float, int>::const_iterator bowit = approx_find(bow_map, pn->bow); if (bowit == bow_map.end()) { // precision error - double val = EffectiveBow(pn->bow); + float val = EffectiveBow(pn->bow); val = OriginalBow(val); - bowit = bow_map.find(val); + bowit = approx_find(bow_map, val); assert(bowit != bow_map.end()); } int idx_bow = bowit->second; @@ -403,11 +423,11 @@ CThreadSlm::TLeaf& nn = lastLevel[it.m_history.back()]; - std::map<float, int>::iterator prit = pr_map.find(pn->pr); + std::map<float, int>::const_iterator prit = approx_find(pr_map, pn->pr); if (prit == pr_map.end()) { // This would be cause by precision error - double val = EffectivePr(pn->pr); + float val = EffectivePr(pn->pr); val = OriginalPr(val); - prit = pr_map.find(val); + prit = approx_find(pr_map, val); assert(prit != pr_map.end()); } int idx_pr = prit->second; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sunpinyin-2.0.4+git20150706.cf18102/wrapper/ibus/src/sunpinyin_lookup_table.cpp new/sunpinyin-2.0.4+git20160225.844ad0f/wrapper/ibus/src/sunpinyin_lookup_table.cpp --- old/sunpinyin-2.0.4+git20150706.cf18102/wrapper/ibus/src/sunpinyin_lookup_table.cpp 2015-08-23 17:25:48.000000000 +0200 +++ new/sunpinyin-2.0.4+git20160225.844ad0f/wrapper/ibus/src/sunpinyin_lookup_table.cpp 2016-03-06 06:02:16.000000000 +0100 @@ -82,7 +82,7 @@ bool SunPinyinLookupTable::cursor_up() { - ibus_lookup_table_cursor_down(*this); + ibus_lookup_table_cursor_up(*this); return true; }
