Skip to content

Commit a1a6d57

Browse files
committed
lowercase sentences hack
1 parent 63fc031 commit a1a6d57

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

Diff for: micro-talespin.lisp

+22-12
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626

2727

2828
; Changes by Rainer Joswig, [email protected], 2012:
29-
; fixed: dprox-plan1, ptrans only if the actor knows the new loc
29+
; fixed: dprox-plan1, ptrans only if the actor knows the new loc
30+
; hacked: Output sentence starts with an uppercase letter and then lowercase letters follow.
3031
; Changes by Rainer Joswig, [email protected], 2008:
31-
; fixed: persuade and not peruade
32-
; fixed: three args to persuade
33-
; fixed: changed implementation of PCVar from Structure to Symbol (symbol with leading ?)
34-
; fixed: correct spaces in output
35-
; fixed: put symbols instead of functions, makes tracing easier
32+
; fixed: persuade and not peruade
33+
; fixed: three args to persuade
34+
; fixed: changed implementation of PCVar from Structure to Symbol (symbol with leading ?)
35+
; fixed: correct spaces in output
36+
; fixed: put symbols instead of functions, makes tracing easier
3637

3738

3839
; Standard definition of put.
@@ -138,7 +139,7 @@ the other person."
138139
(and (doit (propel ',actor 'hand ',agent))
139140
(is-true ',action)))))
140141

141-
(defvar *default-tense* 'past
142+
(defvar *default-tense* 'past ; or present
142143
"Set the storytelling in the past tense.")
143144

144145
; micro-talespin-demo variables for sample stories
@@ -1023,6 +1024,12 @@ then he's in a loop and has failed. Otherwise, set up the goal and go."
10231024
cd
10241025
(cdpath (cdr rolelist) (filler-role (car rolelist) cd))))
10251026

1027+
; each string should start with a capital letter and then be lower case.
1028+
(defun beautify-string (string)
1029+
(when (plusp (length string))
1030+
(nstring-downcase string)
1031+
(setf (aref string 0) (char-upcase (aref string 0))))
1032+
string)
10261033

10271034
; micro-mumble: micro English generator
10281035

@@ -1036,11 +1043,14 @@ then he's in a loop and has failed. Otherwise, set up the goal and go."
10361043
cd)))
10371044
(flet ((say-it ()
10381045
(format t "~%")
1039-
(say1 cd-to-be-said
1040-
(or (cdpath '(time) cd-to-be-said)
1041-
*default-tense*)
1042-
nil
1043-
t)
1046+
(write-string
1047+
(beautify-string
1048+
(with-output-to-string (*standard-output*)
1049+
(say1 cd-to-be-said
1050+
(or (cdpath '(time) cd-to-be-said)
1051+
*default-tense*)
1052+
nil
1053+
t))))
10441054
(format t ".")))
10451055
(say-it))
10461056
cd))

0 commit comments

Comments
 (0)