@Override
 public void map(
     Object key, Text value, OutputCollector<IntWritable, Text> output, Reporter reporter)
     throws IOException {
   String[] tokens = Recommend.DELIMITER.split(value.toString());
   String userID = tokens[0];
   int itemID = Integer.parseInt(tokens[1]);
   String pref = tokens[2];
   k.set(itemID);
   v.set(userID + ":" + pref);
   output.collect(k, v);
 }
Esempio n. 2
0
 @Override
 public void map(
     LongWritable key, Text values, OutputCollector<Text, IntWritable> output, Reporter reporter)
     throws IOException {
   String[] tokens = Recommend.DELIMITER.split(values.toString());
   for (int i = 1; i < tokens.length; i++) {
     String itemID = tokens[i].split(":")[0];
     for (int j = 1; j < tokens.length; j++) {
       String itemID2 = tokens[j].split(":")[0];
       k.set(itemID + ":" + itemID2);
       output.collect(k, v);
     }
   }
 }