TestParsed.java
Go to the documentation of this file.
00001 package instruction.test;
00002 
00003 import java.io.File;
00004 import java.util.Iterator;
00005 import java.util.List;
00006 import java.util.Map;
00007 import java.util.Set;
00008 
00009 import instruction.configuration.ConfigurationManager;
00010 import instruction.importer.PlanImporter;
00011 import instruction.opencyc.OpenCyc;
00012 import instruction.wrapper.LocalParseTree;
00013 
00014 public class TestParsed {
00015 
00019         public static void main(String[] args) {
00020 
00021                 ConfigurationManager.loadSettings();
00022 
00023                 PlanImporter importer = new PlanImporter();
00024                 try {
00025                         importer.initialize();
00026 
00027                         System.out.println("Initializing Plan-Importer...");
00028                         Map<String, List<String>> mappings = ConfigurationManager
00029                                         .getMappings();
00030                         Set<String> synsets = mappings.keySet();
00031                         for (Iterator<String> i = synsets.iterator(); i.hasNext();) {
00032                                 String synset = i.next();
00033                                 List<String> concepts = mappings.get(synset);
00034                                 for (Iterator<String> j = concepts.iterator(); j.hasNext();) {
00035                                         OpenCyc.getInstance().addMapping(synset, j.next());
00036                                 }
00037                         }
00038                         importer.getDisambiguator().load(
00039                                         ConfigurationManager.getPathDisambiguator());
00040                         System.out.println("Plan-Importer initialized.");
00041 
00042                         int r;
00043                         String s = "";
00044                         do {
00045                                 r = System.in.read();
00046                                 if (r != (char) '\n' && r != (char) '\r')
00047                                         s += (char) r;
00048                         } while (r != (char) '\n');
00049 
00050                         String filePath = "D:/ba_workspace/instruction_factory/parsed/"
00051                                         + s.replaceAll(" ", "_");
00052 
00053                         if (new File(filePath).exists()) {
00054                                 LocalParseTree wrapper = new LocalParseTree();
00055                                 wrapper.load(filePath);
00056                                 importer.setWrapper(wrapper);
00057                                 importer.parseInstructions();
00058                                 importer.recognizeAndDisambiguateInstructions();
00059                                 importer.convert2CycAssertions();
00060                         }
00061                 } catch (Exception e) {
00062                         // TODO Auto-generated catch block
00063                         e.printStackTrace();
00064                 }
00065         }
00066 
00067 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


comp_ehow
Author(s): Moritz Tenorth, Daniel Nyga
autogenerated on Tue Apr 16 2013 00:18:03