You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by manjula wijewickrema <ma...@gmail.com> on 2010/05/20 11:15:23 UTC

Arrange terms[i]

Hi,

I wrote aprogram to get the ferquencies and terms of an indexed document.
The output comes as follows;


If I print : +tfv[0]

Output:

array terms are:{title: capabl/1, code/2, frequenc/1, lucen/4, over/1,
sampl/1, term/4, test/1}

In the same way I can print terms[i] and freqs[i], but the problem is while
I am printing terms[i], output (array elements) comes according to the
English alphabetic order (as above) and freqs[i] also arrange according that
particular order. Is there a way to arrange terms[i] according to the
ascending/descending order of their frequencies?

Thanx in advance.

Manjula

Re: Arrange terms[i]

Posted by manjula wijewickrema <ma...@gmail.com>.
Dear Grant,

Thanks for your reply.

Manjula

On Mon, May 24, 2010 at 4:37 PM, Grant Ingersoll <gs...@apache.org>wrote:

>
> On May 20, 2010, at 5:15 AM, manjula wijewickrema wrote:
>
> > Hi,
> >
> > I wrote aprogram to get the ferquencies and terms of an indexed document.
> > The output comes as follows;
> >
> >
> > If I print : +tfv[0]
> >
> > Output:
> >
> > array terms are:{title: capabl/1, code/2, frequenc/1, lucen/4, over/1,
> > sampl/1, term/4, test/1}
> >
> > In the same way I can print terms[i] and freqs[i], but the problem is
> while
> > I am printing terms[i], output (array elements) comes according to the
> > English alphabetic order (as above) and freqs[i] also arrange according
> that
> > particular order. Is there a way to arrange terms[i] according to the
> > ascending/descending order of their frequencies?
>
> Yes, have a look at the TermVectorMapper.  You will need to implement a
> variation of this to build up the data structures you need.
>
> -Grant
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Arrange terms[i]

Posted by Grant Ingersoll <gs...@apache.org>.
On May 20, 2010, at 5:15 AM, manjula wijewickrema wrote:

> Hi,
> 
> I wrote aprogram to get the ferquencies and terms of an indexed document.
> The output comes as follows;
> 
> 
> If I print : +tfv[0]
> 
> Output:
> 
> array terms are:{title: capabl/1, code/2, frequenc/1, lucen/4, over/1,
> sampl/1, term/4, test/1}
> 
> In the same way I can print terms[i] and freqs[i], but the problem is while
> I am printing terms[i], output (array elements) comes according to the
> English alphabetic order (as above) and freqs[i] also arrange according that
> particular order. Is there a way to arrange terms[i] according to the
> ascending/descending order of their frequencies?

Yes, have a look at the TermVectorMapper.  You will need to implement a variation of this to build up the data structures you need.

-Grant
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org