mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Farris <>
Subject Re: term collocation from lucene index
Date Tue, 14 Jun 2011 03:33:06 GMT
Hi Peter,

Apologies for the delay in following up on this.

The error you're seeing is as a result of the output of the
lucene.vector task being incompatible with the input of CollocDriver.
They each write and read sequence files containing different types of

The sequence files produced by the lucene.vector task have a key type
of LongWritable and a value type of VectorWritable, the vectors
themselves do not retain references to the word position in the
original document, but merely encode the word as an id from the
dictionary that is generated as a part of the process and a weight
based upon the occurrences of the term in the index and the parameters
you specified when you called lucene.vector. As positional information
is not retained you can not use these vectors as input to the
CollocDriver code which relies on word proximity to form collocations.

The CollocDriver expects the sequence files it uses as input to have a
key type of Text and value type of StringTuple. Sequence Files with a
key of Text and value of Text are also acceptable if the preprocess
option is specified. In either case the key is document id, while the
value is the text of a document either tokenized in StringTuple form
or untokenized in Text form.

To produce sequence files suitable for generating collocations from a
Lucene index, you'll need to write some code pull the text from a
stored field or re-construct the text from a term vector with
positional information. You can then write this to a sequence file
that will work with CollocDriver. The
org.apache.mahout.utils.vectors.lucene.Driver class is a good starting
point for learning how to extract data from a Lucene index and write
data to sequence files.


On Fri, Jun 10, 2011 at 5:03 PM, Peter Andrews <> wrote:
> Hi,
> I just started using Mahout a few or two ago and so far its been pretty
> good. I working on some term collocation and while I have been working from
> a directory of files, I want to switch to using lucene indexes as that is
> the format the files are already in. I am trying to use the lucene.vector to
> turn the indexes into vector and then use
> org.apache.mahout.vectorizer.collocations.llr.CollocDriver to generate the
> collocations and LLRs. I keep getting this error when I run CollocDriver,
> any ideas?
> java.lang.ClassCastException: cannot be
> cast to
> at
> at
> at org.apache.hadoop.mapred.MapTask.runNewMapper(
> at
> at org.apache.hadoop.mapred.Child$
> at Method)
> at
> at
> at org.apache.hadoop.mapred.Child.main(
> --
> Peter Andrews

View raw message