#!/bin/bash
# table2: generate numbers of table 2 of sasn2012 paper tks&bos
# usage: bin/table2
# note: fun from base directory
# 20120312 erikt(at)xs4all.nl

INFILE="data/20110216"
TMPFILE="table2.$$.$RANDOM"

echo "One party per tweet:"
# count tweets
bin/onePartyPerTweet < $INFILE  |\
   bin/grep.count.pl.test | cut -d' ' -f3- > $TMPFILE
# convert tweet counts to seats and compute offset
bin/tweets2seats.test < $TMPFILE | bin/offset.test | cut -d' ' -f1,2

echo -e "\nOne tweet per user:"
# count tweets
bin/oneTweetPerUser < $INFILE  |\
   bin/grep.count.pl.test | cut -d' ' -f3- > $TMPFILE
# convert tweet counts to seats and compute offset
bin/tweets2seats.test < $TMPFILE | bin/offset.test | cut -d' ' -f1,2

echo -e "\nBoth: use only first tweet with one party of each user:"
# count tweets
bin/onePartyPerTweet < $INFILE | bin/oneTweetPerUser |\
   bin/grep.count.pl.test | cut -d' ' -f3- > $TMPFILE
# convert tweet counts to seats and compute offset
bin/tweets2seats.test < $TMPFILE | bin/offset.test | cut -d' ' -f1,2

rm -f $TMPFILE
exit 0
