Commit 584b40fb authored by dangq's avatar dangq

pair.java updated

parent fcb3be1d
...@@ -77,19 +77,6 @@ ...@@ -77,19 +77,6 @@
<option name="PORT" value="5005" /> <option name="PORT" value="5005" />
<method /> <method />
</configuration> </configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG"> <configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" /> <module name="" />
...@@ -118,6 +105,19 @@ ...@@ -118,6 +105,19 @@
<listeners /> <listeners />
<method /> <method />
</configuration> </configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application"> <configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" /> <option name="MAIN_CLASS_NAME" />
......
This diff is collapsed.
...@@ -28,13 +28,28 @@ public class Pair extends Configured implements Tool { ...@@ -28,13 +28,28 @@ public class Pair extends Configured implements Tool {
TextPair, // TODO: change Object to output key type TextPair, // TODO: change Object to output key type
IntWritable> { // TODO: change Object to output value type IntWritable> { // TODO: change Object to output value type
// TODO: implement mapper // TODO: implement mapper
protected void map(LongWritable key, Text text, Context context) { protected void map(LongWritable key, Text text, Context context) throws IOException, InterruptedException {
//TODO : //TODO :
String line = this.toString();
line = line.replaceAll("[^a-zA-Z0-9_]+", " ");
line = line.replaceAll("^\\s+", "");
String[] words = line.split("\\s+");
for (int i = 0; i < words.length - 1; i++) {
String first = words[i];
for (int j = 0; j < words.length - 1; j++) {
if (i != j){
String second = words[i + 1];
context.write(new TextPair(first, second), new IntWritable(1));}
}
}
}
}
//TextPair tp = new TextPair(); //TextPair tp = new TextPair();
//context.write(tp, IntWritable(1)); //context.write(tp, IntWritable(1));
}
}
public static class PairReducer public static class PairReducer
extends Reducer<TextPair, // TODO: change Object to input key type extends Reducer<TextPair, // TODO: change Object to input key type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment