Skip to content

Commit bb2e2b0

Browse files
author
Sean Trott
committed
grammar generator
1 parent a4b3c97 commit bb2e2b0

5 files changed

Lines changed: 17 additions & 8 deletions

File tree

analyzer.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
export ECG_FED=FED2
33
export JYTHONPATH=build/compling.core.jar:src/main/nluas/language
4-
jython -J-Xmx4g -m analyzer ../ecg_grammars/research.prefs #&
4+
jython -J-Xmx2g -m analyzer ../ecg_grammars/research.prefs #&
55

66
#jython -i src/main/nluas/language/analyzer.py ../ecg_grammars/research.prefs #&
77
#python3 src/main/nluas/language/user_agent.py AgentUI

src/main/nluas/bridge_client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ class Global:
112112

113113
def main(argv):
114114

115-
if six.PY3:
116-
sys.stderr.write('bridge_client.py currently only supports python2')
117-
sys.exit(1)
115+
#if six.PY3:
116+
# sys.stderr.write('bridge_client.py currently only supports python2')
117+
# sys.exit(1)
118118

119119
parse_arguments(argv[1:])
120120
setup_logging()
@@ -222,8 +222,12 @@ def main(argv):
222222
# need to un-json the message (which server_send
223223
# will re-json). There's probably a more elegant way
224224
# to do this.
225-
message = json.loads(event[4].decode('utf-8'))
226-
server_send(['SHOUT', name, channel, message])
225+
if six.PY3:
226+
decoded = event[4].decode('utf-8')
227+
server_send(['SHOUT', name, channel, decoded])
228+
else:
229+
message = json.loads(event[4].decode('utf-8'))
230+
server_send(['SHOUT', name, channel, message])
227231
# end main()
228232

229233
# server_send and server_recv taken almost directly from
Binary file not shown.

src/main/nluas/language/grammar_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
lexicon = sorted(list(set(analyzer.get_lexicon())))
1414

15-
utterances = lexicon = sorted(list(set(analyzer.get_utterances())))
15+
#utterances = lexicon = sorted(list(set(analyzer.get_utterances())))
1616

1717
"""
1818
with open("generated/words.txt", "w") as lexicon_file:

src/main/nluas/language/user_agent.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def __init__(self, args):
4747
self.transport.subscribe(self.solve_destination, self.callback)
4848
self.transport.subscribe(self.speech_address, self.speech_callback)
4949
self.transport.subscribe(self.text_address, self.text_callback)
50+
print(self.speech_address)
51+
print(self.address)
5052

5153

5254
def setup_ui_parser(self):
@@ -124,8 +126,11 @@ def output_stream(self, tag, message):
124126
def speech_callback(self, ntuple):
125127
""" Processes text from a SpeechAgent. """
126128
#print(ntuple)
127-
ntuple = json.loads(ntuple)
129+
print(ntuple)
130+
#ntuple = json.loads(ntuple)
131+
print(ntuple['text'])
128132
json_ntuple = self.process_input(ntuple['text'])
133+
129134
if json_ntuple and json_ntuple != "null" and "predicate_type" in json.loads(json_ntuple):
130135
self.transport.send(self.solve_destination, json_ntuple)
131136

0 commit comments

Comments
 (0)