Chapter_09机器翻译

合集下载

python第9章类课后习题答案

python第9章类课后习题答案

Solutions - Chapter 99-1: RestaurantMake a class called Restaurant. The __init__() methodfor Restaurant should store two attributes: a restaurant_name and a cuisine_type. Make a method called describe_restaurant() that prints these two pieces of information, and a methodcalled open_restaurant() that prints a message indicating that the restaurant is open.Make an instance called restaurant from your class. Print the two attributes individually, and then call both methods.Output:9-2: Three RestaurantsStart with your class from Exercise 9-1. Create three different instances from the class, and call describe_restaurant() for each instance.Output:9-3: UsersMake a class called User. Create two attributescalled first_name and last_name, and then create several other attributes that are typically stored in a user profile. Make a method called describe_user()that prints a summary of the user’s information. Make another method called greet_user() that prints a personalized greeting to the user.Create several instances representing different users, and call both methods for each user.Output:9-4: Number ServedStart with your program from Exercise 9-1 (page 166). Add an attribute called number_served with a default value of 0. Create an instance called restaurant from this class. Print the number ofcustomers the restaurant has served, and then change this value and print it again.Add a method called set_number_served() that lets you set thenumber of customers that have been served. Call this method with a new number and print the value again.Add a method called increment_number_served() that lets youincrement the number of customer s who’ve been served. Call this method with any number you like that could represent how many customers were served in, say, a day of business.Output:9-5: Login AttemptsAdd an attribute called login_attempts to your User class from Exercise 9-3 (page 166). Write amehtodcalled increment_login_attempts() that increments the value of login_attempts by 1. Write another methodcalled reset_login_attempts() that resets the valueof login_attempts to 0.Make an instance of the User class andcall increment_login_attempts() several times. Print the valueof login_attempts to make sure it was incremented properly, and then call reset_login_attempts(). Print login_attempts again to make sure it was reset to 0.Output:9-6: Ice Cream StandAn ice cream stand is a specific kind of restaurant. Write a class called IceCreamStand that inherits from the Restaurant class youwrote in Exercise 9-1 (page 166) or Exercise 9-4 (page 171). Eitehr version of the class will work; just pick the one you like better. Add an attribute called flavors that stores a list of ice cream flavors. Write a method that displays theese flavors. Create an instanceof IceCreamStand, and call this method.Output:9-7: AdminAn administrator is a special kind of user. Write a classcalled Admin that inherits from the User class you wrote in Exercise 9-3 (page 166) or Exercise 9-5 (page 171). Add an attribute, privileges, that stores a list of strings like "can add post", "can delete post", "can ban user", and so on. WRite a method called show_privileges() that lists the administrator’s set of privileges. Create an instance of Admin, and call your method.Output:9-8: PrivilegesWrite a separate Privileges class. The class should have one attribute, privileges, that stores a list of strings as described in Exercise 9-7. Move the show_privileges() method to this class. Make a Privileges instance as an attribute in the Admin class. Create a new instance of Admin and use your method to show its privileges.Output:9-9: Battery UpgradeUse the final version of electric_car.py from this section. Add a method to the Battery class called upgrade_battery(). This methodshould check the battery size and set the capacity to 85 if it isn’t already. Make an electric car with a default battery size,call get_range() once, and then call get_range() a second time after upgrading the battery. You should see an increase in the car’s rang e.Output:9-10: Imported RestaurantUsing your latest Restaurant class, store it in a module. Make a separate file that imports Restaurant. Make a Restaurant instance, and call one of Restaurant’s methods to show thatthe import statement is working properly.restaurant.py:my_restaurant.py:Output:9-11: Imported AdminStart with your work from Exercise 9-8 (page 178). Store theclasses User, Privileges and Admin in one module. Create a separate file, make an Admin instance, and call show_priveleges() to show that everything is working correctly.user.py:my_user.py:Output:9-12: Multiple ModulesStore the User class in one module, and storethe Privileges and Admin classes in a separate module. In a separate file, create an Admin instance and call show_privileges() to show that everything is still working correctly.user.py:admin.py:my_admin.pyOutput:9-13: OrderedDict RewriteStart with Exercise 6-4 (page 108), where you used a standard dictionary to represent a glossary. Rewrite the program usingthe OrderedDict class and make sure the order of the output matches the order in which key-value pairs were added to the dictionary.Note: In Python 3.6, dictionaries store keys in order. However, this is not guaranteed to work in all versions of Python, so you should still use an OrderedDict when you need key-value pairs to be stored in a particular order.Output:9-14: DiceThe module random contains functions that generate random numbers in a variety of ways. The function randint() returns an integer in therange you provide. the following code returns a number between 1 and 6:Make a class Die with one attribute called sides, which has a defaultvalue of 6. Write a method called roll_die() that prints a randomnumber between 1 and the number of sides the die has. Make a6-sided die and roll it 10 times.Make a 10-sided die and a 20-sided die. Roll each die 10 times.Output:。

机器翻译简介整理

机器翻译简介整理
METEO系统等。
4.新时期(1990~现在)
随着 Internet 的普遍应用,世界经济一体化进程的加 速以及国际社会交流的日渐频繁,传统的人工作业的方 式已经远远不能满足迅猛增长的翻译需求,人们对于机 器翻译的需求空前增长,机器翻译迎来了一个新的发展 机遇。国际性的关于机器翻译研究的会议频繁召开,中 国也取得了前所未有的成就,相继推出了一系列机器翻 译软件,例如“译星” 、 “雅信” 、 “通译” 、 “华建”等。在市场场,来到了用户面前。
机器翻译遇到困难
1.词法歧义
自动化研究所取得的成就
自动化/研究所/取得/的/成就/。 自动化/研究/所/取得/的/成就/。
Achievements made by the Institute of Automation
2.新的词汇无法理解
上大学子烛光追思钱伟长 University sub candlelight memorial chang On the big students qian wei-chang candlelight memorial Shanghai University students mourn Qian Weichang with the candlelight
Machine Translation
• Definition of MT • History of Development • Contrast between MT and HT • Prospect of MT
The Definition of MT
MT, the abbreviation of machine translation, is a sub-field of computational linguistics that investigates the use of software to translate text or speech from one natural language to another.

基于规则的机器翻译系统

基于规则的机器翻译系统

奈达根据乔姆斯基的“转换生成语法”做 的诠释
SL表层结构
分析 TL表层结构
Байду номын сангаас
生成
SL深层结构
转换
TL深层结构

机器翻译中,从原语(SL)句子的表层结 构到其深层结构需要经过词法、句法、语 义等分析。性层的深层结构是一种树 (syntax tree)。它反映的事一个句子内部 的语法结构,这种结构认为是人类抽象思 维的逻辑表达式。不同的语言具有相同或 相似的深层结构。就像是一座桥梁,把人 类不同的语言连接恰来,使彼此可以翻译 交流。

问题:

这两种诠释有什么相似之处?
基于规则的机器翻译系统 之 中间语翻译

自然语言大多一个单词有多种意思,比如, 中文的“方便”二字就有很多不同的意思, 容易产生歧义。在机器翻译中,为了简化 纷繁的表达结构,避免其含糊不清的语言 现象,独立于各种自然语言,同时又能清 晰准确地表达各种自然语言的人造计算机 语言英语而生。这种人造计算机语言就是 中间语(interlingua,IL)
分析
转换
生成
机器翻译(machine translation)

机器翻译主要有两套系统:
一、基于规则的(Rule-based System) 二、基于语料库的(Corpus-based System)


基于规则的机器翻译系统



规则主要包括: 1、词法 2、句法 3、短语规则 4、转换生成语法
寻找中间语的难度

“如果要设计出一种元语言(中间语)用来 解释,那么它就必须包含多种语言的所有 特征。这种努力不仅毫无止境,而且可能 毫无结果”
——法国人 斯莱德

Machine Translation机器翻译

Machine Translation机器翻译

9
2.Grammar
DEMERITS
美国翻译理论家Eugene A .Nida 指出“ 语法分析 是翻译过程极其重要一环” e.g. This job gives him plenty of responsibility—— he is in charge of several thousand of workers,and plenty of cash. Google:这份工作给了他很大的责任 - 他负责数千名工人, 和大量现金 Youdao:这份工作给了他足够的责任——他负责几千工 人,和大量的现金。 他担任此项工作,责任重大(主管着几千名工人),报酬 10 丰厚。
MACHINE TRANSLATION
1
丁葆慧
Brief introduction
Merits: cheap and fast
Demerits: culture, grammar and context
2
BRIEF INTRODUCTION
Machine
translation, also known as automatic translation. It is the process of converting a natural language (source language) into another natural language (target language) by using computer.
e.g. There is a bit of old Adam in us all.
Google: 我们大家都有一点点老的亚当。 Youdao:有一点老亚当的我们所有人。 我们大家都有一点干坏事的本性。
6
e.g. Whoever is goldbricking when I came back gets a real talking. Youdao & Google:谁是称病当我回来得到一个真正的 交谈。 我回来时谁要是在偷懒的话,可别怪我不客气。

机器翻译简介 整理页PPT文档52页PPT

机器翻译简介 整理页PPT文档52页PPT

机器翻译简介 整理页PPT文档
11、不为五斗米折腰。 12、芳菊开林耀,青松冠岩列。怀此 贞秀姿 ,卓为 霜下杰 。
13、归去来兮,田蜀将芜胡不归。 14、酒能祛百虑,菊为制颓龄。 15、春蚕收长丝,秋熟靡王税。
谢谢你的阅读
❖ 知识就是财富 ❖ 丰富你的人生
71、既然我已经踏上这条道路,那么,任何东西都不应妨碍我沿着这条路走下去。——康德 72、家庭成为快乐的种子在外也不致成为障碍物但在旅行之际却是夜间的伴侣。——西塞罗 73、坚持意志伟大的事业需要始终不渝的精神。——伏尔泰 74、路漫漫其修道远,吾将上下而求索。——屈原 75、内外相应,言行相称。——韩非

UNIT 9 What Is Intelligence, Anyway课文翻译大学英语二

UNIT 9 What Is Intelligence, Anyway课文翻译大学英语二

Unit9 What Is Intelligence, Anyway?Isaac AsimorAsimov explains why there is much more in intelligence than just being able to score high on intelligence tests.What is intelligence, anyway? When I was in the army I received a kind of aptitude test that all soldiers took and, against a normal of 100, scored 160. No one at the base had ever seen a figure like that and for two hours they made a nig fuss over me. (It didn't mean anything. The next day I was still a buck private with KP as my highest duty.) All my life I've been registering scores like that, so that I have the complacent feeling that I'm highly intelligent, and I expect other people to think so, too. Actually, though, don't such scores simply mean that I am very good at answering the type of academic questions that are considered worthy of answers by the people who make up the intelligence tests - people with intellectual bents similar to mine?For instance, I had an auto-repair man once, who, on these intelligence tests, could not possibly have scored more than 80, by my estimate. I always took it for granted that I was far more intelligent than he was. Yet, when anything went wrong with my car I hastened to him with it, watched him anxiously as he explored its vitals, and listened to his pronouncements as though they were divine oracles - and he always fixed my car.Well, then, suppose my auto-repair man devised questions for an intelligence test. Or suppose a carpenter did, or a farmer, or, indeed, almost anyone but an academician. By every one of those tests, I'd prove myself a moron. And I'd be a moron, too. In a world where I could not use my academic training and my verbal talents but had to do something intricate or hard, working with my hands, I would do poorly. My intelligence, then, is not absolute. Its worth is determined by the society I live in. Its numerical evaluation is determined by a small subsection of that society which has managed to foist itself on the rest of us as an arbiter of such matters.Consider my auto-repair man, again. He had a habit of telling me jokes whenever he saw me. One time he raised his head from under the automobile hood to say: "Doc, a deaf-and-dumb guy went into a hardware store to ask for some nails. He put two fingers together on the counter and made hammering motions with the other hand. The clerk brought him a hammer. He shook his head and pointed to the two fingers he was hammering. The clerk brought him nails. He picked out the sizes he wanted, and left. Well, doc, the next guy who came in was a blind man. He wanted scissors. How do you suppose he asked for them?"I lifted my right hand and made scissoring motions with my first two fingers. Whereupon my auto-repair man laughed heartily and said, "Why, you dumb fool, he used his voice and asked for them." Then he said, smugly, "I've been trying that on all my customers today." "Did you catch many?" I asked. "Quite a few," he said, "but I knew for sure I'd catch you." "Why is that?" I asked. "Because you're so goddamned educated, doc, I know you couldn't be very smart."And I have an uneasy feeling he had something there.阿西莫夫说明了为什么智力远非只是在智力测验中取得高分。

英语翻译之机器翻译

英语翻译之机器翻译

基于规则的机器翻译系统之 中间语的机器翻译
自然语言大多一个单词有多种意思,比如,中文 的“方便”二字就有很多不同的意思,容易产生 歧义。在机器翻译中,为了简化纷繁复杂的表达 结构,避免其含糊不清的语义现象,它独立于各 种自然语言,同时又能清晰准确地表达各种自然 语言的人造计算机语言英语而生。这种通用的人 造计算机语言就是中间语。
信息 编码 信息 解码
பைடு நூலகம்
(噪音信道)
语言B
信宿
噪音
基于统计的机器翻译过程图解
ST
转换 全局搜索,求P(T)X P(S/T)最大值 转换
TL文本
P(S/T)词典 模式
P(s/T)对齐模 式
P(T)语言模 式
P(T)为某句在目的语(TL)中出现的概率,P(S/T)表 示原语文本(ST)译成目的语(TL)文本的概率。
寻找中间语的难度
“如果设计出一种原语言(中间语言)用 来翻译,那么它就必须包涵多种语言的所 有特征。这种努力不仅毫无止境,而且很 可能毫无止境。” —法国人斯莱德
基于语料库的机器翻译系统
基于规则的机器翻译益处:它通过上下文的搭配关系进 行分析和生成。借助对语法的分析,将语法现象总结成 规律,用于机器翻译。同时借助传统语法树和广义语法 分析,让计算机根据这些规则举一反三进行翻译 基于规则的机器翻译弊处:由于有些语言相差悬殊,其 结构更是大相径庭,所以给构造映射规则带来了巨大困 难。且规则库再大也是有限的,无法涵盖复杂多变的自 然语言现象,随着分析不断深入,需要的相关信息就越 来越多,这样构造的规则就会越来越难,很容易出现死 循环和前后矛盾等难题。
基于规则的机器翻译系统之 转换系统
出现原因
为了提高译文的可读性,人们更 多地从句子的层面来分析处理原 语与目的语的特征 于是在直接翻译系统的基础上, 出现了机器翻译的转换系统

大型语言模型在机器翻译任务中的性能和效果分析

大型语言模型在机器翻译任务中的性能和效果分析

翻译质量效果分析
翻译准确度:大型语言模型在机器翻译任务中的准确度较高,能够准确传 达原文意思。
翻译流畅度:大型语言模型能够保证翻译的流畅性,使译文更加自然、流 畅。
翻译多样性:大型语言模型能够提供多种翻译结果,满足不同用户的需求。
翻译效率:大型语言模型在机器翻译任务中的效率较高,能够快速完成翻 译任务。
翻译质量性能分析
翻译准确度:评估大型语言模型在翻译任务中的准确性 翻译流畅度:评估大型语言模型在翻译任务中的流畅性 翻译效率:评估大型语言模型在翻译任务中的效率 翻译多样性:评估大型语言模型在翻译任务中的多样性
05
大型语言模型在机器翻译任务中的效果分 析
翻译准确度效果分析
大型语言模型在机器翻译任务中的准确度评估指标 不同大型语言模型在机器翻译任务中的准确度比较 大型语言模型在机器翻译任务中的优势与局限性 提高大型语言模型在机器翻译任务中准确度的策略与方法
翻译效率提高
大型语言模型在机器翻译任务 中的应用
翻译效率提高的原理
翻译效率提高的具体表现
翻译效率提高的案例分析
翻译质量改善
减少翻译错误:大型语言模型具备强大的语言理解能力,能够更准确地翻译文本
保留原文语义:大型语言模型能够更好地保留原文的语义和信息
流畅度和可读性提高:大型语言模型能够生成更流畅、自然的翻译结果
单击此处添加副标题
大型语言模型在机器翻译
任务中的性能和效果分析
汇报人:XXX
目录
01 02 03 04 05 06
大型语言模型概述
机器翻译任务概述 大型语言模型在机器翻译任务中的
应用 大型语言模型在机器翻译任务中的
性能分析 大型语言模型在机器翻译任务中的
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

赵铁军(2000)第1章;冯志伟(1995)第1-3章
4
机器翻译的需求类型及应用领域

传播信息(dissemination) 浏览信息(assimliation) 交流信息(interchange) 查询信息(information access)
Æ 出版/信息发布 Æ 网页/题录翻译 Æ 实时/多语聊天室 Æ 跨语言信息检索
P/#
of
NP/np N/花 P/上 N/桌 W/。
She
puts
a
bunch of flowers on
table
.
16
4 基于实例的MT

Makoto Nagao(1984)
实例库
源语言实例 匹 配 对齐 目标语言实例
命中句子S’
对应句子T’ 译文句子T
源语言句子S
17
EBMT示例
英语实例 He eats vegetable Acid eats metal 汉语实例 他吃蔬菜 酸腐蚀金属
Gale, 1991
21
词汇对齐可能性的度量方法

φ 2 检验
联立表(contingency table) t s ¬s a c ¬t b d
<s,t>是候选对译词对儿 a : 语料中同时出现s和t的句对数 b : 语料中出现s不出现t的句对数 c : 语料中不出现s出现t的句对数 d : 语料中s,t同时不出现的句对数
家庭 4,974 441
¬ 家庭 38,980 852,682
(31950 × 848330 − 12004 × 4793) 2 φ ( house, 房子)= (31950 + 12004) × (31950 + 4793) × (12004 + 848330) × ( 4793 + 848330)
=0.62
( 4974 × 852682 − 38980 × 441) 2 φ ( house , 家庭 )= ( 4974 + 38980 ) × ( 4974 + 441) × ( 38980 + 852682 ) × ( 441 + 852682 )
2
=0.098
23
Word-type / Word-token alignment
np
mp 把
sp 放 在 桌 上 。
13
一 束 花
从源语言结构树到目标语言结构树
zj dj vp pp np r

SS/zj CS/dj VP/vp
vp np pp
VP/vp PP/pp
NP/pp #/p NP/np
p
mp
np
v 放 在
sp 桌 上
NP/np
#/p
PP/sp P/上 N/桌
NP/mp
9
RBMT的一般图示
中间语言(知识表示)
源语言语 义结构
语义 转换
目标语言 语义结构
源语言句 法结构
句法 转换 词汇 转换 分析部分 生成部分
目标语言 句法结构
源语言词串
目标语言词串
10
综合型机器翻译系统(multi-engine MT)
规则引擎 实例引擎 源语言 …… 词汇直译引擎
Christopher Hogan, Robert E. Frederking, 1998, An Evaluation of Multi-engine MT Architecture, In "Machine Translation and the Information Soup, pages 113-123, Third Conference of the Association for Machine Translation in Americas (AMTA’98), Langhorne, PA. USA, October“ /afs//user/chogan/Web/Publications.html
NP/mp
P/# NP/np
N/花
T/一 N/束 of
NP/mp
P/# NP/np
N/花
W/。
T/一 N/束 of
15
对目标语言词语进行变形调整
SS/zj CS/dj VP/vp
VP/vp NP/pp NP/np #/p NP/mp N/她 V/放 T/一 N/束 NP/np
PP/pp #/p PP/sp
P/# NP/np
N/花 W/。
把 一 束 花
。 R/她 V/放
T/一 N/束 of
14
对目标语言结构树进行语序调整
SS/zj CS/dj VP/vp VP/vp PP/pp NP/np N/她 V/放 #/p PP/sp P/上 N/桌 NP/pp #/p NP/np VP/vp NP/pp NP/np #/p W/。 N/她 V/放 NP/np #/p SS/zj CS/dj VP/vp PP/pp PP/sp P/上 N/桌
7
FAHQMT(fully automatic high quality machine translation)是个遥不可及的梦
中间语言法( Interlingua )
语言1 中间 语言 语言3 (1)
语言2
语言1
语言2
语言4
语言3 (2)
语言4
中间语言的例子:世界语,人工定义的语言等
8
转换法(Transfer)
输入: I eat potatoes
输出: 我吃土豆
18
EBMT示例(续)
英语实例 <He>1e <turned on>2e <the radio>3e <The wallet>4e <is put>5e <on the table>6e 汉语实例 <他>1c <把收音机>3c <打开了>2c <钱包>4c <放>5c <在桌上>6c
2
1 什么是机器翻译
• Machine Translation (MT) 机器翻译 用计算机实现从一种自然语言(源语言/source language)到 另一种自然语言(目标语言/target language)文本的翻译
• Human Assisted Machine Translation (HAMT) • Computer Aided Translation (CAT) • Fully Automatic Machine Translation (FAMT)
Note: 对于不同的需求,机器翻译系统的设计应该有针对性, 同时对系统的要求也会有所不同 Hutchins, 1999, The Development and use of Machine Translation system and computer-based translation tools, In Proceeding of International Conference on MT & Computer Language Information Processing, 1999.6.26-28. Beijing
人助机译 机助人译 全自动机器翻译
3
机器翻译发展小史
1946 – 1954 1966 1970 - 1980 1980 - 1990 1990 - 第1个MT系统在美国Georgetown大学问世,6条规则, 250个词,俄语 Æ 英语 (50个句子/化学文本) ALPAC报告,MT陷入低谷 反思,计算语言学理论的发展,人工智能的发展 基于规则的系统日益成熟; 与此同时,人们开始探索更多其他的MT方法 MT应用需求呈上升趋势,技术日益靠拢实用目标,与 语音技术、互联网应用的结合趋势日渐明显
6
技术策略
受限语言 受限领域 人助机译 机助人译
Xerox , Boeing 等大公司都使用受限英语(或simplified English)来撰写技术文 档,以及进行技术手册的机器翻译 俞士汶,1995,《关于受限的规则汉语的设想》,载王均主编《语言现代化 论丛》,山东教育出版社,1995年,pp193-205 张伟,1998,《受限汉语辅助写作系统的构想》,载《计算机世界报》1998 年4月13日,第13期D版技术专题
φ 2 ( s, t ) =
(a × d − b × c) ( a + b) × ( a + c ) × ( b + d ) × ( c + d )
2
φ 2 ( s, t ) 值越高,
<s,t> 越可能是 对译词对儿
22
词汇对齐示例
房子 house 31,950 ¬ house 4,793
2
¬ 房子 12,004 848,330 house ¬ house
5
2 MT的基本方法与技术策略
理性主义(传统) MT路线/基于规 则的MT方法 (RBMT) • 直接翻译法 • 转换法 • 中间语言法 • EBMT 经验主义MT路线 /基于语料库,基 于统计的MT方法 • Translation Memory • Pattern-based MT • Statistical approach to MT
filter
她/r 把/p 一/m-d 束/q 花/n 放/v 在/p-v 桌/n 上/f-v 。/w
12
对源语言进行句法分析
她/r 把/p 一/m-d 束/q 花/n 放/v 在/p-v 桌/n 上/f-v 。/w
Rule Base
zj dj vp pp np np

parser
Lexicon
vp pp
相关文档
最新文档