[ https://issues.apache.org/jira/browse/PYLUCENE-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17181489#comment-17181489 ]
Andreas Vajda commented on PYLUCENE-55: --------------------------------------- I think you should be using --use_full_names to preserve the java package hierarchy as this is a sizable tree of java classes being looked at. Otherwise the entire namespace tree is flattened and there could be clashes (but I didn't find multiple BabelSynset classes...) This flag is off by default (arguably a bad default) and is documented here: https://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/__main__.py?view=markup Without making any changes to JCC, I was able to build your wrappers and found that BabelSynset does have its getLemmas() method. I included my Makefile below, I also used --shared mode, which is recommended (but not required). {code:java} PREFIX_PYTHON=/Users/vajda/apache/pylucene/_install3 PYTHON=$(PREFIX_PYTHON)/bin/python JCC=$(PYTHON) -m jcc --shared --arch x86_64 --wheel NUM_FILES=10 JARS= --jar babelnet-api-4.0.1.jar JARS+= --jar lib/babelscape-data-commons-1.0.jar INCLUDE+=--include lib/commons-beanutils-1.7.0.jar INCLUDE+=--include lib/commons-beanutils-core-1.7.0.jar INCLUDE+=--include lib/commons-codec-1.8.jar INCLUDE+=--include lib/commons-collections-3.2.jar INCLUDE+=--include lib/commons-configuration-1.5.jar INCLUDE+=--include lib/commons-digester-1.8.jar INCLUDE+=--include lib/commons-lang-2.3.jar INCLUDE+=--include lib/commons-logging-1.1.jar INCLUDE+=--include lib/gson-2.8.2.jar INCLUDE+=--include lib/guava-23.0.jar INCLUDE+=--include lib/httpclient-4.3.6.jar INCLUDE+=--include lib/httpcore-4.3.3.jar INCLUDE+=--include lib/icu4j-56.1.jar INCLUDE+=--include lib/jwi-2.2.3.jar INCLUDE+=--include lib/lcl-jlt-2.4.jar INCLUDE+=--include lib/logback-classic-1.2.3.jar INCLUDE+=--include lib/logback-core-1.2.3.jar INCLUDE+=--include lib/lucene-analyzers-common-7.2.0.jar INCLUDE+=--include lib/lucene-core-7.2.0.jar INCLUDE+=--include lib/lucene-queries-7.2.0.jar INCLUDE+=--include lib/lucene-queryparser-7.2.0.jar INCLUDE+=--include lib/lucene-sandbox-7.2.0.jar INCLUDE+=--include lib/slf4j-api-1.7.25.jar MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNetQuery/Builder 'from:(Lit/uniroma1/lcl/babelnet/Language;)Lit/uniroma1/lcl/babelnet/BabelNetQuery/Builder;' MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNet 'getSynsets:(Lit/uniroma1/lcl/babelnet/BabelNetQuery;)Ljava/lang/List<it/uniroma1/lcl/babelnet/BabelSynset>;' compile: $(JCC) $(INCLUDE) $(JARS) $(MAPPING) --python babelnet --build --version 4.0.1 --use_full_names install: $(JCC) $(INCLUDE) $(JARS) $(MAPPING) --python babelnet --install --version 4.0.1 --use_full_names {code} $ make compile $ make install $ ../_install3/bin/python >>> import babelnet >>> babelnet.initVM() >>> from it.uniroma1.lcl.babelnet import BabelSynset >>> dir(BabelSynset) ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_jobject', 'boxfn_', 'cast_', 'categories', 'class', 'class_', 'edges', 'equals', 'examples', 'getCategories', 'getClass', 'getCompounds', 'getDBPediaURIs', 'getEdges', 'getExamples', 'getGeoNamesURIs', 'getGlosses', 'getID', 'getId', 'getImages', 'getLemmas', 'getMainSenses', 'getOtherForms', 'getOutgoingEdges', 'getPOS', 'getSenseSources', 'getSenses', 'getSynsetType', 'getType', 'getWordNetOffsets', 'getYAGOURIs', 'glosses', 'hashCode', 'iD', 'id', 'images', 'instance_', 'isKeyConcept', 'iterator', 'keyConcept', 'notify', 'notifyAll', 'of_', 'outgoingEdges', 'pOS', 'parameters_', 'senseSources', 'senses', 'size', 'synsetType', 'toString', 'toURIs', 'type', 'wait', 'wordNetOffsets', 'wrapfn_', 'yAGOURIs'] > JCC creates the classes in non-deterministic order > -------------------------------------------------- > > Key: PYLUCENE-55 > URL: https://issues.apache.org/jira/browse/PYLUCENE-55 > Project: PyLucene > Issue Type: Bug > Reporter: Andrea Sterbini > Priority: Major > > I am trying to wrap the BabelNet API code. > The resulting module is non-deterministically not-working (once every 5 I get > it OK). > This seems to be related to the order the classes are handled, because they > are kept in a set, which has nondeterministic order. > By changing cpp.py at line 696 to sort the class names I get a working module. > {code:java} > // changed from > for cls in todo: > {code} > {code:java} > // to > for cls in sorted(todo, key=lambda c: c.getName()):{code} > I have been luky with this way to order the classes. Possibly a better > algorithm exists to fix this bug. -- This message was sent by Atlassian Jira (v8.3.4#803005)