Beispiel #1
0
 def process(self, problem: MathExpression) -> SolverResult:
     try:
         return SolverResult(solution=math_expression_from_latex(eval(problem.latex)))
     except SyntaxError:
         return SolverResult(solution=math_expression_from_latex("Syntax Error"))
     except:
         return SolverResult(solution=math_expression_from_latex("Error"))
    def process(self, characters_with_bounding_boxes: Sequence[CharacterWithBoundingBox]) -> LayouterResult:
        characters_with_bounding_boxes.sort(key=lambda box: box.bounding_box.x0)

        string = ""
        for c in characters_with_bounding_boxes:
            string = string + c.character

        return LayouterResult(
            problem=math_expression_from_latex(string)
        )
Beispiel #3
0
 def process(self, image: np.ndarray) -> ExtractorResult:
     return ExtractorResult(
         problem=math_expression_from_latex('5 + 5'),
         images={},
     )
 def process(self, characters_with_bounding_boxes: Sequence[CharacterWithBoundingBox]) -> LayouterResult:
     return LayouterResult(
         problem=math_expression_from_latex("5 + 6")
     )
Beispiel #5
0
 def process(self, problem: MathExpression) -> SolverResult:
     return SolverResult(
         solution=math_expression_from_latex('42')
     )
Beispiel #6
0
 def _process(self, image: np.ndarray) -> SnapperResult:
     return SnapperResult(
         problem=math_expression_from_latex('4 + 2'),
         solution=math_expression_from_latex('$$ 6 $$'),
         images={},
     )