La Web Imágenes Vídeos Noticias Grupos Libros Gmail Más »
Grupos visitados recientemente | Ayuda | Acceder
Página principal de Grupos de Google
在pyLucene中使用中文分词器(在pyLucene中引用 Jar包)
En este grupo hay demasiados temas que deben mostrarse primero. Para que este aparezca al principio de la lista, debes descartar esta opción para alguno de los anteriores.
Error al procesar tu solicitud. Por favor, inténtalo de nuevo.
marcar
  1 mensaje - Ocultar todos  -  Traducir todo al Traducido (ver todos los originales)
El grupo al cual envías entradas es un grupo Usenet. Si envías mensajes a este grupo, cualquier usuario de Internet podrá ver tu dirección de correo electrónico
Tu respuesta no se ha enviado.
Tu entrada se ha publicado correctamente.
 
De:
Para:
Cc:
Seguimiento:
Añadir Cc | Añadir seguimiento | Editar asunto
Asunto:
Validación:
Con fines de verificación, escribe los caracteres que veas en la imagen siguiente o los números que escuches haciendo clic en el icono de accesibilidad. Escucha y escribe los números que oyes.
 
Cloud Zhang  
Ver perfil   Traducir al Traducido (ver original)
 Más opciones 2 jun 2008, 01:14
De: Cloud Zhang <zhong...@gmail.com>
Fecha: Sun, 1 Jun 2008 23:14:35 -0700 (PDT)
Local: Lun 2 jun 2008 01:14
Asunto: 在pyLucene中使用中文分词器(在pyLucene中引用Jar包)
(刚刚解决的一个问题,在中文里面没有搜索到相关内容(英文里其实也没搜到...),发一篇在这里备人索引,关键字:pyLucene, JCC,
Lucene, Importing JAR)

在Lucene里面引用别人写好的中文分词器很简单,加个CLASSPATH就好。但是在pyLucene(JCC版)里,由于python所能够引用
到的Jar包都是用JCC这个编译器(姑且认为是个编译器吧)预先编译了python调用接口的。(反过来说,就是没有经JCC编译的Jar包是休想在
python里面直接访问的)

所以,在pyLucene中使用Jar包形式的中文分词器不得不重新编译。分隔线以下是OSFoundation某热心人关于如何修改Makefile
让Jar包可以和pyLucene打包到一起的回复。

-------------------------------------热心人回复的分隔
线-------------------------------------
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=$(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=$(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
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev


    Responder al autor    Reenviar  
Debes registrarte antes de enviar mensajes.
Para enviar una entrada, antes deberás formar parte del grupo.
Antes de enviar entradas, actualiza tu alias en la configuración de la suscripción.
No dispones del permiso necesario para enviar entradas.
Fin de los mensajes
« Volver a “Debates” « Tema más reciente     Tema anterior »

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