$search
00001 package instruction.test; 00002 00003 import instruction.disambiguator.Disambiguator; 00004 import instruction.importer.PlanImporter; 00005 import instruction.wrapper.LocalFileWrapper; 00006 import java.io.File; 00007 00008 public class ParserTest { 00009 00013 public static void main( String[] args ) { 00014 00015 PlanImporter importer = new PlanImporter(); 00016 00017 try { 00018 importer.initialize(); 00019 System.out.println("Type the path to a HowTo:"); 00020 while ( true ) { 00021 System.out.print(">"); 00022 String s = ""; 00023 int r; 00024 do { 00025 r = System.in.read(); 00026 if (r != (char) '\n' && r != (char) '\r') 00027 s += (char) r; 00028 } 00029 while ( r != (char) '\n' ); 00030 if (s.equals( "train" )) 00031 importer.getDisambiguator().setRunMode( Disambiguator.MODE_TRAIN ); 00032 else if (s.equals( "apply" )) 00033 importer.getDisambiguator().setRunMode( Disambiguator.MODE_APPLY ); 00034 else if (s.equals( "save" )) 00035 importer.getDisambiguator().save( (new File(".")).getAbsolutePath() + File.separator + "etc/disambiguator.xml" ); 00036 else if (s.equals( "load" )) 00037 importer.getDisambiguator().load( (new File(".")).getAbsolutePath() + File.separator + "etc/disambiguator.xml" ); 00038 else { 00039 LocalFileWrapper wrapper = new LocalFileWrapper(); 00040 wrapper.load( new File(".").getCanonicalPath() + File.separator + s ); 00041 importer.importHowto( wrapper ); 00042 } 00043 } 00044 } 00045 catch ( Exception e ) { 00046 e.printStackTrace(); 00047 } 00048 00049 00050 } 00051 }