Return-Path: Delivered-To: apmail-lucene-pylucene-dev-archive@minotaur.apache.org Received: (qmail 99029 invoked from network); 18 Feb 2009 19:20:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Feb 2009 19:20:28 -0000 Received: (qmail 54710 invoked by uid 500); 18 Feb 2009 19:20:28 -0000 Delivered-To: apmail-lucene-pylucene-dev-archive@lucene.apache.org Received: (qmail 54685 invoked by uid 500); 18 Feb 2009 19:20:28 -0000 Mailing-List: contact pylucene-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pylucene-dev@lucene.apache.org Delivered-To: mailing list pylucene-dev@lucene.apache.org Received: (qmail 54674 invoked by uid 99); 18 Feb 2009 19:20:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Feb 2009 11:20:28 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [66.51.199.98] (HELO mail10.dslextreme.com) (66.51.199.98) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 18 Feb 2009 19:20:19 +0000 Received: (qmail 21680 invoked from network); 18 Feb 2009 19:19:57 -0000 Received: from unknown (HELO ovaltofu.org) (66.159.224.220) by mail10.dslextreme.com with (DHE-RSA-AES256-SHA encrypted) SMTP; Wed, 18 Feb 2009 11:19:57 -0800 Received: from [192.168.0.5] ([192.168.0.5]) (authenticated bits=0) by ovaltofu.org (8.13.8/8.13.5) with ESMTP id n1IJKnFm002921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 18 Feb 2009 11:20:50 -0800 (PST) Date: Wed, 18 Feb 2009 11:20:46 -0800 (PST) From: Andi Vajda X-X-Sender: vajda@yuzu.local Reply-To: Andi Vajda To: "'pylucene-dev@lucene.apache.org'" Subject: Re: Passing value during Java object instantiation In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (OSX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org On Wed, 18 Feb 2009, Charles A. Benson wrote: > Hello, >> From my PyLucene code, I want to pass in a value when I instantiate my >> StopAnalyzer. In particular, I want to instantiate w/a file containing a >> list of stop words.. Everything I have tried so far is either kicked back >> by Python or Java. Is there a way to instantiate a Java File object from >> within Python/PyLucene ? Is there a more general way to handle this ? Yes, use the Java File class: >>> from lucene import * >>> initVM(CLASSPATH) >>> File >>> a=StopAnalyzer(File("foo.txt")) >>> list(a.tokenStream("foo", StringReader("the foo is bar"))) [, ] >>> list(StopAnalyzer().tokenStream("foo", StringReader("the foo is bar"))) [, ] Andi.. ps: the foo.txt in the example above contains: foo bar baz