Fixed more or less reading import, attempted to do listening

This commit is contained in:
Carlos-Mesquita
2024-11-10 06:46:58 +00:00
parent 6909d75eb6
commit afeaf118c6
33 changed files with 3712 additions and 86 deletions

View File

@@ -1,7 +1,7 @@
from enum import Enum
from pydantic import BaseModel, Field
from typing import List, Union
from typing import List, Union, Optional
from uuid import uuid4, UUID
@@ -15,10 +15,7 @@ class WriteBlanksExercise(BaseModel):
maxWords: int
solutions: List[WriteBlanksSolution]
text: str
@property
def prompt(self) -> str:
return f"Choose no more than {self.maxWords} words and/or a number from the passage for each answer."
prompt: str
class MatchSentencesOption(BaseModel):
@@ -32,20 +29,29 @@ class MatchSentencesVariant(str, Enum):
HEADING = "heading"
IDEAMATCH = "ideaMatch"
class MCOption(BaseModel):
id: str
text: str
class MCQuestion(BaseModel):
id: str
prompt: str
options: List[MCOption]
solution: str
variant: Optional[str] = None
class MultipleChoice(BaseModel):
questions: List[MCQuestion]
type: str
prompt: str
class MatchSentencesExercise(BaseModel):
options: List[MatchSentencesOption]
sentences: List[MatchSentencesSentence]
type: str = "matchSentences"
variant: MatchSentencesVariant
@property
def prompt(self) -> str:
return (
"Choose the correct heading for paragraphs from the list of headings below."
if self.variant == MatchSentencesVariant.HEADING else
"Choose the correct author for the ideas/opinions from the list of authors below."
)
prompt: str
class TrueFalseSolution(str, Enum):
TRUE = "true"
@@ -80,18 +86,9 @@ class FillBlanksExercise(BaseModel):
type: str = "fillBlanks"
words: List[FillBlanksWord]
allowRepetition: bool = False
prompt: str
@property
def prompt(self) -> str:
prompt = "Complete the summary below. Write the letter of the corresponding word(s) for it."
return (
f"{prompt}"
if len(self.solutions) == len(self.words) else
f"{prompt}\\nThere are more words than spaces so you will not use them all."
)
Exercise = Union[FillBlanksExercise, TrueFalseExercise, MatchSentencesExercise, WriteBlanksExercise]
Exercise = Union[FillBlanksExercise, TrueFalseExercise, MatchSentencesExercise, WriteBlanksExercise, MultipleChoice]
class Context(BaseModel):