-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dict.py
61 lines (57 loc) · 1.36 KB
/
Dict.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import time
from espeak import espeak
import cv2
import numpy as np
from PyDictionary import PyDictionary
#import abc2
#import sys
#sys.path.insert(0, "/home/sam/Desktop")
#from itsp import abc2
def dictionary(word):
i=0
while (1):
dictionary=PyDictionary()
dict=dictionary.meaning(word)
if (dict.has_key('Adjective')) :
s= dict['Adjective']
if len(s)>=i :
print s[i]
l= len(s[i])
t = l /12.0
espeak.synth("(adjective)" + s[i])
time.sleep(t)
if dict.has_key('Noun') :
s= dict['Noun']
if len(s)>=i :
print s[i]
l= len(s[0])
t = l /12.0
espeak.synth("(NOUN)" + s[i])
time.sleep(t)
if dict.has_key('Verb') :
s= dict['Verb']
if len(s)>=i :
print s[i]
l= len(s[i])
t = l /12.0
espeak.synth("VERB" + s[i])
time.sleep(t)
if dict.has_key('Adverb') :
s= dict['Adverb']
if len(s)>=i :
print s[i]
l= len(s[i])
t = l /12.0
espeak.synth("(ADVERB)" + s[i])
time.sleep(t)
if dict.has_key('Preposition') :
s= dict['Preposition']
if len(s)>=i :
print s[i]
l= len(s[i])
t = l /12.0
espeak.synth("(PREPO)" + s[i])
time.sleep(t)
espeak.synth("If alternate meaning required, give a double tap within the next 3 seconds")
#audio trigger will be awaited here, after message for one, in case user didnt get meaning that was wanted
#if received, then i++