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
34 changes: 17 additions & 17 deletions Rules/Languages/hu/definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,30 +347,30 @@

- NavigationParts: {
# These are the parts of a formula that can be navigated to
"large-op": "base; lower limit; upper limit",
"mfrac": "numerator; denominator",
"large-op": "alap; alsó határ; felső határ",
"mfrac": "számláló; nevező",
"fraction": "számláló; nevező",
"msqrt": "gyök",
"square-root": "gyök",
"mroot": "root; root index",
"mroot": "gyök; gyök index",
"root": "gyök; gyök index",
"msub": "base; subscript",
"sub": "base; subscript",
"logarithm-with-base": "base",
"indexed-by": "base; subscript",
"msup": "base; superscript",
"say-super": "base; superscript",
"skip-super": "base; superscript",
"power": "base; exponent",
"msubsup": "base; subscript; superscript",
"munder": "base; under limit",
"mover": "base; upper limit",
"munderover": "base; under limit; upper limit",
"msub": "alap; alsó index",
"sub": "alap; alsó index",
"logarithm-with-base": "alap",
"indexed-by": "alap; alsó index",
"msup": "alap; felső index",
"say-super": "alap; felső index",
"skip-super": "alap; felső index",
"power": "alap; kitevő",
"msubsup": "alap; alsó index; felső index",
"munder": "alap; határérték alatt",
"mover": "alap; határérték felett",
"munderover": "alap; határérték alatt; határérték felett",

# words for moving into and out of one of the parts (e.g., "move right 'out of' numerator, 'in' denominator")
# it's a hack to put them here, but at least they are grouped with the other navigation parts
"in": "in",
"out": "out of",
"in": "ban/ben",
"out": "ki",
}

- KnownWords: {
Expand Down
18 changes: 9 additions & 9 deletions Rules/Languages/hu/navigate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,30 @@
then: [T: "teljesen ráközelített"] # phrase('zoomed in all of the way')
- else_if: "$NavNodeOffset = 0"
then: [T: "ráközelített az első karakterre"] # phrase('zoomed in to first character')
else: [T: "karakterre nagyítva"] # phrase('zoomed in to character')
else: [T: "ráközelített a karakterre"] # phrase('zoomed in to character')
- pause: "medium"
else:
- test:
# CommandOffset is 1 + length of the English NavCommand stem (Zoom/Move/Read/Describe),
# not the spoken Prefix length — so translations can use a different Prefix word.
- if: "starts-with($NavCommand, 'Zoom')"
then: [set_variables: [Prefix: "'zoom'", CommandOffset: "5"]] # phrase('zoom' in to see more details)
then: [set_variables: [Prefix: "'nagyítás'", CommandOffset: "5"]] # phrase('zoom' in to see more details)
- else_if: "starts-with($NavCommand, 'Move')"
then: [set_variables: [Prefix: "'move'", CommandOffset: "5"]] # phrase('move' to next entry in table)
then: [set_variables: [Prefix: "'ugrás'", CommandOffset: "5"]] # phrase('move' to next entry in table)
- else_if: "starts-with($NavCommand, 'Read')"
then: [set_variables: [Prefix: "'read'", CommandOffset: "5"]] # phrase('read' to next entry in table)
then: [set_variables: [Prefix: "'olvasás'", CommandOffset: "5"]] # phrase('read' to next entry in table)
- else_if: "starts-with($NavCommand, 'Describe')"
then: [set_variables: [Prefix: "'describe'", CommandOffset: "9"]] # phrase('describe' to next entry in table)
then: [set_variables: [Prefix: "'leírás'", CommandOffset: "9"]] # phrase('describe' to next entry in table)
- test:
if: "$Prefix != ''"
then:
- x: "$Prefix"
- test:
- if: "substring($NavCommand, $CommandOffset) = 'In'"
then: [T: "ban"] # phrase(zoom 'in' to see more details)
then: [T: ""] # phrase(zoom 'in' to see more details)
- else_if: "substring($NavCommand, $CommandOffset) = 'InAll'"
# HACK: '\uF8FE' is used internally for the concatenation char by 'ct' -- this gets "ed" concatenated to "zoom"
then: [T: "Teljesen kinagyítva"] # phrase(zoom 'out all of the way' to see more details)
then: [T: "Teljesen nagyítsa ki"] # phrase(zoom 'out all of the way' to see more details)
- else_if: "substring($NavCommand, $CommandOffset) = 'Out'"
then: [T: "ki"] # phrase(zoom 'out' to see more details)
- else_if: "substring($NavCommand, $CommandOffset) = 'OutAll'"
Expand Down Expand Up @@ -1322,12 +1322,12 @@
if: "preceding-sibling::* and following-sibling::*[1][name(.)='none']"
then:
- with:
variables: [Move2D: "'out of'", Child2D: "."]
variables: [Move2D: "'ki'", Child2D: "."]
replace: [x: ".."]
- x: "following-sibling::*[1]"
else:
- with:
variables: [Move2D: "'in'", Child2D: "following-sibling::*[1]"] # phrase('in' the denominator)
variables: [Move2D: "'ban/ben'", Child2D: "following-sibling::*[1]"] # phrase('in' the denominator)
replace: [x: ".."]
- with:
variables: [NavCommand: "'MoveNextZoom'"]
Expand Down
14 changes: 6 additions & 8 deletions src/canonicalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2412,23 +2412,21 @@ impl CanonicalizeContext {
// This is not yet in canonical form, so the fences may be siblings or siblings of the parent
let preceding_siblings = as_element(children[0]).preceding_siblings();
let following_siblings = as_element(children[end-1]).following_siblings();
let first_child;
let last_child;
if preceding_siblings.is_empty() && following_siblings.is_empty() {


let (first_child, last_child) = if preceding_siblings.is_empty() && following_siblings.is_empty() {
// number spans all children, look to parent for fences
let preceding_children = mrow.preceding_siblings();
let following_children = mrow.following_siblings();
if preceding_children.is_empty() || following_children.is_empty() {
return true; // doesn't have left or right fence
}
first_child = preceding_children[preceding_children.len()-1];
last_child = following_children[0];
(preceding_children[preceding_children.len()-1], following_children[0])
} else if preceding_siblings.is_empty() || following_siblings.is_empty() {
return true; // can't be fences around it
} else {
first_child = preceding_siblings[preceding_siblings.len()-1];
last_child = following_siblings[0];
}
(preceding_siblings[preceding_siblings.len()-1], following_siblings[0])
};
let first_child = as_element(first_child);
let last_child = as_element(last_child);
return !(name(first_child) == "mo" && is_fence(first_child) &&
Expand Down
15 changes: 6 additions & 9 deletions src/chemistry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,17 +1384,14 @@ pub fn likely_adorned_chem_formula(mathml: Element) -> i32 {
// prescripts are normally positive integers, chem 2.5.1 allows for a superscript for a Lewis dot
// postscript should be a charge

let prescripts;
let postscripts;
if children.len() == 4 && name(as_element(children[1]))=="mprescripts" { // just prescripts
prescripts = &children[2..4];
postscripts = &children[0..0]; // empty


let (prescripts, postscripts) = if children.len() == 4 && name(as_element(children[1]))=="mprescripts" { // just prescripts
(&children[2..4], &children[0..0]) // empty
} else if children.len() == 6 && name(as_element(children[3]))=="mprescripts" { // pre and postscripts
prescripts = &children[4..6];
postscripts = &children[1..3]; // empty
(&children[4..6], &children[1..3]) // empty
} else if children.len() == 3 || children.len() == 5 { // just postscripts (simultaneous or offset)
prescripts = &children[0..0]; // empty
postscripts = &children[1..];
(&children[0..0], &children[1..])
} else {
return NOT_CHEMISTRY;
};
Expand Down
14 changes: 6 additions & 8 deletions src/tts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,18 +669,16 @@ impl TTS {
/// There is a bias towards pausing more _after_ longer strings.
pub fn compute_auto_pause(&self, prefs: &PreferenceManager, before: &str, after: &str) -> Result<String> {
static REMOVE_XML: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"<.+?>").unwrap()); // punctuation ending with a '.'
let before_len;
let after_len;
match self {


let (before_len, after_len) = match self {
TTS::SSML | TTS::SAPI5 => {
before_len = REMOVE_XML.replace_all(before, "").len();
after_len = REMOVE_XML.replace_all(after, "").len();
(REMOVE_XML.replace_all(before, "").len(), REMOVE_XML.replace_all(after, "").len())
},
_ => {
before_len = before.len();
after_len = after.len();
(before.len(), after.len())
},
}
};

// pause values are not cut in stone
// the calculation bias to 'previous' is based on MathPlayer which used '30 * #-of-descendants-on-left
Expand Down
2 changes: 1 addition & 1 deletion tests/Languages/hu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ mod alphabets;
mod definitions;
mod intent;
mod mtable;

mod navigate;
Loading