- From: Andrew Hunt <andrew.hunt@holly.com.au>
- Date: Mon, 24 Sep 2007 00:37:12 -0700
- To: Sébastien Bratières <sebastien.bratieres@voice-insight.com>, <www-voice@w3.org>
Hi Sébastien, "sub-expansion" in Section 2.5 can be read as is any "contained expansion". The slight differences in the strict structure of ABNF vs. XML forms of SRGS are intentional. They arise because they are quite different language constructs; i.e. BNF vs. XML. Attachments are a notable difference because XML has the explicit attribute mechanism whereas ABNF relies upon parsing with precedence rules (see the comments in Section 2.8). In particular, this affects language attachment, weights and the repeat operator. That said, the design of SRGS is such that any ABNF grammar can be converted to an XML grammar that accepts identical input and vice versa. This "semantic mapping" is described in Section 1.3. As an example, the XSLT sample in Appendix F inserts parentheses when creating ABNF from XML to guarantee preservation of semantic mapping. The reverse transformation would necessarily have to add <item> elements in XML where there were no () in ABNF. (Note: in both directions you could optimise out of some of additions but sometimes they are strictly required.) BTW, even if repeat were added as an attribute to all the expansion elements in XML SRGS (which would lack elegance), there would still be the problem that tokens do not require an XML element. > Thus both the specification text and the ABNF authorize repeat's of any > rule expansion; however the XML form does not authorize it and restricts > it to <item>'s. To paraphase, you can surround any XML expansion with <item> without changing its accepting behaviour and then add a repeat definition. Regards, Andrew -----Original Message----- From: www-voice-request@w3.org [mailto:www-voice-request@w3.org] On Behalf Of Sébastien Bratières Sent: Saturday, 22 September 2007 1:37 AM To: www-voice@w3.org Subject: SRGS repeat attribute: for rule expansions or just for items? Hello, There seems to be a slight inconsistency in the use of the repeat operator between the XML form, and the ABNF form. The XML Schema definition of SRGS restricts the repeat attribute to be used exclusively on the <item> element, since the only occurrence of <xsd:attributeGroup ref="Repeat.attrib"/> is in the definition of the <item> element's attributes. However, the ABNF definition of SRGS allows any rule expansion to have a repeat operator: sequenceElement ::= subexpansion | subexpansion repeatOperator subexpansion ::= Token LanguageAttachment? | ruleRef | Tag | '(' ')' | '(' ruleExpansion ')' LanguageAttachment? | '[' ruleExpansion ']' LanguageAttachment? Finally, the text of the specification regarding repeats, http://www.w3.org/TR/speech-grammar/#S2.5, specifies: --- Operators are provided that define a legal rule expansion as being another sub-expansion that is optional, that is repeated zero or more times, that is repeated one or more times, or that is repeated some range of times. --- This means that the operator under discussion applies to a sub-expansion. "Sub-expansion" is not further defined in the specification, but I would interpret is as meaning any expansion, that is also a ruleref for example. Thus both the specification text and the ABNF authorize repeat's of any rule expansion; however the XML form does not authorize it and restricts it to <item>'s. Is this intentional? Could you comment on this? Thank you. Sébastien Bratières
Received on Monday, 24 September 2007 07:36:50 UTC