Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions Rules/Languages/es/SharedRules/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1372,11 +1372,11 @@
- if: ".='-' or .=':'"
then: [T: "enlace simple"] # phrase(un 'enlace simple' entre dos átomos)
- else_if: ".='=' or .='∷'"
then: [T: "doble enlace"]
then: [T: "enlace doble"] # ONCE B 6-1, 8.1.2
- else_if: ".='≡'"
then: [T: "triple enlace"]
then: [T: "enlace triple"]
- else_if: ".='≣'"
then: [T: "cuádruple enlace"]
then: [T: "enlace cuádruple"]
else: [x: "text()"]

- name: chemical-formula-operator
Expand All @@ -1395,16 +1395,39 @@
- if: ".='→' or .='⟶'"
then_test:
if: "$Verbosity='Terse'"
then: [T: "forma"] # phrase(hidrógeno y oxígeno 'forma' agua)
else: [T: "reacciona para formar"] # phrase(hidrógeno y oxígeno 'reacciona para formar' agua)
- else_if: ".='⇌' or .='🣑'" # U+01F8D1
then: [T: "da"] # phrase(hidrógeno más oxígeno 'da' agua)
else: [T: "produce"] # phrase(hidrógeno más oxígeno 'produce' agua) (SEP, EcuRed)
- else_if: ".='⇌' or .='🣑' or .='⇄' or .='⇆'" # U+01F8D1; ⇄ ⇆ también son equilibrio (ONCE B 6-1, 6.3)
then: [T: "está en equilibrio con"]
- else_if: ".='🣓'" # U+1F8D3
then: [T: "está en equilibrio desplazado a la izquierda con"]
- else_if: ".='🣒'" # U+1F8D2
then: [T: "está en equilibrio desplazado a la derecha con"]
else: [x: "*"]

- name: chemical-gas-precipitate-hydrate
# CO₂↑, CaCO₃↓ y el punto de los hidratos (ONCE B 6-1, 6.5, 6.6 y 8.2.2; SEP)
tag: [chemical-equation-operator, chemical-formula-operator]
match: ".='↑' or .='↓' or .='·' or .='⋅' or .='⇄' or .='⇆'"
replace:
- bookmark: "@id"
- test:
- if: ".='↑'"
then: [T: "desprendimiento gaseoso"] # phrase(c o 2 'desprendimiento gaseoso')
- else_if: ".='↓'"
then: [T: "precipitado"] # phrase(c a c o 3 'precipitado')
- else_if: ".='⇄' or .='⇆'"
then: [T: "está en equilibrio con"] # ONCE B 6-1, 6.3
else: [T: "punto"] # phrase(n a 2 s o 4 'punto' 5 h 2 o)

- name: chemical-arrow-with-heat
# → con Δ encima: "produce con calor" (SEP, EcuRed)
tag: mover
match: "*[1][self::m:chemical-arrow-operator] and *[2][.='Δ' or .='∆']"
replace:
- x: "*[1]"
- T: "con calor" # phrase(c a c o 3 produce 'con calor' c a o)

- name: chemical-equation-operator
tag: chemical-equation-operator
match: "."
Expand Down
2 changes: 1 addition & 1 deletion Rules/Languages/es/unicode-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@
- "⧵": [T: "operador barra invertida"] # 0x29f5 (en: 'reverse solidus operator', google: 'operador reverso de solidus')
- "⧶": [T: "barra oblicua con barra superior"] # 0x29f6
- "⧷": [T: "barra invertida con trazo horizontal"] # 0x29f7 (en: 'reverse solidus with horizontal stroke', google: 'reverse solidus con carrera horizontal')
- "⧸": [T: "sólido grande"] # 0x29f8 (en: 'big solidus', google: 'big solidus')
- "⧸": [T: "barra oblicua grande"] # 0x29f8 (en: 'big solidus', google: 'big solidus')
- "⧹": [T: "barra invertida grande"] # 0x29f9 (en: 'big reverse solidus', google: 'big reverso solidus')
- "⧺": [T: "doble signo más"] # 0x29fa (en: 'double plus', google: 'doble más')
- "⧻": [T: "triple signo más"] # 0x29fb (en: 'triple plus', google: 'triple plus')
Expand Down
36 changes: 25 additions & 11 deletions tests/Languages/es/chemistry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn ethylene_with_bond() -> Result<()> {
<mo>=</mo>
<mi>C</mi><msub><mi>H</mi><mn>2</mn></msub>
</mrow></math>";
test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "mayúscula h, 2, mayúscula c; doble enlace mayúscula c, mayúscula h, 2")?;
test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "mayúscula h, 2, mayúscula c; enlace doble mayúscula c, mayúscula h, 2")?;
return Ok(());

}
Expand All @@ -125,7 +125,7 @@ fn ethylene_with_colon_bond() -> Result<()> {
<mo>::</mo>
<mi>C</mi><msub><mi>H</mi><mn>2</mn></msub>
</mrow></math>";
test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "mayúscula h, 2, mayúscula c; doble enlace mayúscula c, mayúscula h, 2")?;
test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "mayúscula h, 2, mayúscula c; enlace doble mayúscula c, mayúscula h, 2")?;
return Ok(());

}
Expand Down Expand Up @@ -158,11 +158,11 @@ fn beta_decay() -> Result<()> {
</mmultiscripts>
</math>";
test_prefs("es", "ClearSpeak", vec![("Verbosity", "Terse")], expr,
"14, 6, mayúscula c; forma, 14, 7, mayúscula n; más 0, menos 1, e")?;
"14, 6, mayúscula c, da, 14, 7, mayúscula n; más 0, menos 1, e")?;
test_prefs("es", "ClearSpeak", vec![("Verbosity", "Medium")], expr,
"superíndice 14, sub 6, mayúscula c; reacciona para formar; superíndice 14, sub 7, mayúscula n; más superíndice 0, sub menos 1, e")?;
"superíndice 14, sub 6, mayúscula c; produce; superíndice 14, sub 7, mayúscula n; más superíndice 0, sub menos 1, e")?;
test_prefs("es", "ClearSpeak", vec![("Verbosity", "Verbose")], expr,
"superíndice 14, subíndice 6, mayúscula c; reacciona para formar; superíndice 14, subíndice 7, mayúscula n; más, superíndice 0, subíndice menos 1, e")?;
"superíndice 14, subíndice 6, mayúscula c; produce; superíndice 14, subíndice 7, mayúscula n; más, superíndice 0, subíndice menos 1, e")?;
return Ok(());

}
Expand Down Expand Up @@ -424,11 +424,11 @@ fn mhchem_beta_decay() -> Result<()> {
</mrow>
</math>";
test_prefs("es", "ClearSpeak", vec![("Verbosity", "Terse")], expr,
"14, 6, mayúscula c; forma, 14, 7, mayúscula n; más 0, menos 1, e")?;
"14, 6, mayúscula c, da, 14, 7, mayúscula n; más 0, menos 1, e")?;
test_prefs("es", "ClearSpeak", vec![("Verbosity", "Medium")], expr,
"superíndice 14, sub 6, mayúscula c; reacciona para formar; superíndice 14, sub 7, mayúscula n; más superíndice 0, sub menos 1, e")?;
"superíndice 14, sub 6, mayúscula c; produce; superíndice 14, sub 7, mayúscula n; más superíndice 0, sub menos 1, e")?;
test_prefs("es", "ClearSpeak", vec![("Verbosity", "Verbose")], expr,
"superíndice 14, subíndice 6, mayúscula c; reacciona para formar; superíndice 14, subíndice 7, mayúscula n; más, superíndice 0, subíndice menos 1, e")?;
"superíndice 14, subíndice 6, mayúscula c; produce; superíndice 14, subíndice 7, mayúscula n; más, superíndice 0, subíndice menos 1, e")?;
return Ok(());

}
Expand All @@ -443,7 +443,7 @@ fn hcl_na_yields() -> Result<()> {
</mrow>
</math>";
test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr,
"2, mayúscula h, mayúscula c l; más 2 mayúscula n a; reacciona para formar; 2, mayúscula n a; mayúscula c l; más mayúscula h, subíndice 2")?;
"2, mayúscula h, mayúscula c l; más 2 mayúscula n a; produce; 2, mayúscula n a; mayúscula c l; más mayúscula h, subíndice 2")?;
return Ok(());

}
Expand Down Expand Up @@ -582,7 +582,7 @@ fn mhchem_hcl_aq_etc() -> Result<()> {
</mrow>
</math>";
test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Terse")],
expr, "2, mayúscula h, mayúscula c l; acuoso; más, 2, mayúscula n a; sólido; forma; 2, mayúscula n a; mayúscula c l; acuoso; más, mayúscula h, 2; gaseoso")?;
expr, "2, mayúscula h, mayúscula c l; acuoso; más, 2, mayúscula n a; sólido, da; 2, mayúscula n a; mayúscula c l; acuoso; más, mayúscula h, 2; gaseoso")?;

return Ok(());

Expand Down Expand Up @@ -763,4 +763,18 @@ fn dropped_msubsup_bug_358() -> Result<()> {

}


#[test]
fn gas_precipitate_hydrate_heat() -> Result<()> {
// ONCE B 6-1 (6.3, 6.5, 6.6, 8.2.2), SEP y EcuRed
let cases = [
("<math><mi>C</mi><msub><mi>O</mi><mn>2</mn></msub><mo>↑</mo></math>", "mayúscula c, mayúscula o, sub 2; desprendimiento gaseoso"),
("<math><mi>Ca</mi><mi>C</mi><msub><mi>O</mi><mn>3</mn></msub><mo>↓</mo></math>", "mayúscula c a; mayúscula c, mayúscula o, sub 3; precipitado"),
("<math><msub><mi>Na</mi><mn>2</mn></msub><mi>S</mi><msub><mi>O</mi><mn>4</mn></msub><mo>·</mo><mn>5</mn><msub><mi>H</mi><mn>2</mn></msub><mi>O</mi></math>", "mayúscula n a, sub 2, mayúscula s, mayúscula o, sub 4; punto, 5, mayúscula h, sub 2, mayúscula o"),
("<math><msub><mi>N</mi><mn>2</mn></msub><mo>+</mo><mn>3</mn><msub><mi>H</mi><mn>2</mn></msub><mo>⇄</mo><mn>2</mn><mi>N</mi><msub><mi>H</mi><mn>3</mn></msub></math>", "mayúscula n, sub 2, más, 3 mayúscula h, sub 2; está en equilibrio con; 2, mayúscula n, mayúscula h, sub 3"),
("<math><mi>Ca</mi><mi>C</mi><msub><mi>O</mi><mn>3</mn></msub><mover><mo>→</mo><mi mathvariant=\"normal\">Δ</mi></mover><mi>Ca</mi><mi>O</mi><mo>+</mo><mi>C</mi><msub><mi>O</mi><mn>2</mn></msub></math>", "mayúscula c a; mayúscula c, mayúscula o, sub 3; produce con calor; mayúscula c a; mayúscula o; más, mayúscula c, mayúscula o, sub 2"),
];
for (expr, speech) in cases {
test_prefs("es", "SimpleSpeak", vec![("Verbosity", "Medium")], expr, speech)?;
}
return Ok(());
}
Loading