[Hejes-devel] [895] fixed add_output.py
hejes-devel at nytud.hu
hejes-devel at nytud.hu
Mon Aug 5 15:18:52 CEST 2013
Revision: 895
Author: mittelholcz
Date: 2013-08-05 15:18:51 +0200 (Mon, 05 Aug 2013)
Log Message:
-----------
fixed add_output.py
Modified Paths:
--------------
trunk/misc/log/add_output.py
Modified: trunk/misc/log/add_output.py
===================================================================
--- trunk/misc/log/add_output.py 2013-08-05 08:26:47 UTC (rev 894)
+++ trunk/misc/log/add_output.py 2013-08-05 13:18:51 UTC (rev 895)
@@ -26,24 +26,26 @@
continue
if module.endswith('kulegy'):
- #~ based on default.py
+ #~ based on controlleres/default.py
+ answer = prefix
start = time()
st, uni = egybekulon2.SegmentedInputUseCase.toUnicodeChecked(query)
- if st != 1: print(prefix)
ek = egybekulon2.SegmentedInputUseCase(MYDBCONN)
- if not ek.preprocess(uni): print(prefix)
- if not ek.analyzeTokens(): print(prefix)
- n = ek.getExplanations(plaintxt=True)
+ if st != 1: answer += '\t"encoding error"'
+ elif not ek.preprocess(uni): answer += '\t"user error"'
+ elif not ek.analyzeTokens(): answer += '\t"unknown input token(s)"'
+ else:
+ n = ek.getExplanations(plaintxt=True)
+ if n == 0: answer += '\t"no results"'
+ else:
+ s = ek.explain.encode('utf8')
+ s = s.split('----------------------------------------')
+ for i in s:
+ i = i.split('\n')[2].split('"')
+ if len(i) == 3: answer += i[1] + ', '
+ answer = answer.rstrip(', ')
end = time()
- if n == 0: print('')
- else:
- answer = []
- s = ek.explain.encode('utf8')
- s = s.split('----------------------------------------')
- for i in s:
- i = i.split('\n')[2].split('"')
- if len(i) == 3: answer.append(i[1])
- print(prefix + ', '.join(answer) + '\t' + str(end-start))
+ print( answer + '\t' + str(end-start) )
if module.endswith('suggest'):
query = unicode(query, 'utf8', 'replace')
More information about the Hejes-devel
mailing list