We find the weight vector w by online learning using a variant of the structured perceptron (Collins, 2002).
we use the passive-aggressive (PA) algorithm (Crammer et al., 2006), since we found that this performed slightly better in preliminary experiments.