Commit ·
a01621c
1
Parent(s): cc93add
Corrected some of the rules
Browse files
Translation_rules.xlsx
CHANGED
|
Binary files a/Translation_rules.xlsx and b/Translation_rules.xlsx differ
|
|
|
mathematics_dataset/mathematics_dataset/modules/arithmetic.py
CHANGED
|
@@ -145,8 +145,8 @@ def _add_question_or_entity(context, p, q, is_question):
|
|
| 145 |
'Adiciona {p} a {q}.',
|
| 146 |
'Junta {p} e {q}.',
|
| 147 |
'Soma {p} e {q}.',
|
| 148 |
-
'O total de {p}
|
| 149 |
-
'
|
| 150 |
'Quanto é {p} mais {q}?',
|
| 151 |
'Calcula {p} + {q}.',
|
| 152 |
'Quanto é {p} + {q}?',
|
|
@@ -172,16 +172,16 @@ def _sub_question_or_entity(context, p, q, is_question):
|
|
| 172 |
'Determina {p} - {q}.',
|
| 173 |
'Quanto é {p} menos {q}?',
|
| 174 |
'Quanto fica {p} retirando {q}?',
|
| 175 |
-
'Quanto é {q}
|
| 176 |
-
'Subtrai {q}
|
| 177 |
'Calcula {p} - {q}.',
|
| 178 |
'Quanto é {p} - {q}?',
|
| 179 |
]
|
| 180 |
if sympy.Ge(p.value, q.value):
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
template = random.choice(templates)
|
| 186 |
return example.Problem(
|
| 187 |
question=example.question(context, template, p=p, q=q),
|
|
@@ -336,7 +336,7 @@ def div(value, sample_args, context=None):
|
|
| 336 |
return composition.Entity(
|
| 337 |
context=context,
|
| 338 |
value=answer,
|
| 339 |
-
description='Seja {self}
|
| 340 |
p=p, q=q)
|
| 341 |
|
| 342 |
|
|
@@ -590,7 +590,7 @@ def simplify_surd(value, sample_args, context=None):
|
|
| 590 |
simplified = sympy.expand(sympy.simplify(exp))
|
| 591 |
|
| 592 |
template = random.choice([
|
| 593 |
-
'
|
| 594 |
])
|
| 595 |
return example.Problem(
|
| 596 |
question=example.question(context, template, exp=exp),
|
|
|
|
| 145 |
'Adiciona {p} a {q}.',
|
| 146 |
'Junta {p} e {q}.',
|
| 147 |
'Soma {p} e {q}.',
|
| 148 |
+
'O total de {p} e {q}.',
|
| 149 |
+
'Soma {p} a {q}.',
|
| 150 |
'Quanto é {p} mais {q}?',
|
| 151 |
'Calcula {p} + {q}.',
|
| 152 |
'Quanto é {p} + {q}?',
|
|
|
|
| 172 |
'Determina {p} - {q}.',
|
| 173 |
'Quanto é {p} menos {q}?',
|
| 174 |
'Quanto fica {p} retirando {q}?',
|
| 175 |
+
'Quanto é {q} menos {p}?',
|
| 176 |
+
'Subtrai {q} a {p}.',
|
| 177 |
'Calcula {p} - {q}.',
|
| 178 |
'Quanto é {p} - {q}?',
|
| 179 |
]
|
| 180 |
if sympy.Ge(p.value, q.value):
|
| 181 |
+
# We calculate p - q, so the difference (|p - q|) is the correct answer.
|
| 182 |
+
# for adjective in ['distância', 'diferença']:
|
| 183 |
+
# for pair in ['{p} e {q}', '{q} e {p}']:
|
| 184 |
+
templates.append('Qual é a distância entre {p} e {q}??')
|
| 185 |
template = random.choice(templates)
|
| 186 |
return example.Problem(
|
| 187 |
question=example.question(context, template, p=p, q=q),
|
|
|
|
| 336 |
return composition.Entity(
|
| 337 |
context=context,
|
| 338 |
value=answer,
|
| 339 |
+
description='Seja {self} o resultado da divisão entre {p} e {q}.',
|
| 340 |
p=p, q=q)
|
| 341 |
|
| 342 |
|
|
|
|
| 590 |
simplified = sympy.expand(sympy.simplify(exp))
|
| 591 |
|
| 592 |
template = random.choice([
|
| 593 |
+
'Simplifica {exp}.',
|
| 594 |
])
|
| 595 |
return example.Problem(
|
| 596 |
question=example.question(context, template, exp=exp),
|
mathematics_dataset/mathematics_dataset/modules/calculus.py
CHANGED
|
@@ -92,7 +92,7 @@ def _template(module_count, derivative_order, num_variables):
|
|
| 92 |
if derivative_order == 1:
|
| 93 |
templates += [
|
| 94 |
'Deriva {eq} em relação a {var}.',
|
| 95 |
-
'
|
| 96 |
'Qual é a derivada de {eq} em relação a {var}?',
|
| 97 |
]
|
| 98 |
|
|
|
|
| 92 |
if derivative_order == 1:
|
| 93 |
templates += [
|
| 94 |
'Deriva {eq} em relação a {var}.',
|
| 95 |
+
'Deriva {eq} em relação a {var}.',
|
| 96 |
'Qual é a derivada de {eq} em relação a {var}?',
|
| 97 |
]
|
| 98 |
|
mathematics_dataset/mathematics_dataset/modules/comparison.py
CHANGED
|
@@ -102,7 +102,7 @@ def _make_comparison_question(context, left, right):
|
|
| 102 |
left.handle if sympy.Gt(left.value, right.value) else right.handle)
|
| 103 |
template = random.choice([
|
| 104 |
'Qual é maior: {left} ou {right}?',
|
| 105 |
-
'Qual é
|
| 106 |
])
|
| 107 |
else:
|
| 108 |
answer = (
|
|
@@ -125,20 +125,20 @@ def _make_comparison_question(context, left, right):
|
|
| 125 |
|
| 126 |
templates = {
|
| 127 |
'<': [
|
| 128 |
-
'
|
| 129 |
-
'
|
| 130 |
-
'
|
| 131 |
],
|
| 132 |
'<=': [
|
| 133 |
-
'
|
| 134 |
-
'
|
| 135 |
-
'
|
| 136 |
-
'
|
| 137 |
],
|
| 138 |
'>': [
|
| 139 |
-
'
|
| 140 |
-
'
|
| 141 |
-
'
|
| 142 |
],
|
| 143 |
'>=': [
|
| 144 |
'Será {left} ' + ops.GE_SYMBOL + ' {right}?',
|
|
@@ -147,18 +147,18 @@ def _make_comparison_question(context, left, right):
|
|
| 147 |
'É verdade que {left} é, pelo menos, maior do que {right}?',
|
| 148 |
],
|
| 149 |
'=': [
|
| 150 |
-
'
|
| 151 |
'Serão {left} e {right} iguais?',
|
| 152 |
-
'
|
| 153 |
'Será que {left} e {right} possuem o mesmo valor?',
|
| 154 |
],
|
| 155 |
'!=': [
|
| 156 |
-
'
|
| 157 |
-
'
|
| 158 |
-
'
|
| 159 |
-
'
|
| 160 |
-
'
|
| 161 |
-
'
|
| 162 |
],
|
| 163 |
}
|
| 164 |
|
|
|
|
| 102 |
left.handle if sympy.Gt(left.value, right.value) else right.handle)
|
| 103 |
template = random.choice([
|
| 104 |
'Qual é maior: {left} ou {right}?',
|
| 105 |
+
'Qual é maior: {left} ou {right}?',
|
| 106 |
])
|
| 107 |
else:
|
| 108 |
answer = (
|
|
|
|
| 125 |
|
| 126 |
templates = {
|
| 127 |
'<': [
|
| 128 |
+
'É {left} ' + ops.LT_SYMBOL + ' {right}?',
|
| 129 |
+
'É {left} menor que {right}?',
|
| 130 |
+
'É {left} menor do que {right}?',
|
| 131 |
],
|
| 132 |
'<=': [
|
| 133 |
+
'É {left} ' + ops.LE_SYMBOL + ' {right}?',
|
| 134 |
+
'É {left} menor ou igual a {right}?',
|
| 135 |
+
'É {left}, no máximo, {right}?',
|
| 136 |
+
'É {left}, no máximo, tão grande quanto {right}?',
|
| 137 |
],
|
| 138 |
'>': [
|
| 139 |
+
'É {left} ' + ops.GT_SYMBOL + ' {right}?',
|
| 140 |
+
'É {left} maior que {right}?',
|
| 141 |
+
'É {left} maior do que {right}?',
|
| 142 |
],
|
| 143 |
'>=': [
|
| 144 |
'Será {left} ' + ops.GE_SYMBOL + ' {right}?',
|
|
|
|
| 147 |
'É verdade que {left} é, pelo menos, maior do que {right}?',
|
| 148 |
],
|
| 149 |
'=': [
|
| 150 |
+
'{left} ' + ops.EQ_SYMBOL + ' {right}?',
|
| 151 |
'Serão {left} e {right} iguais?',
|
| 152 |
+
'É {left} igual a {right}?',
|
| 153 |
'Será que {left} e {right} possuem o mesmo valor?',
|
| 154 |
],
|
| 155 |
'!=': [
|
| 156 |
+
'{left} ' + ops.NE_SYMBOL + ' {right}?',
|
| 157 |
+
'É {left} diferente de {right}?',
|
| 158 |
+
'{left} e {right} são desiguais?',
|
| 159 |
+
'{left} e {right} não são equivalentes?',
|
| 160 |
+
'{left} e {right} não são iguais?',
|
| 161 |
+
'{left} e {right} possuem valores diferentes?',
|
| 162 |
],
|
| 163 |
}
|
| 164 |
|
mathematics_dataset/mathematics_dataset/modules/numbers.py
CHANGED
|
@@ -255,7 +255,7 @@ def is_prime(value, sample_args, context=None):
|
|
| 255 |
|
| 256 |
return example.Problem(
|
| 257 |
question=example.question(
|
| 258 |
-
context, '
|
| 259 |
integer=integer_entity.expression_else_handle,
|
| 260 |
attribute=attribute_name),
|
| 261 |
answer=answer)
|
|
@@ -282,9 +282,9 @@ def is_factor(value, sample_args, context=None):
|
|
| 282 |
(entity,) = context.sample(sample_args, [integer])
|
| 283 |
|
| 284 |
templates = [
|
| 285 |
-
'
|
| 286 |
-
'
|
| 287 |
-
'
|
| 288 |
]
|
| 289 |
if maybe_factor == 2:
|
| 290 |
templates += [
|
|
|
|
| 255 |
|
| 256 |
return example.Problem(
|
| 257 |
question=example.question(
|
| 258 |
+
context, '{integer} {attribute}?',
|
| 259 |
integer=integer_entity.expression_else_handle,
|
| 260 |
attribute=attribute_name),
|
| 261 |
answer=answer)
|
|
|
|
| 282 |
(entity,) = context.sample(sample_args, [integer])
|
| 283 |
|
| 284 |
templates = [
|
| 285 |
+
'{maybe_factor} um fator de {value}?',
|
| 286 |
+
'{value} um múltiplo de {maybe_factor}?',
|
| 287 |
+
'{maybe_factor} divide {value}?',
|
| 288 |
]
|
| 289 |
if maybe_factor == 2:
|
| 290 |
templates += [
|