;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Segman linking file ;;; ;;; This file contains the necessary Segman initializations ;;; to link Segman and the phone dialing model. ;;; ;;; File: segman-link.lisp ;;; Author: Andrew R. Freed ;;; Creation date: 2/July/02 ;;; Last modified: 25/March/03 ;;; ;;; This file runs under ACT-R/PM 5.0, RPM v2.17b, Segman v3.1, and ACL 5.0.1 ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Table of Contents ;;; ;;; i Phone-specific initializations ;;; ii Font and pattern definitions ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; i. Phone-specific initializations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun init-segman-for-phone () ;;Setup Segman to find visual features of type "text", and ;; the model will implicitly be able to use buttons (setf segman::*recognized-features* '(:text)) ;;This sets a minimum number of characters that comprise a word (setf segman::*minimum-word-length* 3) ;;Restrict Segman to only parse a given part of the screen ;; this must always start at 0,0, and is manually changed for ;; different phones (segman::segment-screen (list 0 0 895 689)) ;;specific to phone 52 ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ii. Font and pattern definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun group-number-p (group) ;; This function gets the pixel pattern (e.g., a letter of number) ;; associated with a group, translates it to a character, if ;; possible, and then makes sure theat the character is a character ;; between #\0 and #\9 (let ((char (segman::pattern-translation (segman::group-pattern group)))) (and (characterp char) (char<= #\0 char #\9)) ) ) ;; The Segman package only comes with recognition for one standard ;; font. Therefore I am including pattern definitions for some other ;; phone fonts. At present I have only encoded one new font, a larger ;; version of the standard font. The Segman help file ;; "segman-introduction.html" includes instructions on how to define ;; new patterns for Segman ;; Pattern for a large "1" (segman::define-pattern large-one (:translation #\1) (:AND (:COUNT 79) (:AREA 79/176) (:SIZE 176) (:HEIGHT 22) (:WIDTH 8) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 3) 7 28 30 (62 4) 63 96 112 116 (119 2) (124 15) (127 3) 193 (199 20) 225 227 241 243 251 252 253 (255 20)) ) ;; Pattern for a large "2" (segman::define-pattern large-two (:translation #\2) (:AND (:COUNT 133) (:AREA 19/44) (:SIZE 308) (:HEIGHT 22) (:WIDTH 14) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 21/13) 7 (15 2) (30 2) (31 12) (60 4) (62 9) 63 (112 2) (119 5) (124 2) (126 3) (127 9) (135 2) (159 2) (193 2) (195 2) (199 4) 207 (223 4) (225 2) (227 6) (231 2) 239 (241 15) (243 3) (247 6) (248 2) 249 252 (253 3) (255 22)) ) ;; Pattern for large "3" (segman::define-pattern large-three (:translation #\3) (:AND (:COUNT 141) (:AREA 47/110) (:SIZE 330) (:HEIGHT 22) (:WIDTH 15) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 3/2) 7 (15 3) (28 3) (30 2) (31 9) 60 (62 3) (63 4) (112 2) 119 (120 2) (124 4) (126 3) (127 7) (135 2) (143 3) (159 3) (195 3) (199 5) (207 2) (223 8) (225 3) (227 4) (231 2) (240 2) (241 10) (243 2) (247 8) (248 3) (249 3) (252 3) (253 8) (255 22)) ) ;; Pattern for large "4" (segman::define-pattern large-four (:translation #\4) (:AND (:COUNT 134) (:AREA 67/165) (:SIZE 330) (:HEIGHT 22) (:WIDTH 15) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 3/2) (7 2) 30 (31 5) (60 3) (62 8) 63 (112 2) (119 5) (124 11) (126 3) (127 7) (159 2) (193 2) 195 (199 16) 207 (223 2) (227 5) (231 2) 239 (241 9) 243 (247 3) 249 251 (252 2) (253 2) (255 35)) ) ;; Pattern for large "5" (segman::define-pattern large-five (:translation #\5) (:AND (:COUNT 154) (:AREA 7/15) (:SIZE 330) (:HEIGHT 22) (:WIDTH 15) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 3/2) 7 (15 2) (28 2) 30 (31 18) (60 2) (62 2) 63 112 115 (120 2) (124 8) (126 3) (127 6) 135 (143 5) 159 183 190 193 (195 2) (199 8) 203 (223 8) (225 3) 227 (231 2) 239 (240 2) (241 18) (243 2) (247 6) (248 2) (249 2) (252 2) (253 6) (255 28)) ) ;; Pattern for large "6" (segman::define-pattern large-six (:translation #\6) (:AND (:COUNT 170) (:AREA 17/33) (:SIZE 330) (:HEIGHT 22) (:WIDTH 15) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 3/2) (15 4) 28 (30 3) (31 10) (60 2) (62 3) (63 3) 119 (120 2) (124 11) (126 3) (127 8) (135 4) (143 2) (159 3) 191 193 (195 2) (199 7) (207 4) (223 10) 225 (227 7) (231 3) (240 3) (241 10) (243 2) (247 10) (248 5) (249 3) (252 2) (253 10) (255 29)) ) ;; Pattern for large "7" (segman::define-pattern large-seven (:translation #\7) (:AND (:COUNT 96) (:AREA 24/77) (:SIZE 308) (:HEIGHT 22) (:WIDTH 14) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 21/13) 7 28 (31 12) (60 6) (62 2) 103 (112 2) (119 2) (124 5) (126 5) (127 5) 193 (195 6) (199 6) (227 2) (231 5) (241 10) 246 (247 5) 249 253 (255 16)) ) ;; Pattern for large "8" (segman::define-pattern large-eight (:translation #\8) (:AND (:COUNT 166) (:AREA 83/165) (:SIZE 330) (:HEIGHT 22) (:WIDTH 15) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 3/2) (15 3) (30 2) (31 10) (60 3) (62 5) (63 3) (119 3) (120 2) (124 8) (126 3) (127 8) (135 3) (143 4) (159 4) (195 2) (199 8) (207 3) (221 3) (223 8) 225 (227 8) (231 2) 239 240 (241 11) (243 2) (247 9) (248 8) (249 2) (252 2) (253 9) 254 (255 24)) ) ;; Pattern for large "9" (segman::define-pattern large-nine (:translation #\9) (:AND (:COUNT 169) (:AREA 169/330) (:SIZE 330) (:HEIGHT 22) (:WIDTH 15) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 3/2) (15 3) 28 (30 2) (31 10) (60 2) (62 5) (63 3) 119 (120 4) (124 8) (126 3) (127 9) (135 2) (143 5) (159 3) 193 (195 2) (199 11) (207 2) (223 10) (225 3) (227 3) (231 3) (240 4) (241 10) (243 3) (247 8) (248 2) (249 3) 251 (252 4) (253 10) (255 28)) ) ;; Pattern for large "0" (segman::define-pattern large-zero (:translation #\0) (:AND (:COUNT 154) (:AREA 7/15) (:SIZE 330) (:HEIGHT 22) (:WIDTH 15) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 3/2) 15 30 (31 8) (60 3) (62 3) 63 (120 3) (124 18) (126 3) (127 7) (135 3) (143 3) 159 (195 3) (199 18) (207 3) (223 7) 225 (227 3) (231 3) 240 (241 8) 243 (247 7) (248 3) 249 (252 3) (253 7) (255 30)) ) ;; Pattern for large "#" (segman::define-pattern large-pound (:translation #\#) (:AND (:COUNT 192) (:AREA 6/11) (:SIZE 352) (:HEIGHT 22) (:WIDTH 16) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 7/5) (7 4) (28 4) (31 10) (60 6) (63 4) (112 4) (124 10) (126 10) (127 10) (159 4) (193 4) (195 6) (199 10) (207 4) (223 4) (231 10) (241 10) (243 4) (247 10) (249 4) (252 4) (253 4) (255 52)) ) ;; Pattern for large "*" (segman::define-pattern large-star (:translation #\*) (:AND (:COUNT 48) (:AREA 12/25) (:SIZE 100) (:HEIGHT 10) (:WIDTH 10) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 1) (7 2) 15 (28 2) 30 (31 2) 56 62 112 117 (119 2) (124 2) 126 127 131 143 (191 2) 193 (199 2) 207 213 (221 2) 223 (224 2) (227 2) 239 (243 2) 247 (248 2) (249 2) 253 254 (255 4)) ) ;; Pattern for small "#" (segman::define-pattern small-pound (:translation #\#) (:AND (:COUNT 26) (:AREA 13/27) (:SIZE 54) (:HEIGHT 9) (:WIDTH 6) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 8/5) (4 2) (56 2) (57 2) (64 2) (68 2) (78 4) (85 4) (131 2) (147 2) (228 4)) ) ;; Pattern for small "*" (segman::define-pattern small-star (:translation #\*) (:AND (:COUNT 5) (:AREA 5/9) (:SIZE 9) (:HEIGHT 3) (:WIDTH 3) (:RED 0) (:GREEN 0) (:BLUE 0) (:COLOR 0) (:PROPORTION 1) 2 8 32 128 170) )