Skip to content

Commit

Permalink
codestyle fixed for pr
Browse files Browse the repository at this point in the history
  • Loading branch information
moon-strider committed Dec 25, 2023
1 parent 8d3ae9f commit 9656c40
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
20 changes: 6 additions & 14 deletions annotators/speech_function_classifier/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def handler(payload: List[Dict]):
phrases = [p["prev_phrase"]] + p["phrase"]
authors = ["John"] + ["Doe"] * phrase_len
response = [p["prev_speech_function"]]
logger.info(f'PREV_SF:{response}')
logger.info(f"PREV_SF:{response}")
for phr, prev_phr, auth, prev_auth in zip(phrases[1:], phrases[:-1], authors[1:], authors[:-1]):
speech_f = get_speech_function(phr, prev_phr,response[-1], auth, prev_auth)
speech_f = get_speech_function(phr, prev_phr, response[-1], auth, prev_auth)
response.append(speech_f)
responses[i] = response[1:]
logger.info(f'RESPONSE:{response}')
logger.info(f"RESPONSE:{response}")

except Exception as e:
sentry_sdk.capture_exception(e)
logger.exception(e)
Expand All @@ -58,11 +58,7 @@ def answer():
payloads = []
for phr, prev_phr, prev_speech_func in zip_longest(phrases, prev_phrases, prev_speech_funcs):
payloads.append(
{
"phrase": sent_tokenize(phr),
"prev_phrase": prev_phr,
"prev_speech_function": prev_speech_func
}
{"phrase": sent_tokenize(phr), "prev_phrase": prev_phr, "prev_speech_function": prev_speech_func}
)
responses = handler(payloads)
total_time = time.time() - st_time
Expand All @@ -81,11 +77,7 @@ def annotation():
payloads = []
for phr, prev_phr, prev_speech_func in zip_longest(phrases, prev_phrases, prev_speech_funcs):
payloads.append(
{
"phrase": sent_tokenize(phr),
"prev_phrase": prev_phr,
"prev_speech_function": prev_speech_func
}
{"phrase": sent_tokenize(phr), "prev_phrase": prev_phr, "prev_speech_function": prev_speech_func}
)
responses = handler(payloads)
total_time = time.time() - st_time
Expand Down
8 changes: 3 additions & 5 deletions annotators/speech_function_predictor/model.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import json



def init_model():
with open('sf_pairs.json', 'r') as json_file:
with open("sf_pairs.json", "r") as json_file:
lines = json_file.readlines()

prev_sfs = [json.loads(line)['prev_sf'] for line in lines]
current_sfs = [json.loads(line)['current_sf'] for line in lines]

prev_sfs = [json.loads(line)["prev_sf"] for line in lines]
current_sfs = [json.loads(line)["current_sf"] for line in lines]

class_dict = {}
label_to_name = []
Expand Down
1 change: 1 addition & 0 deletions annotators/speech_function_predictor/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ def run_test():

print("Success")


if __name__ == "__main__":
run_test()

0 comments on commit 9656c40

Please sign in to comment.