Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public ArrayList<String> getMeaning(String word) throws IOException {
  2. ArrayList<String> meanings = new ArrayList<>();
  3. URL url = new URL(web + word);
  4. BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
  5. String line;
  6. boolean start = false;
  7. while ((line = reader.readLine()) != null) {
  8. if (line.indexOf("td class=search-table-header") >= 0)
  9. start = false;
  10. if (line.indexOf("English-Thai: Nontri Dictionary") >= 0)
  11. start = true;
  12. if (start) {
  13. if (isPreferedWord(line, word)) {
  14. String mean = getMeaningofLine(line);
  15. if(mean != null) meanings.add("\t" + mean.replaceAll(",", ", "));
  16. }
  17. }
  18. }
  19. reader.close();
  20. return meanings;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement