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

15
LINES

< > BotCompany Repo | #1008480 // Load most common english words by category from a Wikipedia page listing them [WORKS]

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

Libraryless. Click here for Pure Java version (2597L/17K/58K).

!7

p-tt {
  S html = loadPage("https://en.wikipedia.org/wiki/Most_common_words_in_English");
  L<S> tok = htmlTok(html);
  Map<S, L<S>> map = new LinkedHashMap;
  for (L<S> ol : findContainerTagDeep(tok, "ol")) {
    S category = textOfContainerTag(last(findContainerTag(subList(tok, 0, indexOfSubList(tok, ol)+1), "h3")));
    L<S> words = map(f textOfContainerTag, html_findLIs(ol));
    if (!first(words).contains(" "))
      map.put(category, words);
  }
  printAsciiHeading("Words by category!");
  psl(map);
}

Author comment

Began life as a copy of #1008475

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: #1008480
Snippet name: Load most common english words by category from a Wikipedia page listing them [WORKS]
Eternal ID of this version: #1008480/10
Text MD5: 8fb11daae6a67f6eddff0a1a8850303d
Transpilation MD5: 876ffd364189f21187987f63e290c582
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-18 17:06:51
Source code size: 530 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 614 / 721
Version history: 9 change(s)
Referenced in: [show references]