Procházet zdrojové kódy

Minor formatting improvements

Clara Hobbs před 8 roky
rodič
revize
443883b689
2 změnil soubory, kde provedl 6 přidání a 6 odebrání
  1. 4
    4
      blather.py
  2. 2
    2
      recognizer.py

+ 4
- 4
blather.py Zobrazit soubor

106
                 (key, value) = line.split(":", 1)
106
                 (key, value) = line.split(":", 1)
107
                 print(key, value)
107
                 print(key, value)
108
                 self.commands[key.strip().lower()] = value.strip()
108
                 self.commands[key.strip().lower()] = value.strip()
109
-                strings.write( key.strip()+"\n")
109
+                strings.write(key.strip() + "\n")
110
         # Close the strings file
110
         # Close the strings file
111
         strings.close()
111
         strings.close()
112
 
112
 
127
             # Open and truncate the blather history file
127
             # Open and truncate the blather history file
128
             hfile = open(history_file, "w")
128
             hfile = open(history_file, "w")
129
             for line in self.history:
129
             for line in self.history:
130
-                hfile.write( line+"\n")
130
+                hfile.write(line + "\n")
131
             # Close the file
131
             # Close the file
132
             hfile.close()
132
             hfile.close()
133
 
133
 
221
         paths = ["/usr/share/blather/", "/usr/local/share/blather", local_data]
221
         paths = ["/usr/share/blather/", "/usr/local/share/blather", local_data]
222
         for path in paths:
222
         for path in paths:
223
             resource = os.path.join(path, string)
223
             resource = os.path.join(path, string)
224
-            if os.path.exists( resource ):
224
+            if os.path.exists(resource):
225
                 return resource
225
                 return resource
226
         # If we get this far, no resource was found
226
         # If we get this far, no resource was found
227
         return False
227
         return False
253
             action='store',
253
             action='store',
254
             help="command to run when a valid sentence is detected")
254
             help="command to run when a valid sentence is detected")
255
 
255
 
256
-    parser.add_argument( "--invalid-sentence-command",  type=str, dest="invalid_sentence_command",
256
+    parser.add_argument("--invalid-sentence-command",  type=str, dest="invalid_sentence_command",
257
             action='store',
257
             action='store',
258
             help="command to run when an invalid sentence is detected")
258
             help="command to run when an invalid sentence is detected")
259
 
259
 

+ 2
- 2
recognizer.py Zobrazit soubor

12
 import sys
12
 import sys
13
 
13
 
14
 # Define some global variables
14
 # Define some global variables
15
-this_dir = os.path.dirname( os.path.abspath(__file__) )
15
+this_dir = os.path.dirname(os.path.abspath(__file__))
16
 
16
 
17
 
17
 
18
 class Recognizer(GObject.GObject):
18
 class Recognizer(GObject.GObject):
31
         # Build the pipeline
31
         # Build the pipeline
32
         cmd = audio_src + ' ! audioconvert ! audioresample ! pocketsphinx name=asr ! appsink sync=false'
32
         cmd = audio_src + ' ! audioconvert ! audioresample ! pocketsphinx name=asr ! appsink sync=false'
33
         try:
33
         try:
34
-            self.pipeline = Gst.parse_launch( cmd )
34
+            self.pipeline = Gst.parse_launch(cmd)
35
         except Exception as e:
35
         except Exception as e:
36
             print(e.message)
36
             print(e.message)
37
             print("You may need to install gstreamer1.0-pocketsphinx")
37
             print("You may need to install gstreamer1.0-pocketsphinx")

Loading…
Zrušit
Uložit