File size: 2,419 Bytes
3b5b311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from latex2sympy2_extended import NormalizationConfig
from math_verify import LatexExtractionConfig, parse, verify
from sympy.parsing.latex.errors import LaTeXParsingError

content = """Let's denote the original number of workers and the original production amount by \( W \) and \( P \), respectively. We'll use these to find out how many workers there are in the plant.
        When 40 workers switch to the Stakhanovite method, the production increases by 20%, so the new production amount is \( 1.2W \).
        Then, when 60% of the workers (which is \( 1.2W \times 0.6 = 0.72W \)) switch to the new method, the production increases to two and a half times the original production:
        \[ W + 0.72W = 2.5W \]
        Let \( N \) be the total number of workers in the plant, and \( P \) be the original production amount. After all the workers switch to the new method, the production becomes \( N \times P \), and we know from the previous equation that \( N \times P = 2.5W \).
        Since 40 workers switch to the Stakhanovite method, we have:
        \[ W = N \times (1 - 0.4) = 0.6N \]
        And since 60% of the workers have switched, we get:
        \[ W \times 0.6 = N \times (1 - 0.4 - 0.32) = 0.28N \]
        Using the equation \( W = 0.6N \), we can substitute \( W \) with \( 0.6N \) in the second equation:
        \[ 0.6N \times 0.6 = 2.5N \]
        Reducing the left side:
        \[ 0.36N = 2.5N \]
        \[ N = 6.25N \]
        When all workers switch, the production becomes:
        \[ N \times N = N^2 = (2.5N)^2 = 6.25W \]
        Thus, the production increases by \( \frac{6.25W}{W} = 6.25 \) times."""

answer_parsed = parse(
                content,
                extraction_config=[
                    LatexExtractionConfig(
                        normalization_config=NormalizationConfig(
                            nits=False,
                            malformed_operators=False,
                            basic_latex=True,
                            equations=True,
                            boxed="all",
                            units=True,
                        ),
                        # Ensures that boxed is tried first
                        boxed_match_priority=0,
                        try_extract_without_anchor=True,
                    )
                ],
                extraction_mode="first_match",
            )


print (answer_parsed)