-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActionPatterns.hs
42 lines (30 loc) · 1.39 KB
/
ActionPatterns.hs
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
module ActionPatterns(actions, actionPatterns) where
import ActionMatch
import OSActions
import qualified Data.Map as M
actions :: M.Map String OSAction
actions = M.fromList [("echo", echo), ("echo2", echo2), ("say", echo)]
actionPatterns ::[ActionPattern]
actionPatterns =
[
ActionPattern "say $phrase$" "say",
ActionPattern "play a random $artist$ album" "",
ActionPattern "play a random album by $artist$" "",
ActionPattern "play ($song|$album) by $artist$" "",
ActionPattern "play a random episode of $show$" "",
ActionPattern "play a random episode (from|of) season $season$ of $show$" "",
ActionPattern "(open|run|start) $application$" "",
ActionPattern "pause" "",
ActionPattern "resume" "",
ActionPattern "rewind (by|) $time_interval$" "",
ActionPattern "(fast|)forward (by|) $time_interval$" "",
ActionPattern "stop" "",
ActionPattern "google $phrase$" "",
ActionPattern "wikipedia $phrase$" ""
]
{-
demultiplex action patterns
split patterns into chunks
match phrase against head of chunks
drop all phrases < matchThreshold
-}