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

23
LINES

< > BotCompany Repo | #1007670 // conceptsFromDump

JavaX fragment (include)

1  
static L<AIConcept> conceptsFromDump(S s) {
2  
  new L<L<S>> l;
3  
  if (neq(first(javaTokC(s)), "[")) {
4  
    for (S line : toLinesFullTrim(s)) {
5  
      int i = line.indexOf(" - ");
6  
      if (i > 0) {
7  
        S id = trim(substring(line, 0, i));
8  
        if (!possibleGlobalID(id)) warn("no id: " + id);
9  
        else
10  
          l.add(ll(id, trim(substring(line, i+3))));
11  
      }
12  
    }
13  
  } else
14  
    l = (L) safeUnstructure("[" + s + "]");
15  
  new L<AIConcept> out;
16  
  for (L<S> x : l) {
17  
    AIConcept c = unlisted(AIConcept);
18  
    S id = makeNewID(get(x, 0));
19  
    cset(c, globalID := id, name := unnull(get(x, 1)), comment := unnull(get(x, 2)));
20  
    out.add(c);
21  
  }
22  
  ret out;
23  
}

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: #1007670
Snippet name: conceptsFromDump
Eternal ID of this version: #1007670/4
Text MD5: e39a20ae5c458fbb271a08620d8a15cf
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-21 16:34:39
Source code size: 684 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 579 / 561
Version history: 3 change(s)
Referenced in: [show references]