Skip to content

Commit

Permalink
fix: grammar 모델 minor fixes
Browse files Browse the repository at this point in the history
[#12]
  • Loading branch information
9ooDa committed Mar 21, 2024
1 parent 6bd069c commit b2a4e00
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 2 deletions.
264 changes: 264 additions & 0 deletions models/gector/check/checker_data.json
Original file line number Diff line number Diff line change
@@ -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."
}
}
2 changes: 2 additions & 0 deletions models/grammar_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion models/utils/gram_metrics.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
2 changes: 1 addition & 1 deletion models/utils/gram_out_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b2a4e00

Please sign in to comment.