La Web Imágenes Vídeos Noticias Grupos Libros Gmail Más »
Grupos visitados recientemente | Ayuda | Acceder
Página principal de Grupos de Google
Mensaje del debate 在pyLucene中使用中文分词器(在pyLucene中引用 Jar包)

Ver analizado - Mostrar sólo mensaje de texto

MIME-Version: 1.0
Received: by 10.150.12.10 with SMTP id 10mr70504ybl.13.1212387275681; Sun, 01 
	Jun 2008 23:14:35 -0700 (PDT)
Date: Sun, 1 Jun 2008 23:14:35 -0700 (PDT)
X-IP: 123.117.76.172
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) 
	Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe)
Message-ID: <abe55171-fcf3-447a-9c33-5c760d743cc3@p39g2000prm.googlegroups.com>
Subject: =?GB2312?B?1NpweUx1Y2VuZdbQyrnTw9bQzsS31rTKxvejqNTacHlMdWNlbmXW0A==?=
	=?GB2312?B?0v3Tw0phcrD8o6k=?=
From: Cloud Zhang <zhong...@gmail.com>
To: =?GB2312?B?cHl0aG9uLWNuYENQeVVHYLuq8v7Tw7un1+k=?= <python-cn@googlegroups.com>
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: quoted-printable

=A3=A8=B8=D5=B8=D5=BD=E2=BE=F6=B5=C4=D2=BB=B8=F6=CE=CA=CC=E2=A3=AC=D4=DA=D6=
=D0=CE=C4=C0=EF=C3=E6=C3=BB=D3=D0=CB=D1=CB=F7=B5=BD=CF=E0=B9=D8=C4=DA=C8=DD=
=A3=A8=D3=A2=CE=C4=C0=EF=C6=E4=CA=B5=D2=B2=C3=BB=CB=D1=B5=BD...=A3=A9=A3=AC=
=B7=A2=D2=BB=C6=AA=D4=DA=D5=E2=C0=EF=B1=B8=C8=CB=CB=F7=D2=FD=A3=AC=B9=D8=BC=
=FC=D7=D6=A3=BApyLucene, JCC,
Lucene, Importing JAR=A3=A9

=D4=DALucene=C0=EF=C3=E6=D2=FD=D3=C3=B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6=B8=F4
=CF=DF-------------------------------------
Andi Vajda:
To access your class(es) by name from Python, you must have JCC
generate wrappers for it (them). This is what is done line 177 and on
in PyLucene's Makefile. The easiest way for you to add your own Java
classes to PyLucene is to create another jar file with your own
analyzer classes and code and add it to the JCC invocation there.

For example, the Makefile snippet in question currently says:

GENERATE=3D$(JCC) $(foreach jar,$(JARS),--jar $(jar)) \
          --package java.lang java.lang.System \
                              java.lang.Runtime \
          --package java.util \
                    java.text.SimpleDateFormat \
          --package java.io java.io.StringReader \
                            java.io.InputStreamReader \
                            java.io.FileInputStream \
          --exclude org.apache.lucene.queryParser.Token \
          --exclude org.apache.lucene.queryParser.TokenMgrError \
          --exclude
org.apache.lucene.queryParser.QueryParserTokenManager \
          --exclude org.apache.lucene.queryParser.ParseException \
          --python lucene \
          --mapping org.apache.lucene.document.Document 'get:(Ljava/
lang/String;)Ljava/lang/String;' \
          --mapping java.util.Properties 'getProperty:(Ljava/lang/
String;)Ljava/lang/String;' \
          --sequence org.apache.lucene.search.Hits 'length:()I' 'doc:
(I)Lorg/apache/lucene/document/Document;' \
          --version $(LUCENE_VER) \
          --files $(NUM_FILES)


change the first line to say:

GENERATE=3D$(JCC) $(foreach jar,$(JARS),--jar $(jar)) --jar myjar.jar \
  ...

and rebuild PyLucene. That should be all you need to do. Your jar file
is going to be installed along with lucene's in the lucene egg and it
is going to be put on lucene.CLASSPATH which you use with
lucene.initVM().

Your classes can be declared in any Java package you want. Just make
sure that their names don't clash with other Lucene class names that
you also need to use as the class namespace is flattened in PyLucene.

For more information about JCC and its command line args see JCC's
README file at [1].

Andi..

[1] http://svn.osafoundation.org/pylucene/trunk/jcc/jcc/README
_______________________________________________
pylucene-dev mailing list
pylucene-...@osafoundation.org

Crear un grupo - Grupos de Google - Página principal de Google - Condiciones del servicio - Política de privacidad
©2009 Google