]> gitweb.factorcode.org Git - factor.git/commitdiff
text-to-speech: enable use from command-line.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 9 Apr 2015 17:44:18 +0000 (10:44 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 9 Apr 2015 17:44:18 +0000 (10:44 -0700)
extra/text-to-speech/text-to-speech.factor

index 088d745f961f222613bc585eeebb8afcb9c140c0..6b6377fbc0ec0e319f475785910e317f65aaf410 100644 (file)
@@ -1,8 +1,9 @@
 ! Copyright (C) 2013 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: combinators generic kernel math math.text.english present
-strings system ui.operations vocabs ;
+USING: combinators command-line generic io kernel math
+math.text.english namespaces present sequences strings system
+ui.operations vocabs ;
 
 IN: text-to-speech
 
@@ -26,3 +27,12 @@ M: object speak present speak-text ;
 M: integer speak number>text speak-text ;
 
 [ \ present ?lookup-method ] \ speak H{ } define-operation
+
+: speak-main ( -- )
+    command-line get [
+        [ speak ] each-line
+    ] [
+        " " join speak
+    ] if-empty ;
+
+MAIN: speak-main