lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <va...@apache.org>
Subject Re: how to instantiate a Set?
Date Mon, 23 Feb 2009 17:36:40 GMT

On Feb 23, 2009, at 8:56, Bill Janssen <janssen@parc.com> wrote:

> Bill Janssen <janssen@parc.com> wrote:
>
>> OK, I added JavaSet to my codebase.
>>
>> But still no joy -- I can now call
>>
>>    mlt = MoreLikeThis(...)
>>    mlt.setStopWords(JavaSet(set(["foo", "bar", "bletch"])))
>>    terms = mlt.retrieveInterestingTerms(...)
>>
>> Unfortunately, I still get "foo", "bar", and "bletch" in the terms.
>>
>> So something is still off.  Looking at the code for use of  
>> stopwords in
>> MLT, it's pretty simple and looks correct.
>
> I instrumented the "contains" method for JavaSet.  When a JavaSet
> containing ['have', 'more', 'less'] is called from Java with an
> <Object: have>, it returns False.  This is why it isn't working for  
> me.

Ah, it's a type issue then: comparing a Java Object (a String) against  
a Python String.
Use the Arrays route until I find a solution for that bug:
HashSet(Arrays.asList(JArray('string')([...])))
  or, simpler, without Arrays:
HashSet(JavaSet(set([...])))

Andi..


Andi..

>
>
> Bill

Mime
View raw message