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

25
LINES

< > BotCompany Repo | #1002311 // Load scraped adjectives (test)

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

Libraryless. Click here for Pure Java version (1402L/10K/31K).

!752

static new Set<S> adjectives;

p {
  S html = loadSnippet("#3000151");
  L<S> tok = htmlcoarsetok(html);
  L<L<S>> lis = findContainerTag(tok, "li");
  for (L<S> li : lis) if (l(li) >= 20) {
    print(l(li));
    // split at <br>s
    for (int i = 2; i < l(li); i += 2) {
      S x = li.get(i).trim().toLowerCase();
      if (!empty(x)) {
        // first word only (e.g. "avid for" => "avid")
        int idx = x.indexOf(' ');
        if (idx >= 0) x = x.substring(0, idx);
        
        adjectives.add(x);
        print(quote(x));
      }
    }
  }
  print(l(adjectives) + " adjectives.");
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002311
Snippet name: Load scraped adjectives (test)
Eternal ID of this version: #1002311/1
Text MD5: 1067d5bbdf18fdc561942f9ef238d71b
Transpilation MD5: ccfc60ab7b4238ec481e3dcc434fa6a2
Author: stefan
Category: nl bots
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-04 18:21:57
Source code size: 628 bytes / 25 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 574 / 621
Referenced in: #1002314 - List Of Adjectives Bot
#3000190 - Answer for stefanreich(>> t 20 questions)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)