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: Japanese analyzer not found
Date Thu, 16 Apr 2015 17:05:28 GMT

On Thu, 16 Apr 2015, Eric Lambert wrote:

> I've just done a fresh install of pylucene 4.10.1-1 and for the life of me,
> can't find or get the JapaneseAnalyzer to work or be found:
>
> 09:01:10 2 0> python
> Python 2.7.2 (default, Sep  6 2012, 13:28:22)
> [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from org.apache.lucene.analysis.ja import JapaneseAnalyzer;
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named org.apache.lucene.analysis.ja
>>>> import lucene
>>>> from org.apache.lucene.index import IndexReader, DirectoryReader
>>>> from org.apache.lucene.store import SimpleFSDirectory
>>>> from org.apache.lucene.analysis.ja import JapaneseAnalyzer
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named ja
>>>> from org.apache.lucene.document import Document, Field, FieldType
>>>> from org.apache.lucene.util import Version
>>>> from org.apache.lucene.search import TermQuery, BooleanQuery
>>>> from org.apache.lucene.index import IndexWriter, IndexWriterConfig
>>>> from java.io import File
>>>>
>
> What am I missing???

Two things:
   - first, please subscribe to the list by sending mail to
     pylucene-dev-subscribe@lucene.apache.org and following the instructions
     in the response.

   - the JapanasesAnalyzer itself (!)
     The JAR file that contains this class, lucene-analyzers-kuromoji...jar,
     is not on the JCC command line in PyLucene's Makefile and thus no
     wrappers are generated for public classes in it.

I've now added it in rev 1674112 of the 4.10 release branch:
   https://svn.apache.org/repos/asf/lucene/pylucene/branches/pylucene_4_10

After rebuilding PyLucene, the JapaneseAnalyzer class becomes available.
For the actual diffs, see below.

Andi..

Index: Makefile
===================================================================
--- Makefile	(revision 1665408)
+++ Makefile	(working copy)
@@ -15,7 +15,7 @@
  # site-packages directory.
  #

-VERSION=4.10.4-1
+VERSION=4.10.4-2
  LUCENE_SVN_VER=HEAD
  LUCENE_VER=4.10.4
  LUCENE_SVN=http://svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_4_10_4
@@ -163,6 +163,7 @@
  JARS+=$(FACET_JAR)              # facet module
  JARS+=$(SUGGEST_JAR)            # suggest/spell module
  JARS+=$(EXPRESSIONS_JAR)        # expressions module
+JARS+=$(KUROMOJI_JAR)           # japanese analyzer module


  #
@@ -193,6 +194,7 @@
  FACET_JAR=$(LUCENE)/build/facet/lucene-facet-$(LUCENE_VER).jar
  SUGGEST_JAR=$(LUCENE)/build/suggest/lucene-suggest-$(LUCENE_VER).jar
  EXPRESSIONS_JAR=$(LUCENE)/build/expressions/lucene-expressions-$(LUCENE_VER).jar
+KUROMOJI_JAR=$(LUCENE)/build/analysis/kuromoji/lucene-analyzers-kuromoji-$(LUCENE_VER).jar

  MISC_JAR=$(LUCENE)/build/misc/lucene-misc-$(LUCENE_VER).jar
  ANTLR_JAR=$(LUCENE)/expressions/lib/antlr-runtime-3.5.jar
@@ -284,6 +286,9 @@
  $(EXPRESSIONS_JAR): $(LUCENE_JAR)
  	cd $(LUCENE)/expressions; $(ANT) -Dversion=$(LUCENE_VER)

+$(KUROMOJI_JAR): $(LUCENE_JAR)
+	cd $(LUCENE)/analysis/kuromoji; $(ANT) -Dversion=$(LUCENE_VER)
+
  $(MISC_JAR): $(LUCENE_JAR)
  	cd $(LUCENE)/misc; $(ANT) -Dversion=$(LUCENE_VER)


Mime
View raw message