Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1008475 // Load most common english words from Wikipedia [doesn't work anymore]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (4663L/30K/104K).

!7

p-tt {
  S html = loadPage("https://en.wikipedia.org/wiki/Most_common_words_in_English");
  L<S> tok = htmlTok(html);
  new TreeMap<Int, S> map;
  for (L<S> toktable : /*dropFirst*/(findContainerTagDeep(tok, "table"))) {
    LL<S> tokTH = map(f textOfContainerTag, html_findTHs(toktable));
    printStruct("TH: ", tokTH);
    if (eq(tokTH, ll("Rank", "Word"))) {
      print("Yay!");
      for (L<S> tr : html_findTRs(toktable)) {
        L<S> bla = map(f textOfContainerTag, html_findTDs(tr));
        printStruct("TDs: ", bla);
        if (l(bla) == 2 && isInteger(first(bla)))
          map.put(parseInt(first(bla)), second(bla));
      }
    }
  }
  printAsciiHeading("Here are the words!");
  pnl(values(map));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008475
Snippet name: Load most common english words from Wikipedia [doesn't work anymore]
Eternal ID of this version: #1008475/19
Text MD5: 8131163b13c510de475c42a6d9cb1399
Transpilation MD5: 7210577a02ea97cae56b894fb9791b9e
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-29 20:11:53
Source code size: 742 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 631 / 736
Version history: 18 change(s)
Referenced in: [show references]