472,992 Members | 3,432 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 software developers and data experts.

Can I extend Java class to my own python implementing class

PyLucene Homepage:
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
  1. #-------------------tester.py------------------
  2. from PyLucene import StringReader
  3. from PyLucene import CharTokenizer
  4.  
  5. class SimpleKeywordAnalyzer(object):
  6.     def tokenStream(self, fieldName, reader):
  7.         class charTokenizer(object):
  8.             def isTokenChar(self, c):
  9.                 return True
  10.  
  11.         return CharTokenizer(charTokenizer(), reader)
  12.  
  13. if __name__ == '__main__':
  14.     ca = SimpleKeywordAnalyzer()
  15.     strs = ca.tokenStream(' ', StringReader('bonne nuit Francais'))
  16.     print 'Merci'
  17.     for each in strs:
  18.         print each.termText(), each.type()
  19. #-------------------------------------------------------------
Simple as it is, however, it roughly didn't work out.
Expand|Select|Wrap|Line Numbers
  1. Message:
  2. TrackBack:
  3. File 'tester.py', line 21, in <module>
  4.     strs = ca.tokenStream(' ', StringReader('bonne nuit Francais'))
  5. File 'tester.py', line 16, in <module>
  6.     return CharTokenizer(charTokenizer(), reader)
  7. NotImplementedError:('instantiating java class', <type 'PyLuceneCharTokenizer'>
  8.  
-----------------------------------------------
BTW:Environment:
Python 2.5.1,
PyLucene 2.0.0-3,
i686-pc-linux-gnu
Thread model: posix
gcj-3.4.6
Aug 27 '07 #1
0 1294

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Hung Jung Lu | last post by:
Hi, I think Microsoft did look into Python when they designed C#. (E.g. they got rid of checked exceptions of Java.) However, they followed Java in avoiding multiple inheritance (MI), which is a...
9
by: F. GEIGER | last post by:
I've dev'ed a Python prototype of an app, that besides the internals making it up has a gui. While test-driven dev'ing the app's internals in Python is fun as usual, dev'ing the GUI is not so...
5
by: Maurice Ling | last post by:
Hi, I have read that this had been asked before but there's no satisfactory replies then. I have a module (pA) written in python, which originally is called by another python module (pB), and...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
29
by: walterbyrd | last post by:
Some think it will. Up untill now, Java has never been standard across different versions of Linux and Unix. Some think that is one reason that some developers have avoided Java in favor of...
4
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.