summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-01-15 14:57:46 +0800
committerPeng Wu <alexepico@gmail.com>2013-01-15 14:57:46 +0800
commit4fb5560fc42f501dece0f3803a36cf419af996fd (patch)
treed1d9cab41fd4d5297230f14aaa2c113142e9c584
parent8f5a4dd7aa1e32cd81effe49a85bdf6b9f1fb23f (diff)
downloadtrainer-4fb5560fc42f501dece0f3803a36cf419af996fd.tar.gz
trainer-4fb5560fc42f501dece0f3803a36cf419af996fd.tar.xz
trainer-4fb5560fc42f501dece0f3803a36cf419af996fd.zip
improves partialwordthreshold.py
-rw-r--r--partialwordthreshold.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/partialwordthreshold.py b/partialwordthreshold.py
index c215f40..77b6a96 100644
--- a/partialwordthreshold.py
+++ b/partialwordthreshold.py
@@ -61,8 +61,8 @@ def computeThreshold(conn):
#ascending sort
wordswithfreq.sort(key=itemgetter(1))
pos = int(len(wordswithfreq) * config.getPartialWordThreshold())
- threshold = wordswithfreq[-pos]
-
+ (word, threshold) = wordswithfreq[-pos]
+ print(word, threshold)
return threshold
@@ -87,8 +87,7 @@ def handleOneIndex(indexpath, subdir, indexname):
conn = sqlite3.connect(filepath)
- (word, threshold)= computeThreshold(conn)
- print(word, threshold)
+ threshold = computeThreshold(conn)
indexstatus['PartialWordThreshold'] = threshold
conn.commit()