PrepareActionsPostProcessor.java
Go to the documentation of this file.
00001 package instruction.postprocessor;
00002 
00003 import instruction.semanticObjects.Action;
00004 import instruction.semanticObjects.Instruction;
00005 import instruction.semanticObjects.Preposition;
00006 import instruction.semanticObjects.Word;
00007 import instruction.wordnet.WordNetRDF2;
00008 
00009 import java.util.List;
00010 
00011 public class PrepareActionsPostProcessor implements PostProcessor {
00012 
00013         public void run(List<Instruction> instructions) {
00014 
00015                 try {
00016                         for (int i = 0; i < instructions.size(); i++) {
00017                                 Instruction curInst = instructions.get(i);
00018                                 Action action = curInst.getAction();
00019 
00020                                 for (int j = 0; j < curInst.getPrepositions().size(); j++) {
00021 
00022                                         String tmpAction = action.getAction().getLabel();
00023                                         Preposition prep = curInst.getPrepositions().get(j);
00024 
00025                                         if (prep.getPrepositions().size() == 1) {
00026 
00027                                                 tmpAction += " "
00028                                                                 + prep.getPrepositions().get(0).getLabel();
00029                                                 if (WordNetRDF2.wordExistsAs(tmpAction, WordNetRDF2
00030                                                                 .convertPOS(Word.TYPE_VERB_INFINITIVE))
00031                                                                 && curInst.getObjects().isEmpty()) {
00032                                                         action.setAction(new Word(
00033                                                                         Word.TYPE_VERB_INFINITIVE, tmpAction));
00034                                                         action
00035                                                                         .getAction()
00036                                                                         .setSynSetIDs(
00037                                                                                         WordNetRDF2
00038                                                                                                         .getSynsets(
00039                                                                                                                         tmpAction,
00040                                                                                                                         WordNetRDF2
00041                                                                                                                                         .convertPOS(Word.TYPE_VERB_INFINITIVE)));
00042                                                         curInst.getObjects().addAll(prep.getObjects());
00043                                                         curInst.getPrepositions().remove(j);
00044                                                 }
00045                                         }
00046                                 }
00047 
00048                         }
00049                 } catch (Exception e) {
00050                         System.out.println(e.getMessage());
00051                 }
00052         }
00053 
00054 }
 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