package org.hackreduce.models.ngram;

import org.apache.hadoop.io.Text;


public class TwoGram extends Gram {

    private String gram1;
    private String gram2;

    public TwoGram(String inputString) {
        super(inputString);
        setGram1(getLineElements()[0]);
        setGram2(getLineElements()[1]);
    }

    public TwoGram(Text inputText) {
        this(inputText.toString());
    }


    public String getGram1() {
        return gram1;
    }
    public void setGram1(String gram1) {
        this.gram1 = gram1;
    }
    public String getGram2() {
        return gram2;
    }
    public void setGram2(String gram2) {
        this.gram2 = gram2;
    }

    @Override
    public String getGrams() {
        return getGram1() + " " + getGram2();
    }
}

@@ -234,25 +234,33 @@
         
-setGram1(
+String%5B%5D grams = 
 getLineE
@@ -271,16 +271,26 @@
 nts()%5B0%5D
+.split(%22 %22
 );%0A     
@@ -303,27 +303,43 @@
 Gram
-2(getLineElements()
+1(grams%5B0%5D);%0A        setGram2(grams
 %5B1%5D)

Fix TwoGram model to properly set grams.