On Sun, 22 Feb 2009, Bill Janssen wrote:
I'm probably missing something incredibly obvious here...
I'm trying to call MoreLikethis.setStopWords(Set words). I've got a
list of stop words in Python, but I can't figure out how to turn that
into a Java Set. I tried "lucene.HashSet(set(words)",
"lucene.HashSet(lucene.ArrayList(JArray("string")(words)))", and so
forth, without much luck.
I just added the Arrays class to the build by adding java.util.Arrays to the
jcc invocation in PyLucene's Makefile and now the following just works:
>>> a=Arrays.asList(JArray('string')(('foo', 'bar', 'baz')))
>>> a
<List: [foo, bar, baz]>
>>> HashSet(a)
<HashSet: [foo, baz, bar]>
I should have that checked in shortly.
You then get to decide: use the "makes me cringe" Arrays class or the
pythonic JavaSet.py/PythonSet.java combo :)
Andi..