pylucene.osafoundation.org
1.Quotas from PyLucene:
"""
Technically, the PyLucene programmer is not providing an 'extension'
but a Python implementation of a set of methods encapsulated by a
Python class whose instances are wrapped by the Java proxies provided
by PyLucene.
----http://svn.nuxeo.org/pub/vendor/PyLucene/tags/1.9rc1-1/README
"""
To me, it almost means that I can't simply extend Java class, in my own Python implementation, such as FunnyTokenizer(PyLucene.CharTokenizer).
2.Testcase
Thanks to the link offered as http://svn.osafoundation.org/pylucen...ordAnalyzer.py
I try a testcase as follows:
Expand|Select|Wrap|Line Numbers
- #-------------------tester.py------------------
- from PyLucene import StringReader
- from PyLucene import CharTokenizer
- class SimpleKeywordAnalyzer(object):
- def tokenStream(self, fieldName, reader):
- class charTokenizer(object):
- def isTokenChar(self, c):
- return True
- return CharTokenizer(charTokenizer(), reader)
- if __name__ == '__main__':
- ca = SimpleKeywordAnalyzer()
- strs = ca.tokenStream(' ', StringReader('bonne nuit Francais'))
- print 'Merci'
- for each in strs:
- print each.termText(), each.type()
- #-------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
- Message:
- TrackBack:
- File 'tester.py', line 21, in <module>
- strs = ca.tokenStream(' ', StringReader('bonne nuit Francais'))
- File 'tester.py', line 16, in <module>
- return CharTokenizer(charTokenizer(), reader)
- NotImplementedError:('instantiating java class', <type 'PyLuceneCharTokenizer'>
BTW:Environment:
Python 2.5.1,
PyLucene 2.0.0-3,
i686-pc-linux-gnu
Thread model: posix
gcj-3.4.6