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

19
LINES

< > BotCompany Repo | #300 // Ranker that excludes really boring results (nil etc)

Lua code

get("#265") -- json.encode, json.decode

function acceptable(e)
  local r = e.r_result
  if r == 'nil' or r == 'I hate it!'
    --[[or r == 'I like it!']] then return false end
  if string.find(r, "^org.luaj.vm2.LuaError") then return false end
  return true
end

lst = json.decode(input)
newlst = {}
for _, e in ipairs(lst) do
  if acceptable(e) then
    table.insert(newlst, e)
  end
end

return json.encode(newlst)

test run  test run with input  download  show line numbers   

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

Comments [hide]

ID Author/Program Comment Date
653 #1000610 Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

public static void main(String[] args) throws Exception {
get("#265") -- json.encode, json.decode

function acceptable(e)
local r = e.r_result
if r == 'nil' or r == 'I hate it!'
--[[or r == 'I like it!']] then return false end
if string.find(r, "^org.luaj.vm2.LuaError") then return false end
return true
end

lst = json.decode(input)
newlst = {}
for _, e in ipairs(lst) do
if acceptable(e) then
table.insert(newlst, e)
end
end

return json.encode(newlst)
}}
2015-08-19 04:40:07  delete 
651 #1000604 (pitcher) 2015-08-18 00:07:22

add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 435 [visualize]

Snippet ID: #300
Snippet name: Ranker that excludes really boring results (nil etc)
Eternal ID of this version: #300/1
Text MD5: 7ad37b43f78ac9200077286a9a4075db
Author: stefan
Category: image recognition rankers
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2014-12-08 21:04:24
Source code size: 435 bytes / 19 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 1145 / 222
Referenced in: #3000382 - Answer for ferdie (>> t = 1, f = 0)