-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent_classifier.cod
More file actions
31 lines (29 loc) · 884 Bytes
/
content_classifier.cod
File metadata and controls
31 lines (29 loc) · 884 Bytes
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
module content_classifier
def classify_content
intent "classify a message as safe, unsafe, or uncertain based on keyword signals"
sig (message: String) -> Label
effects {}
cand
intent "unsafe — contains harmful keyword"
when or(
contains(lower(message), "spam"),
contains(lower(message), "hate"),
contains(lower(message), "violence")
)
belief("unsafe", 0.90)
cand
intent "safe — contains approval keyword"
when or(
contains(lower(message), "approved"),
contains(lower(message), "verified")
)
belief("safe", 0.90)
cand
intent "uncertain — no keyword match"
belief("uncertain", 0.75)
def main
intent "test classify_content with a sample message"
sig () -> Label
effects {}
cand
classify_content("This message contains spam")