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).

1  
!7
2  
3  
p-tt {
4  
  S html = loadPage("https://en.wikipedia.org/wiki/Most_common_words_in_English");
5  
  L<S> tok = htmlTok(html);
6  
  new TreeMap<Int, S> map;
7  
  for (L<S> toktable : /*dropFirst*/(findContainerTagDeep(tok, "table"))) {
8  
    LL<S> tokTH = map(f textOfContainerTag, html_findTHs(toktable));
9  
    printStruct("TH: ", tokTH);
10  
    if (eq(tokTH, ll("Rank", "Word"))) {
11  
      print("Yay!");
12  
      for (L<S> tr : html_findTRs(toktable)) {
13  
        L<S> bla = map(f textOfContainerTag, html_findTDs(tr));
14  
        printStruct("TDs: ", bla);
15  
        if (l(bla) == 2 && isInteger(first(bla)))
16  
          map.put(parseInt(first(bla)), second(bla));
17  
      }
18  
    }
19  
  }
20  
  printAsciiHeading("Here are the words!");
21  
  pnl(values(map));
22  
}

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: 539 / 634
Version history: 18 change(s)
Referenced in: [show references]