This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A hack based on this http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/. While with smaller voice samples google speech to text works really good, as length increases quality decreases. So here using audiolab and numPy we are breaking audio sample, in smaller chunks, and removing blank/empty spaces from audio signal and then pushing them to google for processing. | |
It takes wav file format as input but can be changed to other formats too. | |
''' | |
from scikits.audiolab import wavread, play, flacwrite | |
from numpy import average, array, hstack | |
import os | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nltk.probability import ELEProbDist, FreqDist | |
from nltk import NaiveBayesClassifier | |
from collections import defaultdict | |
train_samples = { | |
'I hate you and you are a bad person': 'neg', | |
'I love you and you are a good person': 'pos', | |
'I fail at everything and I want to kill people' : 'neg', | |
'I win at everything and I want to love people' : 'pos', | |
'sad are things are heppening. fml' : 'neg', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module('permute_list'). | |
-export([permute/1, permute/2]). | |
permute(List) -> | |
permute(List, length(List)). | |
permute(List, Length) -> | |
Indices = [], | |
Permuted_List = [], | |
jumble(List, Permuted_List, Indices, Length). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html manifest="cache.appcache"> | |
<head>Speech Recognition</head> | |
<body> | |
<input type="text" x-webkit-speech /> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail | |
# Make sure you have IMAP enabled in your gmail settings. | |
# Right now it won't download same file name twice even if their contents are different. | |
import email | |
import getpass, imaplib | |
import os | |
import sys | |
detach_dir = '.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if bool(fileName): | |
flag = 1 | |
filePath = os.path.join(detach_dir, 'attachments', fileName) | |
if not os.path.isfile(filePath) : | |
print fileName | |
fp = open(filePath, 'wb') | |
fp.write(part.get_payload(decode=True)) | |
fp.close() | |
else: | |
tmpPath = os.path.join(detach_dir, 'attachments', fileName+'tmp') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file | |
* to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance | |
* with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vision_definitions | |
import numpy | |
import time | |
import Image | |
camProxy = ALProxy("ALVideoDevice", NAO_IP, PORT) | |
t0 = time.time() | |
# block to capture image from NAO's camera with 640x480 resolution and YUV422 colorspace | |
client = camProxy.subscribe("client", vision_definitions.kVGA, vision_definitions.kYUV422ColorSpace, 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def swear(self, mess, args): | |
"swears randomley from a list of high level swear words" | |
swears = ["neech","kameen","kuttey", "howley", "saaley", "monkey", " kaachina vennela to tea pettukune mohavu nuvvu nu ","thitlu adukkunne mohamu nuvvoonu ", " currentu teegaki uyyala eskune ooge mohavu nuvvu" , "donkey", "vudathalu patte mokam", "chapathi mokam", "washbasin lo chepalu patte mokam", "gaali vaanalo visnakarrlu ammukune mokam", "Chunchu mokam", "ghootley", "jaffa", "tussha", "daffa", "jumper mein bumper", "panther pagdi" ,"lapaki paapa" ] | |
from random import choice | |
self.message_queue.append(choice(swears)+ " " + choice(swears) + " " + choice(swears) + " "+ args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage python rot-n.py encodedeMessage n | |
# python rot-n.py "Va gur ryringbef, gur rkgebireg ybbxf ng gur BGURE thl'f fubrf." 13 | |
import sys | |
if __name__ == '__main__': | |
encodedMsg = sys.argv[1] | |
n = int(sys.argv[2]) | |
# lets make everything lower case | |
encodedMsg = encodedMsg.lower() | |
decodedMsg = '' |
OlderNewer