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

18
LINES

< > BotCompany Repo | #1007544 // imSearch - Intelligence Machine search function

JavaX fragment (include)

static L<AIConcept> imSearch(S query) {
  query = trim(query);
  new Matches m;
  S qname = query, qcomment = query;
  if (flexMatch("* [*]", query, m)) {
    qname = $1;
    qcomment = $2;
  }
  new Map<AIConcept, Int> scores;
  for (AIConcept c : values(aiConceptsMap_cached())) {
    int score = scoredSearch_score(c.name, qname)*2;
    score += scoredSearch_score(c.comment, qcomment);
    if (eqic(c.globalID, query)) score += 10;
    if (score != 0)
      scores.put(c, score);
  }
  ret keysSortedByValuesDesc(scores);
}

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: #1007544
Snippet name: imSearch - Intelligence Machine search function
Eternal ID of this version: #1007544/7
Text MD5: 66b40c2ea804ae4dcec45e4b4511f269
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-29 16:52:17
Source code size: 544 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 448 / 445
Version history: 6 change(s)
Referenced in: [show references]