public ArrayList<Text> serialize() throws HiveException {
    ArrayList<Text> result = new ArrayList<Text>();
    result.add(new Text(Integer.toString(k)));
    result.add(new Text(Integer.toString(n)));
    result.add(new Text(Integer.toString(pf)));
    for(Iterator<ArrayList<String> > it = ngrams.keySet().iterator(); it.hasNext(); ) {
      ArrayList<String> mykey = it.next();
      assert(mykey.size() > 0);
      for(int i = 0; i < mykey.size(); i++) {
        result.add(new Text(mykey.get(i)));
      }
      Double myval = ngrams.get(mykey);
      result.add(new Text(myval.toString()));
    }

    return result;
  }
In preparation for a Hive merge() call, serializes the current n-gram estimator object into an
ArrayList of Text objects. This list is deserialized and merged by the
merge method.

@return An ArrayList of Hadoop Text objects that represents the current
n-gram estimation.
@see #merge
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/NGramEstimator.java