public void extractActionConceptGlobally() throws Exception { loadArgumentGlobal(); int size = upperBound - lowerBound; Wordnet wn = new Wordnet(true); Probase[] pcs = new Probase[size]; for (int i = 0; i < size; ++i) { pcs[i] = new Probase(); } Probase.initialization(); Runnable[] eNA = new Runnable[size]; for (int i = 0; i < size; ++i) { eNA[i] = new extractActionConceptGlobalRunner( i + lowerBound, offset, subjSet, objSet, pcs[i], wn, ACI_OUTPUT, ACC_GLB_OUTPUT); } Thread[] tdA = new Thread[size]; for (int i = 0; i < size; ++i) { tdA[i] = new Thread(eNA[i]); tdA[i].start(); } for (int i = 0; i < size; ++i) { tdA[i].join(); } return; }
public void extractActionConceptFromActionInstance() throws Exception { int size = upperBound - lowerBound; HashMap<String, List<String>> verb2Subj = new HashMap<>(); HashMap<String, List<String>> verb2Obj = new HashMap<>(); String line; String[] splitted; File folder = new File(ARG_URL); for (File file : folder.listFiles()) { String verb = file.getName().replace(".txt", ""); BufferedReader fileReader = new BufferedReader(new FileReader(file)); List<String> subjList = new ArrayList<>(); List<String> objList = new ArrayList<>(); line = fileReader.readLine().trim(); if (line.length() > 0) { splitted = line.split("\t"); for (String subj : splitted) { subjList.add(subj); } } verb2Subj.put(verb, subjList); line = fileReader.readLine(); if (line != null) { line = line.trim(); if (line.length() > 0) { splitted = line.split("\t"); for (String obj : splitted) { objList.add(obj); } } } verb2Obj.put(verb, objList); fileReader.close(); } Wordnet wn = new Wordnet(true); /* ProbaseClient[] pcs = new ProbaseClient[size]; for(int i = 0; i < size; ++i){ pcs[ i ] = new ProbaseClient(4500 + i); }*/ Probase[] pcs = new Probase[size]; for (int i = 0; i < size; ++i) { pcs[i] = new Probase(); } Probase.initialization(); Runnable[] eNA = new Runnable[size]; for (int i = 0; i < size; ++i) { eNA[i] = new extractActionConceptRunner( i + lowerBound, offset, verb2Subj, verb2Obj, pcs[i], wn, ACI_OUTPUT, ACC_OUTPUT); } Thread[] tdA = new Thread[size]; for (int i = 0; i < size; ++i) { tdA[i] = new Thread(eNA[i]); tdA[i].start(); } for (int i = 0; i < size; ++i) { tdA[i].join(); } return; }