public List<CoreMap> getAPIElementSentences(boolean parse) { List<CoreMap> sentences = section.sentences; // getAllSentences(parse); List<CoreMap> apiSentences = new ArrayList<CoreMap>(); String formattedAPI = apiElement .getAPIElementName() .replaceAll("\\(", "") .replaceAll("\\)", "") .replaceAll("\\.", "-") .toLowerCase(); if (sentences == null) System.out.println("Warning"); for (CoreMap sent : sentences) { if (sent.toString().toLowerCase().indexOf("clt_" + formattedAPI) != -1) apiSentences.add(sent); } if (apiSentences.isEmpty()) System.out.println( "WARNGING: In getAPIElementSentences " + apiElement.getAPIElementName() + "," + section.getSubTitle()); return apiSentences; }
public void saveToFile(String saveFilePath) { try { CSVWriter writer = new CSVWriter(new FileWriter(saveFilePath, true)); writer.writeNext( new String[] { section.getSubTitle(), apiElement.getAPIElementName(), Boolean.toString(label) }); writer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }