GSL文件是VXML语音识别中用到的一种特定格式的文件。其格式如下:
1GSL内部定义和外部定义
内部定义是在VXML文档中完全用<grammer>元素定义外部定义是定义一个外部文件,并在VXML中引用在外部GSL文档中,所有的规则必须命名在内部GSL定义中,如果只有一个语音识别规则,可以不命名,如果有多个语音识别规则,每一个都要命名
GSL推荐的扩展名为gsl解释器也识别grammar的扩展名如果直接在VXML文档中定义grammar,一定要用CDATA括起来,否则VXML文档无法识别如下:
<grammar usage attributes>
<![CDATA[
grammar header
grammar rule definitions
]]>
</grammar>
外部GSL文件不应该包含CDATA部分,格式如下:
;GSL20
grammar rule definitions
2GSL中的注释。
GSL中的注释可以出现在任何地方,注释用分号开始,分号后的内容将会被全部忽略例如:
; this is a comment
RuleName [rule expansion] ; this is a comment, after a non-comment
3GSL中的保留字
AND-n, OR-n, OP-n, KC-n, PC-n 以上是GSL的保留字,不能够将它们定义为规则的名字n是个整数
4GSL的头部声明
GSL文件可以用一个self-identifying header开始,来说明GSL grammar的版本。可以不写,要是有必须用
;GSL20
开头。ABNF和XML语法都限制一个grammer元素只能识别语音输入和DTMF中的一种,而不允许一个grammer同时包括语音输入和DTMF。GSL文件没有这个限制,任何的GSL语法都可以在同一个grammar元素,甚至同一个识别规则中,同时包括DTMF和语音输入。XML默认使用的是第一个public 语法规则。
5基本规则定义
一个语法规则,包含两个部分。
第一规则的名字,这个名字可以在别的语法规则中引用。
第二 和该规则相关的可能的话音输入。
大多数的语法规则,包括一系列的用户可能说的词语,语法规则扩展部分,一般用[]括起来。例如:
city[南京 "北京" 呼和浩特]
该规则的名字是city,语法规则扩展部分是可选的名字。如果用户说,南京 ,北京或呼和浩特,该语法就匹配上了。语法名称是一个字符串,用来标示这个语法规则。同一个grammar中的语法规则名称,必须不一样,但是相同的语法规则名称可以用在不同的grammar中。外部定义语法,所有的语法规则必须有名字,内部语法定义中,如果只有一个语法规则,可以没有名字,否则都必须有名字。语音规则名称大小写敏感,下面的字符都可以用在语音规则名称中。
-(连字符) _(下划线) ‘(单引号) @(at符) (句号)
特殊的语法规则。GSL有三个预定义的规则。
<special:passthrough>
<special:roadblock>
<special:resistor>
NULL 和<special:passthrough>代表的意义一样。VOID 和<special:roadblock>代表的意义一样。定义在grammar中的语法规则,不能和他们重名。
<special:passthrough>, NULL 和用户什么没有输入匹配。你可以用下面的grammer来匹配,“北京”“上海”和没有输入。
Trigger = [NULL 北京 上海]
<special:roadblock>, VOID 定义的语法规则将不会被匹配。如,任何输入都不会匹配下面的规则。
Trigger = (VOID 北京 上海])
<special:resistorweight=n> 用来标示语音输入的可能性,权值n是标示输入可能性的一个浮点数(floating point number) 。weight的值低于1,将会减少该规则匹配的可能性,weight值越接近零的,规则越不容易被匹配。大于1,将会增加匹配的可能性。 使用上面三种规则,可以动态的改变规则。
6语法规则定义的作用域。
每一个规则都有一个作用域,private 或 publicpublic 修饰的语法规则对外部可见,外部引用可以用名称指定一个public 语法规则。private语法规则只在 包含它的grammar中可见,而且只能被在同一个grammar中的其他的语法规则引用。 把一个语法规则标示为public的
格式为:RuleName:public ruleExpansion
没有标示为public 的就是private的语法。如果一个grammar中,没有一个语法规则标示为public,那么所有的语法规则都是public的。如果有一个标示了public ,那么其余的都是private。GSL中的根语法规则是第一个标示为public的语法规则。如果都没标示,默认是第一个。下面的例子,定义了一个public 语法规则Snapper,和两个private语法规则,SnapperType和FishColors。根语法规则是Snapper。
SnapperType [mutton FishColors]
FishColors [black gray red]
Snapper:public (SnapperType snapper)
7语法规则的递归。 GSL文件中可以定义直接或间接引用自身的语法规则。
; Rule that refers to itself directly
Digits [Digit (Digit Digits)]
Digit [0 1 2 3 4 5 6 7 8 9]
; Rule that indirectly refers to itself
NounPhrase (Noun PrepositionalPhrase)
PrepositionalPhrase (Preposition NounPhrase)
写此类语法时要注意,GSL不支持左递归,也就是说不能定义第一个子部分包含语法规则本身的语法规则。这是为了确保解释器不会进入无穷递归,来匹配一个语法规则。
; 合法
Digits [Digit (Digit Digits)]
Digits [(Digit Digits) Digit]
; 不合法
Digits [(Digits Digit) Digit]
Digits [Digit (Digits Digit)]
语音规则扩展部分。声音标示符(英语)应该使用小写字母,数字,-(连字符) _(下划线) ‘(单引号) @(at符) (句号)如果使用其他的特殊符号(空格除外),必须用“”双引号括起来。下面是几条简单地规则:
1。避免缩写。例如,用usa 代替 USA ,用vxml代替 VXML。
2。展开缩写。例如,用street代替st。用doctor代替dr。
3。把标点拼出来。
4。把大于9的数拼出来。
DTMF标示符。
键 DTMF标示符
0 dtmf-0
1 dtmf-1
2 dtmf-2
3 dtmf-3
4 dtmf-4
5 dtmf-5
6 dtmf-6
7 dtmf-7
8 dtmf-8
9 dtmf-9
dtmf-star
# dtmf-pound
例如:[(小王)(dtmf-4 dtmf-9 dtmf-7 dtmf-3)]
{<emp 小王>}
用户或者说“小王”或者连续的按4973 都能正确匹配。
语法规则的引用。
引用 格式
本地语义规则 语义规则名
本地语义规则的变量 语义规则名:变量名
用URL指定根语义规则名 <grammarURI>
用URL指定语义规则 <grammarURI#RuleName>
特定规则 <special:passthrough>, NULL
<special:roadblock>, VOID
<special:resistorweight=n>
PrimaryColors ( Shades [red blue green])
Shades [ dark light ]
PrimaryColors [ ( [dark light] [red blue green] ) ]
引用和宏替换差不多。上面两个等价。本地引用有两种形式。
RuleName
RuleName:variableName
第二个将会用RuleName的返回值替换。
外部引用也有两种形式。
<grammarURI>
<grammarURI#RuleName>
; 指定外部语法为根grammar
<>
data-是一个前缀,后面的值可以任意
data- 属性是 HTML5 中的新属性。
使用 data- 属性来嵌入自定义数据
<ul><li data-animal-type="bird">Owl</li>
<li data-animal-type="fish">Salmon</li>
<li data-animal-type="spider">Tarantula</li>
</ul>
定义和用法
data- 属性用于存储页面或应用程序的私有自定义数据。
data- 属性赋予我们在所有 HTML 元素上嵌入自定义 data 属性的能力。
存储的(自定义)数据能够被页面的 JavaScript 中利用,以创建更好的用户体验(不进行 Ajax 调用或服务器端数据库查询)。
data- 属性包括两部分:
属性名不应该包含任何大写字母,并且在前缀 "data-" 之后必须有至少一个字符
属性值可以是任意字符串
注释:用户代理会完全忽略前缀为 "data-" 的自定义属性。
新概念英语第2册Lesson88课文注释
1…rescue operations are proving difficult……事实证明营救工作非常困难。
prove之后带形容词(有时也可以是名词)时表示“证明是”、“结果是”:
His operation proved successful
他的手术很成功。
What he had told us proved false
他对我们所说的原来是假的。
2Rescue workers are therefore drilling a hole on the north side of the mine 因此,营救人员正在矿井的北侧钻一个洞。
therefore表示“因此”、“所以”等。它是副词,所以它既可以独立使用,也可以位于动词前。so表示“因此”、“所以”时通常是连词:
The new flat is larger and therefore more expensive
这套新房子(比原先的)要大些,因此比较贵。
His parents gave him some money, and he was therefore able to buy a car
他的父母给了他一些钱,所以他能买得起一辆车。
His parents gave him some money, therefore, he was able to buy a car
(译文同上,therefore前后都可以有逗号,so后面通常不用逗号)
We arrived early, so we got good seats
我到得早,因此我们找到了好座位。(so表示“所以”、“因此”时不放在动词前)
3If there had not been a hard layer of rock beneath the soil, they would have completed the job in a few hours 如果不是因为土壤下面有一层坚硬的岩石,他们的营救工作仅用几小时就可以完成了。
这是第3类条件句,表示与过去事实相反的假设。课文中还有第1类和第2类条件句的例子,仔细体会它们的区别。
4as it is,实际上,事实上(也可以用as it was)。
I thought they would help us As it was, they just sat there and looked on
我以为他们会帮助我们。实际上他们却只是坐着旁观。
I promised to return the books yesterday As it is, I won't be able to do so until next Monday
我答应昨天还书的,但事实上我要到下星期一才能还。
5…a microphone…has enabled the men to keep in touch with their closest relatives……一只麦克风使井下的人可以与其亲属保持联系。
(1)enable为及物动词,表示“使……能够”:
The hubble telescope will enable us to have a better understanding of the distant stars and galaxies
哈勃望远镜将使我们能更好地了解远距离的恒星和星系。
前缀en-加在名词或形容词前可以使这个词成为动词,如endanger(危及,使遭受危险),enlarge(扩大,扩展,扩充),enslave(奴役,使成为奴隶),entrap(使……入陷阱/圈套,欺骗)。
(2)keep in touch with表示“与……保持联系”,也可以用stay,get 等其他动词:
Though he works in New York, he still keeps in touch with his friends in London
他虽然在纽约工作,但仍然与伦敦的朋友们保持联系。
George is in close touch with Ian
乔治与伊恩联系密切。
Can you get in touch with the company
你能与那家公司取得联系吗
6lose heart为固定搭配,表示“丧失信心/勇气”、“泄气”、“灰心”:
He told his men not to lose heart, saying that they would soon discover gold mines
他告诉手下人不要灰心,并说他们很快就会发现金矿的。
Seeing that the enemy was much stronger than themselves, the soldiers lost heart at once
当战士们发现敌军比自己要强大得多时,他们立刻就丧失了勇气。
新概念英语第2册Lesson89课文注释
1A slip of the tongue,(标题)说走了嘴,失言。
slip在这里表示“不经心的错误”、“失误”、“疏漏”:
You've made some slips (of the pen) in your report
你的报告中有一些小错(笔误)。
When he was nervous, he would sometimes make a slip of tongue
当他紧张时,他有时就会发生口误。
Are you sure that it was just a slip of tongue
你确信那只是一时口误吗
2People will do anything to see a free show…人们总要想尽办法去看不花钱的演出……
anything用于肯定句时表示“不论什么”、“任何事情”,to see a free show表示目的,也可以用for+名词形式:
He will do anything to save his child's life
他要想尽办法挽救他孩子的生命。
He will do anything for the child
为了这孩子,他干什么都愿意。
3When the news got round that a comedy show would be presented at our local cinema by the P and U Bird Seed Company…当“皮尤”鸟食公司将在我们当地演出喜剧节目的消息传开后……
(1)when引导的这个时间状语从句中含有一个同位语从句,即the news that…。由于that引导的同位语从句较长,便与它所修饰的news隔开了,放在谓语动词之后,以免句子头重脚轻。同位语从句中用了被动语态的过去将来时形式。
(2)get round在这里表示消息、谣言等“传开”(也可以用get around/about):
The word soon got round that there was buried treasure in that cave
那个洞里有宝藏的消息很快便传开了。
Bad news gets round quickly
坏消息传得快。
4…there must have been several hundred people present just before the show began……在演出开始前场内肯定已有好几百人了。
Those who failed to get in need not have felt disappointed, as many of the artistes who should have appeared did not come
那些没能进到场内的人没有必要感到失望,因为很多应该出场的专业演员都没有来。
must+have+过去分词表示对过去发生的事进行推测(其否定式为can't+have+过去分词,cf第17课语法);need+have+ 过去分词表示过去不必做但实际已做了的事(cf第41课语法);should/ought to+have+过去分词表示本来应该做而实际未做的事(cf第65课语法):
He had found five empty whisky bottles which the ghost must have drunk the night before
他发现了5只空的威士忌酒瓶子,这肯定是鬼魂前天晚上喝的。
The examiner must have been pleased with my performance
主考人对我的表现想必是满意的。
You needn't have said that
你没必要这么说。(实际已经说了)
You needn't have told him about my plans
你本不必把我的打算告诉他。(实际上已告诉了他)
He should have gone along a side street
他应该走一条小街。(实际上他走了主要街道)
5As soon as he opened his mouth, everyone burst out laughing
但他刚一开口说话,人们便哄堂大笑起来。
burst out为固定短语,其含义之一为“突然……起来”,后面通常接动名词,也可以接in/into+名词:
At the sight of the drunk, everyone burst out laughing/in laughter
一看见那醉汉,大家便大笑起来。
When she heard that her father had died in the accident, she burst out crying
当她听说她父亲在那次事故中丧生时便大哭起来。
6We all know what the poor man should have said, but what he actually said was…
我们都明白那个可怜的应该说些什么,而他实际说的却是……
用should+have+过去分词表示过去应当做而并没有做的事时,它后面经常跟but(actually)以形成对比:
I should have left home before 9 o'clock, but actually I didn't
我本该在9点以前离开家,但实际上我没有。
You should have written the word‘too’, but what you actually wrote was‘to’
你本该写“too”,但实际上你却写了“to”。
新概念英语第2册Lesson90课文注释
1Fish and chips has always been a favourite dish in Britain…油煎鱼加炸土豆片一直是英国人喜爱的一道菜……
fish and chips被看做是一个整体,因此,虽然chips是复数形式,它后面却要跟动词的单数形式。(cf本课词汇学习)dish在这里指“一盘菜”或“菜肴”、“食品”:
I like French dishes
我喜欢(吃)法国菜。
Would you like a sweet dish
您要一盘甜食吗
2…divers…have been frightened out of their wits by giant fish bumping into them as they work……潜水员……曾在工作时被撞到他们身上的大鱼吓得惊慌失措。
(1)out of one's wits表示“失去理智”、“惊慌失措”:
She was frightened out of her wits by the great fire
大火吓得她惊慌失措。
Are you out of your wits
你疯了吗
(2)bump into的含义之一是“碰上”、“撞上”:
Wandering in darkness, the drunk bumped into a policeman
那醉汉在黑夜中闲荡时撞到了一个警察的身上。
bump into也可以表示“偶然遇见”、“碰见”(多用于口语):
I bumped into Jane at the conference
我开会时碰见了简。
(3)as在这里相当于when或while。
3Now they have had special cages made to protect them from these monsters 现在他们有了特制的笼子,用来保护他们免受大鱼的侵袭。
(1)have had…made 是使役式的完成式。(cf第66课语法)
(2)protect经常与from或against连用:
He tried to protect the child from the rain/the dog
他试图使孩子不被雨淋/狗咬。
This coat will protect you against the cold
这件大衣可以给你御寒。
4favourite eating varieties, 深受人们喜爱的食用的品种。
eating在这里为形容词,表示“供食用的”,它有时也表示“宜生食的”:
Eating corn is quite sweet
食用玉米很香甜。
These are eating apples, and those are cooking apples/ones
这些是生吃的苹果,那些是烹任用的苹果。
5the total absence of fishing boats around the oil rigs, 钻井平台周围根本没有捕鱼船只。
(1)total在这里表示“完全的”、“彻底的”(相当于complete):
His letter is a total surprise to her
他的来信完全出乎她的意料之外。
That girl is a total stranger to me
我根本不认识那姑娘。
(2)absence of表示“缺少”、“不存在”:
These plants don't grow well because of the absence of rain/sunshine
由于缺乏雨水/阳光,这些植物长得不好。
6as a result,结果,因此。
He didn't work hard at mathematics As a result, he failed in the examination
他没有用功学数学。因此,他考试没及格。
My husband Spent weeks training our dog to press its paw on the latch As a result, it has become an expert at opening the gate
我丈夫花了几个星期的时间训练我们的狗用脚爪按住门闩。结果,它现在成了开门的专家。
Good, I introduced Baiyangdian under my home
Baiyangdian (Baiyang Lake) is China's largest lakes in the Haihe Plain in central Hebei Province Lakes region rich in aquatic products, the distribution of reed-Canton area is the state's key tourist areas and open areas Area of 366 square kilometers in the waters, the largest freshwater lake in North China Plain
Baiyang Lake Haihe Plain in China's largest lakes The size of the existing 143-Park lake, rich in aquatic resources, there are more than 50 kinds of freshwater fish, and large areas of reed and plaster acres of merging He Huadian's known, has long been known as the pearl of North China, said Baiyangdian on the formation of the legend of the beautiful there Legend has it that a long time ago, a night of the Mid-Autumn Festival, the fairy Chang E Xianyao steal, Shenbuyouyi, self-satisfied to leave the palace, she will have to fall into the hands of Fanjian the blink of an eye, suddenly awakened, it surprised no trivial matter, carry Hokyo falling into the hands of the world, Guests of the 143 large and small, has been that of the 143-Park lake
Baiyang Lake has many tourist attractions Grand View Garden of lotus flowers for most of North China, the world favor It changed the Baiyangdian monotonic lotus varieties of the status quo of China's renowned all over the north-south 216 kinds of lotus varieties, of which 156 varieties of rare wild species 60 Park Road, exotic Thailand Simon pure performance, striking Thailand scared of fighting alligators, lions feed on performance, the mysterious house back, bouncing rock climbing, and so on Visitors can also visit the seal seals feeding areas, the risk involved in crossing Lake crocodile, and so on, enjoy the stimulation, romantic savor, it is entertaining, highly participatory style entertainment park Dutch Yuanfei park Hexiang assail the nostrils, Ludang maze, Baiyangdian Yan Ling Team Arena, bathing beach, and so on
Baiyang Lake also features a number of products Tea egg patterns, also known as preserved, is one of the specialties of Baiyangdian Old red salted eggs, with the main stock by the middle of a duck egg, the egg is characterized by a red heart, cut after the Tang Chu oil, egg yolk green, red and white clear, good taste, no salt is not short, the right to do drink and file Smoked fish, deep water is a unique flavor of the fish products Baiyangdian lotus seed and red, white son of hours of high nutritional value of red and white lotus seed, the role of health care Lotus root with the United States and clean, fine quality, Cui Tian, waste-free entrance and long enjoyed a good reputation
This is my home, Baiyangdian, we welcome the arrival
: 1, Baiyangdian is beautiful
2, how you look at Baiyangdian
PS> article, to use a variety of tense, the past is now completed for at least one each, at least two modal verb, and compare the highest level and least of all a problem to have the WH and YES OR NO, something as simple, do not be too difficult words, common on the line!
taken off her coat and crown
It was once an Princess Pip nicer greatly coat and crown easiest off his daughter
它是更加美丽一旦公主皮普已经采取了脱去她的外衣和冠冕。
It is more beautiful once princess pippa had taken off her coat and a turban
The fish looked very cross at being caught , so Princess Pip let them go
The fish caught to cross at being which Princess - so Pip <, go
鱼看上去很生气,所以公主波纹管时被抓住,让他们去。
Fish looked very angry, so the princess corrugated pipe caught, let them go
"It's not too bad here,"said Princess Pip ,at last"I want to stay here all the time
"It 's not bad," who have roll Pip, at Mr Princess "I to roll on the long a handful
“这并不是很坏在这里,”公主皮普,最后说。
"It's not too bad here," the princess PIP, finally said
"我想留在这里所有的时间。
"I want to stay here all the time
"Let's build a sandcastle ,then," said Daisy
"Build a sandcastle < 's, then," Daisy who
“让我们建立一个沙子城堡吧,然后,”黛西说。
"Let us build a sandcastle, then," Daisy says
"A sand HOUSE ,"said Princess Pip
"A stillbirth," what Pip Princess who
“一粒沙说:“公主房子很恼火。
"A grain of sand said:" princess house was very upset
It was hard work,but they build a huge house,with a moat all around
It was unacceptable, but build schools hard-core, what a huge moat around a handful account
它是很艰苦的工作,但他们建造一家大型的房子里,有着一条护城河周围。
It was hard work, but they built a large house, with a moat around
Soon the sea came in and filled the moat
The sea is stuck in the moat They check
很快海洋进来,充满了护城河。
Soon, filled with moat Marine came in
"That's just right ,"said Princess Pip"Make it stop coming
"That 's attorney general," who can you Pip Princess "nice it stop
以上就是关于能用什么软件在电脑里就能打开浏览.gsl文件吗全部的内容,包括:能用什么软件在电脑里就能打开浏览.gsl文件吗、html5中 data-click 是什么、新概念英语第2册Lesson88~90课文注释等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)