@@ -0,0 +1,1338 @@
+/*%0A * PURPOSE%0A *  getting input with PostsDAO and writing output with CountersDAO%0A *  the document, which was stored in Posts table, is parsed by KoreanParser%0A *  into words that have meanings themselves.%0A *  and the permutations of the words are counted in CountersTable%0A */%0A%0Apackage hbase.counter;%0A%0Aimport hbase.dao.CountersDAO;%0Aimport hbase.dao.PostsDAO;%0A%0Aimport java.io.IOException;%0Aimport java.util.List;%0A%0Aimport org.apache.hadoop.hbase.client.Put;%0Aimport org.apache.hadoop.hbase.client.Result;%0Aimport org.apache.hadoop.hbase.io.ImmutableBytesWritable;%0Aimport org.apache.hadoop.hbase.mapreduce.TableMapper;%0Aimport org.apache.hadoop.io.Text;%0A%0Aimport parser.KoreanParser;%0A%0Apublic class Mapper%09extends TableMapper%3CText, Put%3E %7B%0A%0A%09private KoreanParser parser = new KoreanParser();%0A%0A%09protected void map(ImmutableBytesWritable rowkey, Result result, %0A%09%09%09Context context) throws IOException %7B%0A%09%09%0A%09%09PostsDAO pDao = new PostsDAO();%0A%09%09CountersDAO cDao = new CountersDAO();%09%09%0A%09%09%0A%09%09String doc = pDao.getTitle(result) + %22 %22 + pDao.getContent(result);%0A%09%09%0A%09%09List%3CString %3Ewords = parser.extractDistinctWords(doc);%0A%0A%09%09// counting the permutations using a hbase table%0A%09%09for (String w1 : words) %7B%0A%09%09%09for (String w2 : words) %7B%0A%09%09%09%09// ignore two same words.%0A%09%09%09%09if (w1.equals(w2)) continue;%0A%09%09%09%09%0A%09%09%09%09cDao.incCount(w1 + %22:%22 + w2, 1);%09%09%09%09%09%09%09%09%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create Mapper.java