473,485 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can I extend Java class to my own python implementing class

1 New Member
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 1313

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

Similar topics

7
3273
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
3737
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
3668
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
9202
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
9581
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
6914
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
1956
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
6165
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
6960
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7116
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6825
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4857
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4551
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3063
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
595
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
247
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.