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

1  
!752
2  
3  
static new Set<S> adjectives;
4  
5  
p {
6  
  S html = loadSnippet("#3000151");
7  
  L<S> tok = htmlcoarsetok(html);
8  
  L<L<S>> lis = findContainerTag(tok, "li");
9  
  for (L<S> li : lis) if (l(li) >= 20) {
10  
    print(l(li));
11  
    // split at <br>s
12  
    for (int i = 2; i < l(li); i += 2) {
13  
      S x = li.get(i).trim().toLowerCase();
14  
      if (!empty(x)) {
15  
        // first word only (e.g. "avid for" => "avid")
16  
        int idx = x.indexOf(' ');
17  
        if (idx >= 0) x = x.substring(0, idx);
18  
        
19  
        adjectives.add(x);
20  
        print(quote(x));
21  
      }
22  
    }
23  
  }
24  
  print(l(adjectives) + " adjectives.");
25  
}

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: 691 / 766
Referenced in: [show references]