Ted Pedersen
and 1 contributors


sort-bigrams.pl - Sort output from count.pl or statistic.pl in descending order based on frequency or association score


Sorts a given bigram file in the descending order of the bigram scores.


sort-bigrams.pl [OPTIONS] BIGRAM


Required Arguments:


Should be a bigram input file to be sorted. A BIGRAM file created by count.pl or statistic.pl is already sorted in the descending order of the bigram scores. A BIGRAM output of combig.pl or huge-combine.pl is however un-sorted and could be sorted using this program.

All lines in BIGRAM file should be formatted as -

 word1<>word2<>n11 n1p np1

Or as -

 word1<>word2<>rank score n11 n1p np1

Optional Arguments:

--frequency F

Bigrams with counts/scores less than F will not be displayed. The ignored bigrams are however not removed from the sample and their counts are still counted in the total bigrams and in the marginal word frequencies. In other words, the behavior of this option is like count.pl's --frequency option.

--remove L

Bigrams with counts/scores less than L are completely removed from the sample. Their counts do not affect any marginal totals. In other words, this option has the same effect as count.pl's --remove option.

Other Options :


Displays this message.


Displays the version information.


sort-bigrams.pl shows given BIGRAMs in the descending order of their counts/ scores.


Amruta Purandare, Ted Pedersen. University of Minnesota at Duluth.


Copyright (c) 2004,

Amruta Purandare, University of Minnesota, Duluth. pura0010@umn.edu

Ted Pedersen, University of Minnesota, Duluth. tpederse@umn.edu

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to

The Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.