I'm have this function:
def ngrams(word):
for i in range(1, len(word) + 1):
yield word[:i]
..and I got an error
2012-03-09 19:37:31,928 ERROR worker-bootstrap: Error running worker process
net.grinder.scriptengine.jython.JythonScriptExecutionException: SyntaxError: ('invalid syntax', ('C:\\grinder-3.7.1\\lib
\\.\\nb-romg-file-store\\current\\grinder_test.py', 72, 15, ' yield word[:i] '))
(no code object) at line 0
Is there any way to make yield
work? I tried the same function in jython
console - if works normally.