diff --git a/models/gector/check/checker_data.json b/models/gector/check/checker_data.json new file mode 100644 index 00000000..73467755 --- /dev/null +++ b/models/gector/check/checker_data.json @@ -0,0 +1,264 @@ +{ + " With the international trip, I went to France and Italy in 2018 with my mother.": { + "edited": false, + "sentence_list": [], + "tag_list": [], + "fin_sentence": " With the international trip, I went to France and Italy in 2018 with my mother." + }, + "So in the weekend, my mom didn't have to just answer the phone because of the work.": { + "edited": true, + "sentence_list": [ + [ + "$START", + "So", + "in", + "the", + "weekend,", + "my", + "mom", + "didn't", + "have", + "to", + "just", + "answer", + "the", + "phone", + "because", + "of", + "the", + "work." + ] + ], + "tag_list": [ + [ + "$KEEP", + "$KEEP", + "$REPLACE_on", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$DELETE", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$DELETE", + "$KEEP" + ] + ], + "fin_sentence": "So on the weekend, my mom didn't have to answer the phone because of work." + }, + "if it was the week, uh, when it was the week, weekdays.": { + "edited": false, + "sentence_list": [], + "tag_list": [], + "fin_sentence": "if it was the week, uh, when it was the week, weekdays." + }, + "So my mom has to answer the phone from the, from her work and her, and her coworkers.": { + "edited": false, + "sentence_list": [], + "tag_list": [], + "fin_sentence": "So my mom has to answer the phone from the, from her work and her, and her coworkers." + }, + "So we visited the sizing places like, um, Eiffel tower or Coliseum or other things.": { + "edited": true, + "sentence_list": [ + [ + "$START", + "So", + "we", + "visited", + "the", + "sizing", + "places", + "like,", + "um,", + "Eiffel", + "tower", + "or", + "Coliseum", + "or", + "other", + "things." + ] + ], + "tag_list": [ + [ + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$APPEND_the", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP" + ] + ], + "fin_sentence": "So we visited the sizing places like, um, Eiffel tower or the Coliseum or other things." + }, + "We visited in, um, So in the weekdays, we visited the nearby places or just beautiful cafes or just normal restaurants.": { + "edited": true, + "sentence_list": [ + [ + "$START", + "We", + "visited", + "in,", + "um,", + "So", + "in", + "the", + "weekdays,", + "we", + "visited", + "the", + "nearby", + "places", + "or", + "just", + "beautiful", + "cafes", + "or", + "just", + "normal", + "restaurants." + ] + ], + "tag_list": [ + [ + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$REPLACE_on", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP" + ] + ], + "fin_sentence": "We visited in, um, So on the weekdays, we visited the nearby places or just beautiful cafes or just normal restaurants." + }, + "And on the weekend, we visited the sightseeing places that are far from, like the Disneyland in Paris.": { + "edited": true, + "sentence_list": [ + [ + "$START", + "And", + "on", + "the", + "weekend,", + "we", + "visited", + "the", + "sightseeing", + "places", + "that", + "are", + "far", + "from,", + "like", + "the", + "Disneyland", + "in", + "Paris." + ], + [ + "$START", + "And", + "on", + "the", + "weekend,", + "we", + "visited", + "sightseeing", + "places", + "that", + "are", + "far", + "from,", + "home", + "like", + "Disneyland", + "in", + "Paris." + ] + ], + "tag_list": [ + [ + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$DELETE", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$APPEND_home", + "$KEEP", + "$DELETE", + "$KEEP", + "$KEEP", + "$KEEP" + ], + [ + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP", + "$APPEND_,", + "$KEEP", + "$KEEP", + "$KEEP", + "$KEEP" + ] + ], + "fin_sentence": "And on the weekend, we visited sightseeing places that are far from, home , like Disneyland in Paris." + }, + "Yeah, that's it.": { + "edited": false, + "sentence_list": [], + "tag_list": [], + "fin_sentence": "Yeah, that's it." + } +} \ No newline at end of file diff --git a/models/grammar_api.py b/models/grammar_api.py index 170eaaa3..458efbff 100644 --- a/models/grammar_api.py +++ b/models/grammar_api.py @@ -94,6 +94,8 @@ async def upload_json( score_type = "pwc" # "ec" or "psc" or "pwc" out_path = os.path.join(gector_path, "real", f"grammar_{phase}.json") score = gram_metrics.get_score(checker_data=checker_data, score_type=score_type) + print(gram_out_json.create_json(phase=phase, out_path=out_path, score=score, check_data=checker_data)) + return gram_out_json.create_json(phase=phase, out_path=out_path, score=score, check_data=checker_data) except Exception as e: diff --git a/models/utils/gram_metrics.py b/models/utils/gram_metrics.py index 12834b8c..a63193e8 100644 --- a/models/utils/gram_metrics.py +++ b/models/utils/gram_metrics.py @@ -1,6 +1,6 @@ import string from typing import List, Dict, Literal, get_args -from gram_out_json import get_cleaned_token_list, get_scrs_tok +from .gram_out_json import get_cleaned_token_list, get_scrs_tok def get_error_count( diff --git a/models/utils/gram_out_json.py b/models/utils/gram_out_json.py index 34675c10..3d54e1c2 100644 --- a/models/utils/gram_out_json.py +++ b/models/utils/gram_out_json.py @@ -275,7 +275,7 @@ def create_json( ctl = get_cleaned_token_list() tag_grammar = get_tag_grammar(ctl) - data = get_phase_1_data(error_count=score, check_data=check_data) + data = get_phase_1_data(score=score, check_data=check_data) if phase == "phase_2": data = get_phase_2_data(p1_data=data, check_data=check_data, ctl=ctl, tag_grammar=tag_grammar)