Skip to content

Commit 6937925

Browse files
NSoifferhammera
andauthored
Merge latest hu changes (daisy#696)
* Add few tweaks into the Rules/Languages/hu/definitions.yaml file, Added missing definitions.rs test file the test/Languages/hu directory, and added SimpleSpeak test directory the mroot and menclose tests (daisy#646) * Do more localization in Rules/Languages/hu/definitions.yaml Signed-off-by: Attila Hammer <hammera@pickup.hu> * Add in Simplespeak tests the definition, mroot and menclose tests Signed-off-by: Attila Hammer <hammera@pickup.hu> * fix some werbs in intervals into rules/Languages/hu/ClearSpeak_rules.yaml and SimpleSpeak_rules.yaml Signed-off-by: Attila Hammer <hammera@pickup.hu> * Fix tests after interval Clearspeak and SimpleSpeak verb change Signed-off-by: Attila Hammer <hammera@pickup.hu> --------- Signed-off-by: Attila Hammer <hammera@pickup.hu> * Apply Hungarian unicode fixes from PR daisy#673 * Update Hungarian language and test rules from PR daisy#694 * Fix a mistake after the selective merge with definitions.yaml and definition.rs test file (daisy#697) Signed-off-by: Attila Hammer <hammera@pickup.hu> --------- Signed-off-by: Attila Hammer <hammera@pickup.hu> Co-authored-by: hammera <hammera@pickup.hu>
1 parent 58aa858 commit 6937925

11 files changed

Lines changed: 398 additions & 114 deletions

File tree

‎Rules/Languages/hu/ClearSpeak_Rules.yaml‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -568,27 +568,25 @@
568568

569569
- name: set
570570
tag: set
571-
match: "."
571+
# Empty set and braced/{set-builder} forms (typically 0–1 child).
572+
# Multi-arg intent set($x,$y,...) and set($x) with @arg fall through to function-intent
573+
# ("the set of …").
574+
match: "count(*)=0 or (count(*)=1 and not(*[1][@arg]))"
572575
replace:
573576
- test:
574577
- if: "count(*)=0"
575578
then: [T: "az üres halmaz"] # phrase('the empty set')
576-
- else_if: "count(*)=2"
577-
then:
578-
- test:
579-
if: "$Verbosity!='Terse'"
580-
then: [T: "az"] # phrase('the' empty set)
581-
- T: "üres halmaz" # phrase(the 'empty set')
582579
- else_if: "count(*[1]/*)=3 and *[1]/*[2][self::m:mo][.=':' or .='|' or .='∣']"
583580
then:
584581
- test:
585582
if: "$Verbosity!='Terse'"
586-
then: [T: ""] # phrase('the' set of all integers)
587-
- x: "*[1]/*[1]"
588-
- T: "melyekre teljesül, hogy" # phrase(this is a 'set of' numbers)
583+
then: [T: ""] # phrase('the' empty set)
584+
- T: "" # phrase(the 'empty set')
589585
- test:
590586
if: "$ClearSpeak_Sets != 'woAll'"
591587
then: [T: "minden"] # phrase(the set of 'all' integers)
588+
- x: "*[1]/*[1]"
589+
- T: "melyekre teljesül, hogy" # phrase(the set S 'such that' x is less than y)
592590
- x: "*[1]/*[3]"
593591
else:
594592
- test:

‎Rules/Languages/hu/SharedRules/default.yaml‎

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
- test:
6363
- if: "string-length(.) = 1 and text() != '_'" # need unicode.tdl to kick in for single letter tokens
6464
then: [x: "text()"]
65-
- else_if: "@data-chem-element > 0 or @data-roman-numeral" # NavMode=Character needs this
65+
- else_if: "@data-chem-element or @data-roman-numeral" # NavMode=Character needs this
6666
then: [SPELL: "text()", pause: "short"]
6767
else: [x: "translate(., '-_\u00A0', ' ')"] # from intent literals or from extra spaces added (which get deleted)
6868

@@ -237,26 +237,12 @@
237237
- x: "*[2]"
238238
- T: "alatt" # phrase(x with z 'below' it)
239239

240-
# FIX: this only works for up to four dots (which is realistically all we need)
241-
- name: dot-over
242-
tag: modified-variable
243-
match: "*[1][self::m:mi] and (*[2][translate(., '.', '')=''])"
244-
replace:
245-
- x: "*[1]"
246-
- x: "IfThenElse(string-length(*[2])=1, 'pont',
247-
IfThenElse(string-length(*[2])=2, 'pont pont',
248-
IfThenElse(string-length(*[2])=3, 'pont pont pont', 'pont pont pont pont')
249-
))"
250-
- pause: short
251-
252-
# FIX: the 'translate' list is a little different from 'modified-variable', so we also include 'mover' (unify?)
253240
- name: diacriticals
254-
tag: [mover, modified-variable]
241+
tag: mover
255242
match: "*[1][self::m:mi] and *[2][translate(., '\u0306\u030c.\u00A8\u02D9\u20DB\u20DC`^ˇ~→¯_', '')='']"
256243
replace:
257244
- x: "*[1]"
258245
- x: "*[2]"
259-
- pause: short
260246

261247
- name: default
262248
tag: mover
@@ -434,23 +420,22 @@
434420
- T: "szkriptek vége" # phrase(At this point 'end scripts' occurs)
435421

436422
- name: default
437-
tag: [mtable, array]
423+
tag: mtable
438424
variables:
439425
- IsColumnSilent: "false()"
440-
- NumColumns: "CountTableColumns(.)"
441-
- NumRows: "CountTableRows(.)"
426+
- NumColumns: "count(*[1]/*) - IfThenElse(*/self::m:mlabeledtr, 1, 0)"
442427
match: "."
443428
replace:
444429
- T: "táblázat" # phrase(the 'table with' 3 rows)
445-
- x: "$NumRows"
430+
- x: count(*)
446431
- test:
447-
if: "$NumRows=1"
432+
if: count(*)=1
448433
then: [T: "sorral"] # phrase(the table with 1 'row')
449434
else: [T: "sorral"] # phrase(the table with 3 'rows')
450435
- T: "és" # phrase(the table with 3 rows 'and' 4 columns)
451436
- x: "$NumColumns"
452437
- test:
453-
if: "$NumColumns=1"
438+
if: "NumColumns=1"
454439
then: [T: "oszloppal"] # phrase(the table with 3 rows and 1 'column')
455440
else: [T: "oszloppal"] # phrase(the table with 3 rows and 4 'columns')
456441
- pause: long
@@ -491,6 +476,18 @@
491476
- x: "count(preceding-sibling::*)+IfThenElse(parent::m:mlabeledtr, 0, 1)"
492477
- pause: medium
493478
- x: "*"
479+
- test:
480+
# short pause after each element; medium pause if last element in a row; long pause for last element in matrix
481+
if: "HasVisibleColumnLine(../.., count(preceding-sibling::*) + 1)"
482+
then:
483+
- pause: short
484+
- T: "elválasztó"
485+
- test:
486+
# Announce a row separator only after the row's final cell, so it is spoken once per horizontal boundary.
487+
if: "count(following-sibling::*) = 0 and HasVisibleRowLine(../.., count(../preceding-sibling::*) + 1)"
488+
then:
489+
- pause: short
490+
- T: "sorelválasztó"
494491
- test:
495492
# short pause after each element; medium pause if last element in a row; long pause for last element in matrix
496493
- if: count(following-sibling::*) > 0
@@ -500,6 +497,7 @@
500497
else: [pause: long]
501498

502499

500+
503501
- name: empty-box
504502
# The ordering below is the order in which words come out when there is more than one value
505503
# Note: @notation can contain more than one value
@@ -720,16 +718,27 @@
720718
replace:
721719
- x: "SpeakIntentName(name(.), $Verbosity, 'function')"
722720
- test:
723-
if: "$Verbosity != 'Terse' and not(contains(@data-intent-property, ':literal:')) and
724-
not(count(*)=2 and (IsInDefinition(*[1], 'TrigFunctionNames') or IsInDefinition(name(.), 'TerseFunctionNames')) and IsNode(*[2], 'simple'))"
725-
then: [T: "", pause: auto] # phrase(sine 'of' 5)
726-
- insert:
727-
nodes: "*"
728-
replace:
729-
- test:
730-
if: "not(contains(@data-intent-property, ':literal:'))"
731-
then: [x: "','"]
721+
- if: "IntentFunctionUseArityPath(name(.), 'function', count(*))"
722+
then:
723+
- x: "IntentFunctionGlueBefore(name(.), 'function', 1, count(*))"
732724
- pause: auto
725+
- insert:
726+
nodes: "*"
727+
replace:
728+
- x: "IntentFunctionGlueBefore(name(.), 'function', $InsertIndex, count(*))"
729+
- pause: auto
730+
else:
731+
- test:
732+
if: "$Verbosity != 'Terse' and not(contains(@data-intent-property, ':literal:')) and
733+
not(count(*)=2 and (IsInDefinition(*[1], 'TrigFunctionNames') or IsInDefinition(name(.), 'TerseFunctionNames')) and IsNode(*[2], 'simple'))"
734+
then: [T: "", pause: auto] # phrase(sine 'of' 5)
735+
- insert:
736+
nodes: "*"
737+
replace:
738+
- test:
739+
if: "not(contains(@data-intent-property, ':literal:'))"
740+
then: [x: "IntentFunctionArgSeparator(name(.), 'function', count(*))"]
741+
- pause: auto
733742
- test:
734743
# speak "end ..." if not bracketed or last child is not simple and not last node
735744
if: "$Impairment = 'Blindness' and not(*[last()][IsBracketed(., '', '') or IsNode(., 'simple')] )"

‎Rules/Languages/hu/SharedRules/general.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@
7070

7171
- name: real-part
7272
tag: real-part
73-
match: "."
73+
match: "count(*)=0"
7474
replace:
7575
- bookmark: "@id"
7676
- T: "valós rész" # phrase('the real part' of a complex number does not include the imaginary part)
7777

7878
- name: imaginary-part
7979
tag: imaginary-part
80-
match: "."
80+
match: "count(*)=0"
8181
replace:
8282
- bookmark: "@id"
8383
- T: "képzetes rész" # phrase('the imaginary part' is part of a complex number)

‎Rules/Languages/hu/SharedRules/geometry.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060

6161
- name: coordinate
6262
tag: coordinate
63-
match: "."
63+
# Intent forms coordinate($x,...) use @arg and fall through to function-intent / IntentMappings
64+
match: "not(*[@arg])"
6465
replace:
6566
- test:
6667
if: "$Verbosity='Verbose'"

‎Rules/Languages/hu/definitions.yaml‎

Lines changed: 77 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,71 @@
11
---
22
- include: "../../definitions.yaml"
33

4-
# If an "intent" is used, the 'terse:medium:verbose' speech for the intent name is given here for a prefix||infix||postfix||function fixity
5-
# If only one ":" is used, the first part is used for 'terse' and the second part is used for 'medium' and 'verbose'
6-
# If no ":"s are used, the same speech is used for all forms
7-
# If bracketing words make sense, they are separated with ";"s
8-
# Intent mappings must specify whether they are "prefix", "infix", "postfix", or "function" with an "=" sign
9-
# If there are multiple fixities (e.g., see transpose), they are separated with "||"
10-
# for readability, spaces can be used around any of the delimiter characters
11-
# Note: if there are multiple fixities, the first one is used if the fixity is not given in the intent
4+
# IntentMappings Syntax:
5+
#
6+
# This section defines how each "intent" is spoken for various grammatical forms (fixities such as "prefix", "infix", "postfix", and "function"),
7+
# along with supporting different verbosity levels.
8+
# The syntax is a little bit complicated, but allows a declarative syntax so you don't have to write as many rules.
9+
#
10+
# For each intent, you specify spoken forms for one or more fixities using the syntax below.
11+
#
12+
# - Each mapping has the form:
13+
# "<intent>": "<fixity1>=<speech1> || <fixity2>=<speech2> || ...",
14+
# or just
15+
# "<intent>": "<speech>",
16+
# where <speech> is used for all forms if fixity and '=' are omitted.
17+
#
18+
# - If an intent has multiple fixities, separate them with "||". Spaces are allowed around delimiters for readability.
19+
# - If only one ":" is present in *<speech>*, it provides the 'terse' form, and the following string is used for both 'medium' and 'verbose'.
20+
# - If more than one ":" is present, the string is split into 'terse', 'medium', and 'verbose' forms, in that order (each separated by ":").
21+
# - If no ":" is present, the same spoken form is used for all styles.
22+
#
23+
# - Use semicolons ";" to divide opening, main, and closing bracketing words within a speech string, where such words make sense.
24+
# - If an intent has multiple fixities but a definition does not specify one, the first fixity listed is chosen by default.
25+
#
26+
# Functions and argument glue:
27+
# - The "|" character delimits options describing how to glue arguments together when speaking function arguments.
28+
# - Arity templates (multiple "|" options, or one option with ','-separated glue words): glue-word count
29+
# implies arity; the final argument is preceded by "of". Example: "sum | over | from,to"
30+
# - 1 arg: "sum of x"
31+
# - 2 args: "sum over i of x"
32+
# - 3 args: "sum from i to n of x"
33+
# If no option matches the argument count, separators fall back to "comma".
34+
# - Binary separator (exactly one "|" option, no commas in it): after "of", that word joins the two args.
35+
# Example: "quotient": "function=integer part | divided by" → "integer part of x divided by y"
36+
# If there are not exactly two args, separators fall back to "comma" (no real n-ary use of these words).
37+
#
38+
# BNF-like description:
39+
#
40+
# IntentMappingsEntry ::= <intent> ":" <intent_speech>
41+
#
42+
# <intent_speech> ::= <fixity_speech> ( "||" <fixity_speech> )*
43+
# | <simple_speech>
44+
#
45+
# <fixity_speech> ::= <fixity> "=" <speech_options>
46+
#
47+
# <fixity> ::= "prefix" | "infix" | "postfix" | "function" | "nofix" | "silent"
48+
#
49+
# <speech_options> ::= <speech_string>
50+
# | <speech_string> "|" <arg_glue> ( "|" <arg_glue> )*
51+
#
52+
# <speech_string> ::= text
53+
# # May use ":" to separate terse:medium:verbose forms.
54+
# # May use ";" for bracketing (opening; main; closing).
55+
#
56+
# <arg_glue> ::= text
57+
# # One option, no commas: binary separator after "of" (e.g. "divided by").
58+
# # One option with "," or several "|" options: arity templates
59+
# # (glue-word count = arg_count - 1; last arg preceded by "of").
60+
# # Unmatched arity (or binary glue with ≠2 args): fall back to "comma".
61+
#
62+
# <simple_speech> ::= <speech_string> (applies to all fixities)
63+
#
64+
# Example:
65+
# "absolute-value": "function= ; absolute value: the absolute value: the absolute value; end absolute value"
66+
# "sum": "function=sum | over | from,to"
67+
# "quotient": "function=integer part | divided by"
68+
#
1269
- IntentMappings: {
1370
"indexed-by": "infix= alsó index kezdete; alsó index; alsó index vége: alsó index vége: alsó index vége",
1471
"say-super": "infix=felső index: felső index: felső index", # used with 'mo' for superscripts (e.g, "<")
@@ -30,14 +87,14 @@
3087
#"fraction":"function=fraction; over; end fraction", # NOTE: Fails
3188
"mixed-fraction":"infix=és", # NOTE: in website says function, but follow infix speech pattern.
3289
"greatest-common-divisor": "function=a legnagyobb közös osztó",
33-
"quotient":"function=egész rész osztva", # NOTE: Logic somewhere here failing, becomes "divided by of x comma, y" instead of "integer part of x divided by y"
90+
"quotient":"function=egész rész | osztva", # NOTE: Logic somewhere here failing, becomes "divided by of x comma, y" instead of "integer part of x divided by y"
3491
"evaluated-at":"infix=értékelve || postfix=értékként",
35-
"remainder":"function=a maradék, osztva",
92+
"remainder":"function=a maradék | osztva",
3693
"max":"function=max",
3794
"min":"function=min",
3895
"power":"infix=a hatványra",
3996
"root":"function=root",
40-
"imaginary-part": "a képzeletbeli rész",
97+
"imaginary-part": "function=a képzeletbeli rész: a képzeletbeli rész: a képzeletbeli rész",
4198
"least-common-multiple": "function=lcm: a legkisebb közös többszörös: a legkisebb közös többszörös",
4299
"complex-conjugate":"function=Komplex konjugált",
43100
"complex-arg":"function=argumentum",
@@ -74,15 +131,15 @@
74131
"tends-to-from-below":"infix=alulról indul",
75132
### Sets
76133
"set": "function= ; halmaz: a halmaz",
77-
"set-difference":"function=különbséghalmaz || infix=mínusz || postfix=különbséghalmaza", # NOTE: not tested
134+
"set-difference":"function=különbséghalmaz | és || infix=mínusz",
78135
"complement":"function=komplemens",
79-
"empty-set":"function=üres halmaz",
136+
"empty-set":"nofix=üres halmaz",
80137
"cardinality":"function=számosság", # NOTE: does not have a defined speech template in website
81138
"list":"function=lista",
82139
"tuple": "function= ; tuple: a tuple",
83140
### Sequence and Series
84-
"sum":"function= ; összegzés : összeg ; ", #: sum over : sum from; to",
85-
"product":"function=szorzat || function=szorzat vége || function=szorzat innen ide",
141+
"sum": "function=összeg",
142+
"product":"function=szorzat",
86143

87144
### Elementary classical functions
88145
"sine":"function=szinusz: szinusz",
@@ -118,7 +175,7 @@
118175
"variance":"function=variencia",
119176
"median":"function=medián",
120177
"mode":"function=mód",
121-
"conditional-probability":"function=valószínűség; adott", # NOTE: Check test
178+
"conditional-probability":"function=valószínűség",
122179

123180

124181
### Linear Algebra
@@ -133,7 +190,7 @@
133190
"unit-vector":"prefix=egységvektor",
134191

135192
"identity-matrix":"nofix=identitásmátrix", # NOTE: no function specified
136-
"transpose":"function=transzponált || postfix=transzponált", # postfix needs testing
193+
"transpose":"postfix=transzponált || function=transzponált",
137194
"dimensional-product":"infix=a(z)", # INFIX
138195

139196

@@ -164,10 +221,11 @@
164221
### General Concepts
165222
"fenced-group":"function=bekerített csoport", # appears both under general concepts and grouping
166223
# NOTE: in site mentions "the pair x and y", due to being defined as function, needs the "of" keyword
167-
"ordered-pair": "function= ; a pár; és", # Needs to be tested, test converts "and" to "comma,"
224+
"ordered-pair": "function=a pár | és", # Needs to be tested, test converts "and" to "comma,"
168225
"highlight":"postfix=kiemelt",
169226
"least-common-denominator":"function=legkisebb közös nevező",
170227
"rate":"infix=per",
228+
"translation":"function=fordítás",
171229
"constraint":"infix= ; feltétellel; ",
172230

173231
"binomial-coefficient":"infix=választ",
@@ -269,7 +327,7 @@
269327
## Default fixity nofix
270328
"diameter":"nofix=átmérő: átmérő",
271329
"distance":"nofix=távolság; távolság: távolság",
272-
"probability":"nofix=P: valószínűség",
330+
"probability":"nofix=P: valószínűség || function=valószínűség",
273331
"radius":"nofix=r: sugár",
274332
"volume":"nofix=hangerő: hangerő || function=hangerő",
275333
"exponential-e":"nofix=e",

0 commit comments

Comments
 (0)