File size: 3,124 Bytes
3d3ae36 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | {
"task": {
"id": "case_20",
"name": "spam_message_detector",
"summary": "Detect spam messages based on appearance of spam keywords.",
"examples": [
{
"input": [
"BOS",
"poiVg",
"poiVg",
"now",
"b",
"V",
"now",
"now",
"TPSI",
"click"
],
"output": [
"BOS",
"not spam",
"not spam",
"spam",
"not spam",
"not spam",
"spam",
"spam",
"not spam",
"spam"
]
},
{
"input": [
"BOS",
"spam",
"offer",
"click",
"spam",
"oCLrZaW",
"J",
"poiVg",
"poiVg",
"offer"
],
"output": [
"BOS",
"not spam",
"spam",
"spam",
"not spam",
"not spam",
"not spam",
"not spam",
"not spam",
"spam"
]
},
{
"input": [
"BOS",
"no",
"V",
"poiVg",
"now",
"b",
"no",
"offer",
"TPSI",
"no"
],
"output": [
"BOS",
"not spam",
"not spam",
"not spam",
"spam",
"not spam",
"not spam",
"spam",
"not spam",
"not spam"
]
},
{
"input": [
"BOS",
"spam",
"spam",
"TPSI",
"spam",
"no",
"V",
"oCLrZaW",
"TPSI",
"b"
],
"output": [
"BOS",
"not spam",
"not spam",
"not spam",
"not spam",
"not spam",
"not spam",
"not spam",
"not spam",
"not spam"
]
},
{
"input": [
"BOS",
"b",
"LB",
"now",
"spam",
"click",
"LB",
"spam",
"b",
"J"
],
"output": [
"BOS",
"not spam",
"not spam",
"spam",
"not spam",
"spam",
"not spam",
"not spam",
"not spam",
"not spam"
]
}
],
"is_categorical": true
},
"program": "spam_keywords = {\"free\", \"offer\", \"click\", \"now\"}\nkeyword_count = rasp.Map(lambda x: sum(x == keyword for keyword in spam_keywords), sop)\nis_spam = rasp.Map(lambda x: \"spam\" if x > 0 else \"not spam\", keyword_count)\nreturn is_spam",
"components": [
{
"id": "L0_MLP",
"hook": "blocks.0.mlp.hook_post",
"role": {
"tag": "MAPPER",
"note": "Checks each token for membership in a spam-keyword set and emits a spam/not-spam label for that position."
},
"rasp_vars": [
"keyword_count",
"is_spam"
],
"labels": [
"map_1"
]
}
]
}
|