Skip to content
Permalink
ac4b295237
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
38 lines (26 sloc) 1.08 KB
package kb.howtokb;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import org.json.simple.parser.ParseException;
import kb.howtokb.reader.TaskFrameReader;
import kb.howtokb.taskframe.WikiHowTaskFrame;
public class TaskFrameReaderTest {
public static void main(String[] args) throws ClassNotFoundException, IOException, ParseException {
String input = "/var/tmp/cxchu/data-wordnet/act-frame.json";
ArrayList<WikiHowTaskFrame> allframe = TaskFrameReader.extractWikiHowTaskFrameFromJSONFile(input);
Writer textout = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream("/var/tmp/cxchu/data-wordnet/act-frame-wikihow-task.json"), "utf-8"));
for (WikiHowTaskFrame f: allframe){
if (f.getActivity().getSubActivities().size() > 0){
textout.write(f.toJsonObject().toJSONString() + "\n");
}
//System.out.println(f.toString());
}
System.out.println("Total of frames: " + allframe.size());
textout.close();
}
}