code: private ClassicCounter<Pair<F, L>> convertSVMStructWeights(ClassicCounter<Integer> weights, Index<F> featureIndex, Index<L> labelIndex) {
      // int numLabels = labelIndex.size();
      int numFeatures = featureIndex.size();
      ClassicCounter<Pair<F, L>> newWeights = new ClassicCounter<Pair<F, L>>();
      for (int i : weights.keySet()) {
        L l = labelIndex.get((i-1) / numFeatures); // integer division on purpose
        F f = featureIndex.get((i-1) % numFeatures);
        double w = weights.getCount(i);
        newWeights.incrementCount(new Pair<F, L>(f, l),w);
      }
  
      return newWeights;
    }
docs: Converts the svm_struct weight Counter (in which the weight for a feature/label pair
  correspondes to ((labelIndex * numFeatures)+(featureIndex+1))) into a weight Counter
  using the actual features and labels.