Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 54E95FE87 for ; Tue, 19 Mar 2013 19:14:03 +0000 (UTC) Received: (qmail 21003 invoked by uid 500); 19 Mar 2013 19:14:01 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 20900 invoked by uid 500); 19 Mar 2013 19:14:01 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 20890 invoked by uid 99); 19 Mar 2013 19:14:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Mar 2013 19:14:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sashidhar.moony@gmail.com designates 209.85.212.46 as permitted sender) Received: from [209.85.212.46] (HELO mail-vb0-f46.google.com) (209.85.212.46) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Mar 2013 19:13:54 +0000 Received: by mail-vb0-f46.google.com with SMTP id b13so554617vby.5 for ; Tue, 19 Mar 2013 12:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=hcAkKydQlhmHKndP75FunfNPh/P7wpGUyjiYiRiBpLc=; b=OwxpJpyhZeUtMRp2tKVp/PF7UcdMI2xloivQBQVxpymTpHmSSEMW+1Kz9XvAYwqbXE /iCqpCuuSCaoBD0a+4Q+qohgR39Q77UaUQDqkX5a8u1c3cTzdpb/U3iGATMmMHQwSJPD zhCeSfbY3OTS2HN3BsEHjT1gfO4/0+wX8VUzbt/jtkIttycLY5GR2FMddd/FJ5CtPA0z g2HPNs4gHOukj4KZbQBZUDFk2ixiPpYz/43adMcmMz9Nu6QbhNp+cvx0CwU1/Jasp5Nw BGvJbGj97P06NlYsdN2iQT7woUPvl4HPWHkq5g69LmyrZrgmvJO3hA0nShZBJ2Z30fbv twBA== MIME-Version: 1.0 X-Received: by 10.52.180.195 with SMTP id dq3mr3706436vdc.9.1363720413438; Tue, 19 Mar 2013 12:13:33 -0700 (PDT) Received: by 10.58.94.39 with HTTP; Tue, 19 Mar 2013 12:13:33 -0700 (PDT) Date: Tue, 19 Mar 2013 15:13:33 -0400 Message-ID: Subject: problem with wikipedia tokenizer From: Sashidhar Guntury To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=bcaec51969f3d12dd904d84be65f X-Virus-Checked: Checked by ClamAV on apache.org --bcaec51969f3d12dd904d84be65f Content-Type: text/plain; charset=ISO-8859-1 hi I'm using lucene to query from wiki dump and get the categories out. So, I get the relevant documents and for every document, I call the below function. static List getCategories(Document document) throws IOException { List categories = new ArrayList(); String text = document.get("text"); WikipediaTokenizer tf = new WikipediaTokenizer(new StringReader(text)); CharTermAttribute termAtt = tf.addAttribute(CharTermAttribute.class); TypeAttribute typeAtt = tf.addAttribute(TypeAttribute.class); while (tf.incrementToken()) { String tokText = termAtt.toString(); if (typeAtt.type().equals(WikipediaTokenizer.CATEGORY) == true) { categories.add(tokText); } } return categories; } but it throws the following error (at the while statement) Exception in thread "main" java.lang.NullPointerException at org.apache.lucene.analysis.wikipedia.WikipediaTokenizerImpl.zzRefill(WikipediaTokenizerImpl.java:574) at org.apache.lucene.analysis.wikipedia.WikipediaTokenizerImpl.getNextToken(WikipediaTokenizerImpl.java:781) at org.apache.lucene.analysis.wikipedia.WikipediaTokenizer.incrementToken(WikipediaTokenizer.java:200) at SearchIndex.getCategories(SearchIndex.java:82) at SearchIndex.main(SearchIndex.java:54) I looked at zzRefill() function but it I'm not able to understand it. Is this a known bug or something? I don't know what am I doing wrong. The lucene guys says that the whole wikipediaTokenizer section is in beta and maybe be subject to changes. I was hoping someone could help me. thanks sashidhar --bcaec51969f3d12dd904d84be65f--