精华内容
下载资源
问答
  • —————————————————————————————————————— ... 前言:论文主要用来指导多轮交互如何进行指代消解和重写补全,在闲聊机器人和任务型机器人中都有很大的...EM score in SQuAD Chall...

    ——————————————————————————————————————
    论文地址:https://www.aclweb.org/anthology/P19-1003

    前言:论文主要用来指导多轮交互如何进行指代消解和重写补全,在闲聊机器人和任务型机器人中都有很大的作用。

    涉及到的NLP知识

    1、评价标准:
    • EM(Exact match.)
      EM score in SQuAD Challenge ?

    This metric measures the percentage of predictions that match any one of the ground truth answers exactly.

    • ROUGH((recall-oriented understanding for gisting evaluation))
      ROUGH算法基本思路和BLEU差不多,不过它统计的是召回率
      在这里插入图片描述

    rouge的意思就是系统算法生成的摘要与参考摘要相同的N-gram数/参考摘要中的N-gram总数。这个公式是一个生成式摘要的评价标准。在主流的生成式摘要算法中,都使用这个公式作为测评标准。

    • BLEU

    最开始是用于机器翻译中。他的思想其实很native,对于一个给定的句子,有标准译文S1,还有一个神经网络翻译的句子S2。BLEU的思想就是对于出现机器翻译S2的所有短语,看有多少个短语出现在S1中,然后算一下这个比率就是BLEU的分数了。首先根据n-gram划分一个短语包含单词的数量,有BLEU-1,BLEU-2,BLEU-3,BLEU-4。分别就是把文章划分成长度为1个单词的短语,长度为2个单词的短语,。。然后统计她们出现在标准译文中个数,在分别除以划分总数,就是对应的BLEU-1分数,BLEU-2分数。。,其实就是准确率。看这些划分中有多少是出现在标准译文当中的。一般而言:unigram 的准确率可以用于衡量单词翻译的准确性,更高阶的 n-gram 的准确率可以用来衡量句子的流畅性,n{1,2,3,4}

    但是BLEU会有个缺陷,假如我就翻译一个单词,而这个单词正好在标准译文中,那岂不是准确率100%,对于这个缺陷,BLEU算法会有个长度惩罚因子,就是翻译太短了就会有惩罚,不过,总的来说,还是偏向于短翻译分数高一点。

    2、指针模型:

    摘要

          最近的研究在单轮对话建模方面取得了令人瞩目的进展。然而,在多轮对话中,当前的模型仍然远远不能令人满意。一个主要挑战是我们日常会话中经常出现的共指(coreference)和信息省略(omit),使得机器很难理解真实意图。在本文中,我们建议重写人类话语作为预处理以帮助多轮会话建模。首先重写每个话语以恢复所有共指和省略的信息。然后基于重写的话语执行下一个处理步骤。为了正确训练表达的重写模型,我们收集了一个新的具有人类注释的数据集,并使用指针网络引入基于transform的重写架构。我们表明所提出的架构在话语重写任务上实现了非常好的性能。经过训练后的表达重写器可以轻松集成到在线聊天机器人中,并在不同领域都有收益。

    前言

    挑战是多方面的。 一个最重要的困难是我们日常会话中经常出现的共指和省略,特别是在中文或日文等语言中,存在70%以上的不同程度的共指和省略。
    在这里插入图片描述
    与内存网络 (memory networks)(Sukhbaatar et al。,2015)或显性信念跟踪(explicit belief tracking)(Mrksi c et al。’,2017)等其他方法相比,经过训练的话语重写器与模型无关,可以轻松集成到其他黑盒对话中系统。 它还具有更高的存储效率,因为对话历史信息反映在单个重写的话语中。
    我们修改了Transformer体系结构包括指针网络机制。 得到的模型优于递归神经网络(RNN)和原始Transformer模型,在共指消解和信息完成上获得超过0.85的F1分数。 此外,我们整合了我们的训练有素的话语改写模型应用在两个在线聊天机器人平台并证明它可以实现更准确的意图检测并改善用户参与度。
    总之,我们的贡献是:

    • 我们收集了一个高质量的注释数据集,用于解决多轮对话中的共指和省略问题,可能有益于未来相关研究。
    • 我们提出了一种高效的基于transform的话语重写器,其表现优于几个强大的基线。
    • 经过训练的话语重写器,当集成到两个真实的在线聊天机器人中时,可以显着改善
      原始系统
      Coreference Resolution
      建立在transform架构的基础上,但在有监督的环境中进行共指消解,以帮助处理不明确的表达。

    数据集

    我们从中文社交平台上爬了200k个多轮对话数据并找人去注释,事先过滤敏感信息,以便以后处理。 表2列出统计信息。 可以看出,只有不到30%的话语既没有共识也没有遗漏,而且有不少话语两者都有。因此这个研究很有必要。
    在这里插入图片描述
    数据的构建:
    (1)选择在日常对话中更有可能被谈论的主题,
    (2)尝试覆盖更广泛的领域
    (3)平衡不同的指代和省略的比例。
    (4)加入一些负例(不需要重写的)

    Model

    注意机制负责找到适当的确认或遗漏信息对话历史。
    在这里插入图片描述

    在编码器中, ( H , U n ) (H,U_n) (H,Un)被展开为 ( w 1 , w 2 , … , w m ) (w_1,w_2,…,w_m) (w1,w2,,wm) m m m是整个对话中词的个数,然后将这个序列传入transformer,transformer通过自注意机制学习其中的共指信息,对于每个词 w i w_i wi,输入嵌入是词嵌入、位置嵌入和轮数嵌入:

    I ( w i ) = W E ( w i ) + P E ( w i ) + T E ( w i ) I(w_i)=WE(w_i)+PE(w_i)+TE(w_i) I(wi)=WE(wi)+PE(wi)+TE(wi)

    其中轮数嵌入 T E ( w i ) TE(w_i) TE(wi)表示这个词所属的对话轮数,L堆叠编码器以获得最终编码表示。 每个编码器包含一个自我关注层,后跟一个前馈神经网络:

    E ( 0 ) = [ I ( w 1 ) + I ( w 2 ) + I ( w m ) ] E^{(0)}=[I(w_1)+I(w_2)+I(w_m)] E(0)=[I(w1)+I(w2)+I(wm)]
    E ( l ) = F N N ( M u l t i H e a d ( E ( l − 1 ) , E ( l − 1 ) , E ( l − 1 ) ) ) E^{(l)}=FNN(MultiHead(E^{(l-1)},E^{(l-1)},E^{(l-1)})) E(l)=FNN(MultiHead(E(l1),E(l1),E(l1)))

    FNN是一个前馈神经网络,MultiHead(Q,K,V)是多头注意函数,以查询矩阵Q,密钥矩阵K和值矩阵V作为输入。每个自我关注和前馈组件都带有残余连接和层标准化步骤,最终编码是第L编码器 E ( L ) E^{(L)} E(L)的输出。
    模型的解码器也包含L层,每层由三个子层组成,第一个子层是多头注意力层:

    M ( l ) = M u l t i H e a d ( D ( l − 1 ) , D ( l − 1 ) , D ( l − 1 ) ) ) M^{(l)}=MultiHead(D^{(l-1)},D^{(l-1)},D^{(l-1)})) M(l)=MultiHead(D(l1),D(l1),D(l1)))

    其中 D ( 0 ) = R D^{(0)}=R D(0)=R,第二个子层是编码器-解码器注意力,其将 E ( L ) E^{(L)} E(L)集成到解码器中。在该任务中,由于 H H H U n U_n Un用于不同的目的,对来自对话历史 H H H的词和来自 U n U_n Un的词使用单独的键值矩阵。从最后部分获得的编码序列 E ( L ) E^{(L)} E(L)被分成 E H ( L ) E_H^{(L)} EH(L)(来自 H H H的词的编码)和 E U n ( L ) E_{U_n}^{(L)} EUn(L)(来自 U n U_n Un的词的编码),然后单独处理。编码器-解码器向量计算如下:

    C ( H ) l = M u l t i H e a d ( M ( l ) , E H ( L ) , E H ( L ) ) ) C(H)^l=MultiHead(M^{(l)},E_H^{(L)},E_H^{(L)})) C(H)l=MultiHead(M(l),EH(L),EH(L)))
    C ( U n ) L = M u l t i H e a d ( M ( l ) , E U n ( L ) , E U n ( L ) ) ) C({U_n})^{L}=MultiHead(M^{(l)},E_{U_n}^{(L)},E_{U_n}^{(L)})) C(Un)L=MultiHead(M(l),EUn(L),EUn(L)))

    第三个子层是一个全连接的前馈神经网络:

    D ( l ) = F N N ( [ C ( H ) l ∘ C ( U n ) L ] ) D^{(l)}=FNN([C(H)^l \circ C({U_n})^{L}]) D(l)=FNN([C(H)lC(Un)L])

    其中 ∘ \circ 表示向量连接。
    最后的输出 R t R_t Rt取决于参数 λ \lambda λ,这个参数包含了历史句和当前句的向量信息,但是不太懂感觉 D t l D_t^l Dtl和这两个向量有点重复。

    在这里插入图片描述

    论文实验

    本文以基于生成的模型、基于指针的模型、指针+生成混合模型作为基线模型,从指代消解信息补全的效果以及处理过的数据集在对话系统任务的效果两个方面对表达改写的表现进行评估。

    作者的实验主要想要验证以下几点:
    (1)是否attention优于LSTM
    (2)是否基于指针的策略优于生成模型
    (3)是否引入了分割注意力参数λ,会更好
    因此引入和设计了如下四个模型:
    1.(L / T)-Gen:基于纯生成的模型。单词是从固定的词汇表生成的。
    2.(L / T)-Ptr-Net:基于纯指针的模型(Vinyals等人2015年)。 言语只能是从输入中复制。
    3.(L / T)-Ptr-Gen:混合指针+生成模型(如See等人的模型2017年)。 输出句子要么从输入复制,要么生成来自固定的词汇。
    4.(L / T)-Ptr-λ:我们提出的模型引入系数λ决定注意力的最终输出。
    (L / T)表示编码器 - 解码器结构是采用LSTM或Transformer。
    由此产生的词汇量为5629(4813中文字符和816其他token),在测试阶段,所有模型通过集束搜索(Beam Search)解码字,beam_size大小设置为4。
    实验结果如下:
    在这里插入图片描述
    结论:

    • 生成模式在我们的设置中不能很好地工作,因为可以从H或Un中检索所有单词。 基于指针的模型优于更复杂的基于模型和混合模型(emm,可能现在大趋势还是生成模型效果稍微差一些,引入了指针效果会好一些,还是有监督的效果好)
    • 分别处理H和Un然后将他们的注意力与学习的λ执行相结合比处理整个对话更好
    • 与基于LSTM的效果相比,基于Transformer的模型可带来显着的改进。 这意味着自我注意机制有助于识别被指代和省略的信息。

    机器人中做实验:
    我们的面向任务的对话系统包含一个基于FastText的意图分类器(Bojanowski等,2017)和一组按顺序执行策略决策和插槽值填充的模板。

    对一个输入的query,机器人会提供多个候选结果。通常,模型已经能够在单轮对话下提供相当高质量的响应,但是在多转对话中,复杂的上下文依赖性使得生成变得困难。
    在这里插入图片描述
    引入重写模型的机器人效果提升更明显且交互论数也增多了

    结论

    在本文中,我们建议通过引入一个单独的表达重写模型来改进多转对话建模。 重写器用于恢复用户表达中的指代和省略信息。我们收集了一个高质量的手动注释数据集,并设计了一个Transformer的指针架构来训练表达重写器。受过训练的表达重写器表现得非常好,并且集成到任务和闲聊机器人上也取得了不错的效果,显著地改善了意图检测和用户参与度。 我们希望收集的数据集和训练的模型可以有益于未来的相关研究。

    一些碎碎念:

    有个同事说论文的精髓在于实验,所以把实验看完了,之前都是只看到前面实验就很快扫过去了。

    展开全文
  • 转到博客浏览效果可能不佳(比如序号无法正常显示,可以下载文档) ...1.Most cities in the country have introduced “Clean Air Zones” whereby factories and households are on...

    转到博客浏览效果可能不佳(比如序号无法正常显示,可以下载文档)

    链接:https://www.lanzous.com/b531026/
    密码:2qfl

    Word In Use

    Unit1

    1.Most cities in the country have introduced “Clean Air Zones” whereby factories and households are only allowed to burn smokeless fuel. 

    在全国大部分城市都有“洁净空气区”因此工厂和家庭只能燃烧无烟燃料。

    1. He knows that the pursuit of social status can consume vast amounts of his time and effort. 

    他知道,追求社会地位可以消耗大量的时间和精力。

    1. The doctors are at a loss because so far no medicine has been found to inhibit the spread of the disease. 

    医生们正在进行损失,因为到目前为止,没有任何药物能抑制疾病的传播。

    1. We see many special education directors trying to maintain the quality of their programs with much less money and much smaller staff.

    我们看到许多特殊教育董事试图保持他们的节目的质量以少得多的钱和更少的工作人员。

    1. People there are told it is their patriotic duty to support the national economy by buying their own products. 

    人们有人告诉他们,通过购买自己的产品来支持国民经济是他们的爱国义务。

    1. Darwin’s thinking both drew upon and transcended the conventional ideas of his time.  

    达尔文的思想是借鉴和超越他的时代的传统观念。

    1. In spite of all your endeavors; there may be times when you encounter difficulties in the training process. 

    尽管你所有的努力,有时当你在训练过程中遇到困难时。

    1. My advice to Mr.Stewart is to think carefully before entering into a career in medicine, as this is a field which requires a lot of dedication and long working hours. 

    我对斯图尔特先生的建议是在医学上的职业生涯之前仔细考虑,因为这是一个需要大量的奉献和漫长的工作时间的领域。

    1. Most Chinese parents would prefer to choose some professions that are stable ans could bring prestige and economic benefits. 

    大多数中国父母宁愿选择一些职业稳定和可能带来的声誉和经济效益。

    1. It is legally possible for an elderly person to nominate someone to act for them, should they become incapable of looking after themselves. 

    从法律上来说,如果老人生活不能自理,他可以指定某人为其代理事务。

     

    1.When Francis got back after Easter, he was far behind his classmates and he was removed from the second into the third class at his own desire.

    当弗兰西斯在复活节后回来的时候,他远远落后于他的同学,他被从第二次删除到第三级,在他自己的愿望。

    2.The president acknowledged that he had somehow failed in his ability to communicate to the American people.

    总统承认他在某种程度上失败了他与美国人民的沟通能力。

    3.Unfortunately, as history has shown, some of the companies are guilty of misconduct in the pursuit of profit.

    不幸的是,正如历史所显示的那样,一些公司在追求利润的过程中犯了不当行为。

    1.   The ship deviated from the agreed voyage and arrived about 10 days late and in the meantime the price of sugar had fallen and the merchants lost over £4,000. 

    偏离约定的航行,到达晚了10天,在此期间食糖价格已经下跌超过4000£失去商人。

    1.   Because the transcript is still under seal, the law precludes them from reading and discussing the evidence in detail. 

    因为成绩单仍在密封,法律阻止了他们的阅读和讨论了证据。

    1.  In carrying out the plan we are likely to come across difficulties, but we are determined to triumph over them all. 

    在执行这个计划时,我们很可能会遇到困难,但我们决心战胜他们所有的人。

    1.  Without increasing investment in education, it will be increasingly difficult for low-income people to work their way into the middle class.

    在不增加教育投资的情况下,低收入者的工作方式将越来越难进入中产阶级。

    1.   All the passengers in the plane that crashed in the middle of the Andes Mountains a week ago were written off as dead.

    一周前在安第斯山脉中部坠毁的飞机上的所有乘客都被认为是死了。

     

    Uint2

    1. Kids are more likely to intervene in a situation if they believe their parents expect them to help.

    如果孩子相信父母希望他们能帮助他们,他们更容易干预这种情况.

    1. The first lesson I learned as a newcomer for the company was never to underestimate the degree of difficulty I would face in career advancement. 

    作为一个新来的公司,我学到的第一个教训是永远不要低估我在职业发展中所面临的困难的程度。

    1. Just as I started to think that I was never going to get well, the illness began to recede

    正当我开始觉得我永远不会好,病情开始好转

    1. Whatever the decision is, I would like you to know that your department is my first choice and I deem it a great honor if I could study in your department.

    无论决定是什么,我想让你知道,你的部门是我的第一选择,我认为这是一个伟大的荣誉,如果我可以在你的部门。

    1. During one particularly bleak moment in my career, a senior colleague of mine said to me “If you follow your dreams, the money will come. Follow the money, and you’ll lose your dreams.”

    在我职业生涯中的一个特别黯淡的时刻,我的一位高级同事对我说“如果你按照你的梦想,钱会来的。跟着钱,你会失去你的梦想。”

    1. Unless we can find a way to appraise nature and then invest in protecting it, our basic life-support systems are going to collapse.

    除非我们能找到一种评价自然的方法,然后投资于保护它,我们的基本生命支持系统将崩溃。

    1. The blizzard moved south, turning into an icy rain that paralyzed the airports for three days.

    暴风雪向南移动,变成了一个冰冷的雨,使机场瘫痪了三天。

    1. In this introduction we have diagnosed some of the causes of the illness and, in the following chapters, we will draw attention to its various unpleasant symptoms

    在这篇介绍中,我们已经诊断出了一些疾病的原因,在下面的章节中,我们将提请注意其各种不愉快的症状

    1. In those days, divorce under any circumstances was socially unacceptable and there was great dismay in the family who went through it. 

    在那些日子里,在任何情况下,离婚都是社会不可接受的,并有很大的沮丧,在家庭中,经历了它

    10.Every time she talked about being rejected in her hunt for a job, she seemed on the brink of tears, and I would quickly switch the conversation to another topic.

    每当她谈到被拒绝在寻找工作时,她似乎都在流泪的边缘,我会很快切换到另一个话题的谈话。

    1. When the bus pulled to a stop and I got off, I was relieved because I had finished school and I had the weekend ahead of me to enjoy myself. 

    当公共汽车停下来,我下车时,我很放心,因为我已经完成了学校,我有一个周末提前我享受自己。

    1. When my car crashed into the big tree, I could feel the blood draining from my face and I wondered whether I was about to black out .

    当我的车撞上大树时,我能感觉到我脸上的血在流血,我想知道我是不是要黑屏了

    1. All kinds of questions concerning the soaring housing price begin to pop up on cable television and the blogosphere.

    各种各样的问题,高房价开始出现在有线电视和博客圈。

    1. The soldiers' rapid march was stopped short by the general's command; they were uncertain whether to go back or forward.

    士兵们的快速行军被将军的指挥所拦住了,他们不确定是回去还是向前走。

    5. A car crashed into the side of a house after the driver lost control and plowed through a hedge.

    一辆车撞上了一所房子的侧面后,司机失去控制,穿过树篱。

    1. Charles reappeared, after half an hour's absence, and threw himself into an armchair, where he lay back for some time with his eyes shut.
    2. 查尔斯又出现了,半个小时的缺席后,冲向到一张扶手椅上,在那里他躺在那并且闭上眼睛。
    3. You may be out of work but that is no reason to let yourself go by not washing, brushing your hair and wearing clean clothes.

    你可能会离开工作,但这是没有理由放纵自己不洗漱,刷牙你的头发和穿着干净的衣服。

    8. As her door began to open, she grabbed for the telephone, and then dropped the receiver as Luke walked in.

    当她的门开始打开时,她抓住了电话,然后下降了接收器,因为卢克走了进来。

    Unit3

    1. As a number of authors point out,the urge to migrate is a(n) integral part of human nature.

    正如许多作者指出的那样,迁移的冲动是人性的一部分,是一个整体的一部分。

    1. Children should be allowed to cherish those few years of innocence before they have to learn the truth about the real world. 

    应该允许孩子们珍惜这几年的纯真,在他们必须了解真实世界的真相之前。

    1. He has been afflicted by a horrible disease, from which one of his best friends died two weeks ago. 

    他被一种可怕的疾病折磨着,两个星期前他最好的朋友之一就去世了。

    1. The results of the survey are noteworthy and useful despite being from a small sample. 

    该调查的结果是值得注意的有用的尽管来自一个小样本。

    1. The director said that they needed a young actress who could portray someone who was both unbalanced and confident at the same time. 

    导演说,他们需要一个年轻的女演员,谁可以描绘的人都是不平衡和自信在同一时间。

    1. Praise must be use wisely to compliment students who perform up to expectations and to encourage students to perform to maximum levels. 

    表扬必须明智地使用,以赞美学生的表现,期望,并鼓励学生执行到最高水平。

    1. In the domain of research, it is an accepted fact that scientific publications have to be written or translated into English to get published, acknowledged, and cited.

    在这一领域的研究,它是一个公认的事实,科学出版物必须被写入或翻译成英文出版,承认和引用。

    1. He received a anonymous call threatening to disclose details of his affair if he didn’t pay the money.

    他收到一个匿名电话威胁要披露他的事情的细节,如果他没有支付这笔钱。

    1. The movie presents Lincoln as a strong-willed, conscientious man who led the US through a moral, constitutional and political crisis. 

    这部电影把林肯看成是一个意志坚强、有责任心的人,他带领美国经历了一个道德、宪法和政治危机。

    1. It is understandable that the health and welfare of their family is a(n) perpetual concern for this young couple.

    可以理解的家庭的健康和福利是一永恒的关注对这一对年轻夫妇。

     

    1.Clearly, most of the students there are full-time workers who would not otherwise have

    been able to embark on sustained further study.

    显然,大多数的学生都有全职工人,否则不会有能够开始持续的进一步研究。

    2.The court ruled that this man be deprived of his political rights for a further four years after he has served his 13-year sentence. 

    法院裁定,这名男子在服刑四年后被剥夺了政治权利,13年徒刑。

    3.I would love to have kids. I would turn down an Oscar to see my boy at a baseball game or my girl at a song recital.

    我很想有孩子。我能拒绝一个奥斯卡去看在棒球比赛的儿子或在一首独奏会去看我的女儿。

    4.Richard was finally released on February 4, one year and six weeks after he'd been taken captive

    李察终于在2月4日释放,在他被俘虏了一年六个星期后。

    5. She hoped Vincent would understand that her life had not been empty, because her love would live on

    她希望文森特能明白她的生活一直不空,因为她的爱将生活

    1. All people, whether they be rich or poor, strong or weak, privileged or deprived, are interdependent, and share in the common task of seeking to achieve mankind's full potential.

    所有的人,无论是富有还是贫穷,强或弱,特权或剥夺,都是相互依存的,并分享共同的任务,寻求实现人类的全部潜力。

    1. In September 1944 he was able to return to his academic duties, but soon after the war ended he was stricken by a serious illness and did relatively little research thereafter .

    1944九月,他回到他的学术职责,但很快在战争结束后他是受了严重的疾病,并没有相对较少的研究。

    8. She retired from the company where she has led by example and been a source of encouragement to others.

    她从公司的领导下退休,她以身作则并成为其他人的鼓励来源。

    Unit4

    1.  Although secondary education is compulsory, parents are not required to send their children to state schools.

    虽然中学教育是强制性的,但家长不需要把他们的孩子送去公立学校。

    2.The economic situation has been worsening, causing economists to contemplate whether the present policies are sustainable

    经济形势日益恶化,导致经济学家们考虑到目前的政策是否可持续

    1. He was found guilty and was imprisoned in the Tower of London, where he died very quickly, aged only 47. 

    他被判有罪,并被囚禁在伦敦塔,在那里他死得很快,年龄只有47岁。

    4.It is obvious that the future of the Internet is to globalize more and more areas of the world, and that e-commerce and e-entertainment are going to go for more and more markets.

    很明显,未来的互联网是世界上越来越多的地区,全球化,电子商务和电子娱乐要争取更多的市场。

    5.However, your current losses should soon be offset by gains; the fund will produce a positive return of 11.6 percent over a nine-month period. 

    然而,你目前的损失很快会被收益抵消,该基金将产生积极的回报率超过九个月的百分之11.6。

    1. Because she was so tall and slim, all the clothes looked marvelous on her and the other girls would groan their envy.

    因为她又高又苗条,所有的衣服看起来都很好,其他的女孩会呻吟他们的羡慕。

    7. This can be a helpful approach in discussion — someone may regard you as stubborn since you never want to change your mind, whereas you see yourself as determined.

    这可能是一个有益的方法在讨论-有人可能认为你是顽固的,因为你永远不想改变你的想法,而你看到自己的决心。

    1. At weekends, the school park is almost empty except that a few cars cluster near the entrance. 

    在周末,学校公园几乎是空的,除了入口附近的几辆汽车

    9.In the photographer's finest pictures there is also a degree of ambiguity, which allows them to be interpreted in a variety of ways.

    在摄影师的最优秀的照片中,也有一个模糊度,这使他们能够以多种方式解释

    10. Tim stretched out a hand in apology for his thoughtless remarks and was consoled by a firm handshake from Mark.

    提姆伸出手为自己的轻率言论道歉并安慰马克握手。

    1.Virginia was a perfectionist. She was just not prepared to settle for anything that was second best. 

    Virginia是一个完美主义者。她只是不准备解决任何事情都是下一次最好。

    2. He could be quite casual in his attitude to his wife's anxiety, and more often than not failed to let her know when he would be back from a business trip.

    他可以很随意的态度,他妻子的焦虑,而且往往比没有让她知道他什么时候会回来从一个商务旅行。 

    3."You'll kill yourself with those things," Arty said in a tone in which disappointment was mingled with disgust. 

    “你会用这些东西杀死自己,”阿蒂语气中失望与厌恶混合在一起地说。

    4. Thanks to modern transportation, agricultural products in these remote mountainous regions can also be traded for other goods. 

    由于现代交通工具,这些偏远山区的农产品也可以进行其他商品的交易

    5.As the market was saturated with a wide variety of goods, the economy became more balanced and the competition forced the prices down. 

    由于市场上饱和各种各样的商品,经济变得更加平衡,竞争迫使价格下降。

    6.Going with the flow doesn't mean that we don't know where we're going; it means that we are open to multiple ways of getting there. 

    与流动并不意味着我们不知道我们要去哪里,这意味着我们是开放的多种方式到达那里

    7. The athlete had been endowed with long legs and a persistent temperament so he was very successful.

    这名运动员被赋予了长的腿和一个持续的气质,所以他非常成功。

    8. The wrongly accused man asked for extra compensation to make up for the stress he had suffered during the case.

    被错误指控的人要求额外赔偿,以弥补他在案件中所遭受的压力。

    Unit5

    1. The general considered all the information that had been gathered and gauged what possible moves the enemy might make before issuing his orders.

    一般认为所有已收集和估计敌人可能在发布他的命令做什么可能的移动信息。

    1. The new president said she would dedicate herself to protecting the rights of the old and the homeless, who are otherwise helpless and vulnerable.

    新总统说,她将奉献致力于保护老人和无家可归者这是他们无助和脆弱的权利。

    1. Cell phone conversations, which are fairly commonplace on commuter trains, can be annoying to fellow commuters.

    在通勤列车上,手机通话是相当普遍的,可能会让人讨厌的通勤者。

    1. Ask your doctor whether a low-fat diet and a daily walk will suffice to reduce your high blood pressure. 

    问你的医生,是否低脂肪的饮食和每天的步行就足够了,以减少你的高血压。

    1. The revenue from tourism is the biggest single contribution to GDP in the Maldives; every year many tourists from all corners of the world spend their holidays there.

    旅游业的收入是马尔代夫GDP的最大贡献,每年都有来自世界各地的许多游客在那里度假。

    1. Since the beginning of this century, China has built many modern conference centers with underground parking, air-conditioning and simultaneous translation systems.

    本世纪以来,中国已建造地下停车场很多现代化的会议中心,空调和声传译系统。

    1. While advertising offers a stimulus to buy, sales promotion offers a incentive to buy, but consumers must have their own reason to buy.

    虽然广告提供了刺激购买,促销提供了一个刺激购买,但消费者必须有自己的理由购买。

    1. In general, smokers living in cities are slightly more prone to lung cancer than smokers who are living in the country.

    在一般情况下,生活在城市的吸烟者比在该国生活的吸烟者更可能患肺癌。

    1. A large proportion of important innovations are brought about by people who step outside of conventional categories or traditional assumptions.

    一大比例的重要创新带来的人谁步骤以外的传统类别或传统的假设。

    10.The habit of going to coffee houses was fostered by the city's relatively small size, safe streets, good public transportation, and moderate climate.

    去咖啡屋的习惯是由城市的相对较小的规模所形成的,安全的街道,良好的公共交通和温和的气候。

    1.The results of this experiment do not correlate with those of the studies that the team of scientists had conducted previously.

    本实验的结果与科学家先前进行的研究的结果不相关

    2.It was a moment of overwhelming excitement when Steve was given the first prize; Tiffany couldn't refrain from hugging and kissing him. 

    这一刻,铺天盖地的兴奋时,史提夫被授予一等奖;蒂凡妮忍不住拥抱和亲吻他。

    3.As we count down to tonight's presidential debate, it's time to go over the political agendas which the candidates are trying to promote. 

    当我们倒数到今晚的总统辩论时,是时候去讨论候选人试图推动的政治议程了。

    4.She spent the next 10 years taking in washing, slaving away to pay back the money they had borrowed from the bank.

    她在接下来的10年里以洗涤,拼命的干活的钱还他们从银行借了。

    5.Indeed, it seems that the upward shift in the rate of economic growth in the mid-1990s coincided with a sudden, substantial and rapid decline in the prices of computers.

    事实上,在20世纪90年代中期,经济增长率的上升似乎与计算机价格的突然大幅、实质性和快速的下降相一致

    6.As Crawford contended with heartbreak in his private life, his career soared to greater heights than he could have ever dreamed of.

    克劳福德不得不应对他的私人生活中的悲伤,他的职业生涯上升到更高的高度比他曾经梦想。

    7.I am assuming that you have adequate health insurance, but someone should be designated as successor to take over your financial and domestic affairs if you become unable to cope with them yourself. 

    我假设你有足够的医疗保险,但如果你无法应付自己的财务和家庭事务,你就应该被指定为继承人接替你的财务和家庭事务。

    8.Formal consent for this new type of treatment was obtained from each patient and the study conformed to our institution's guidelines concerning medical ethics.

    这种新类型的治疗的正式同意,从每一个病人,并符合我们的机构的医疗道德准则的研究。

     

    Unit6

    1. Much of the city was evacuated before the storm but thousands remained, many of whom were trapped by the water for days.

     许多城市在风暴前被疏散,但仍有数千人被困,其中许多人被水困了几天。

    1. Located in the heart of the city, the Dogs' Home is open seven days a week, 365 days a year to receive stray dogs.

    在城市的心脏,狗的家是每周开放七天,一年365天接待流浪狗。

    1. With the development of modern industries, a lot of traditional values that developed from a farm-based economy have been enormously diluted.

    随着现代工业的发展,许多以农场为基础的经济发展的传统价值被大大稀释了.。

    1. There are gigantic changes in environmental conditions from freezing cold to extremely hot, and from dry to very humid.

    巨大的变化,在环境条件下,从冷冻到非常热,从干燥到非常潮湿。

    1. From a practical standpoint , how can you reduce production costs and at the same time minimize the risks involved?

    从实际的立场来看,你如何降低生产成本,同时最大限度地减少所涉及的风险?

    1. Child mortality decreased due to improvements in medical care and greater attention to problems related to proper nutrition .

    儿童死亡率下降,由于医疗保健的改善和更大的关注适当的营养问题。

    1. The disaster is already set to be the world's worst for ground casualties inflicted by a crashing aircraft.

    这次灾难已经成为世界上坠毁飞机造成的地面伤亡最严重的一次。

    1. With Spring Festival drawing nearer, people are glowing with happiness, and are full of hope; this excitement is pervasive before New Year's Eve.

    随着春节临近,人们都在幸福的光辉,充满了希望,这种兴奋是普遍的,在新年前夕。

    1. Don't be too naive ! If the manager of the car dealership intended to give you the job, he would have called you by now.

    不要太天真!如果汽车经销商的经理打算给你这份工作,他现在就给你打电话了。

    1. To a large extent, computers have already permeated most aspects of our lives, from transportation and telecommunications to entertainment.

    在很大程度上,计算机已经渗透到我们生活的大部分,从交通和电信到娱乐

     

    1. Melanie got so upset by what Max had said to her that something inside her exploded, and she flew at him and hit him in a rage.

    梅兰妮对马克斯对她说的话感到很不安,她内心的东西爆炸了,她扑到他身上,并愤怒的打了他。

    2. Barbara left Alice and wove her way through the crowd to the library to avoid a late fee and renew the books she borrowed two months ago.

    巴巴拉离开了爱丽丝,用她的方式通过图书馆去避免滞纳金和更新她两个月前借的书。

    3. Happiness radiated from Mary as she proudly told her parents about her remarkable success in achieving her career goals!

    玛丽自豪地告诉她的父母她在实现她的职业目标上取得了惊人的成功,从中获得了快乐!

    4. For people who live in industrialized countries, it is hard to conceive of living without electricity and other modern conveniences.

    对于生活在工业化国家的人们来说,很难想象没有电和其他现代设施的生活。

    5. This car was lined with steel to protect the occupants from attacks by angry residents, who were strongly against gambling being allowed in their community.

    这辆车是内衬钢,以保护居民免受愤怒的居民,谁是强烈反对赌博被允许在他们的社区。

    6. The boys stood at the shore of the river which was filled with water from the melting snow in the mountains, and they were hesitating to dive into the icy water below them.

    男孩站在这满是水从融化的雪在山区河流岸边,他们犹豫跳入下面冰冷的水。

    7. I bought a second-hand pocket English-English dictionary; it's been very useful and cost me next to nothing.

    我买了一本二手袖珍英语词典,它是非常有用的,并花费我什么都没有

    8. It was a hot and humid night; all the soldiers stayed down out of sight, waiting for the orders to attack.

    这是一个炎热潮湿的夜晚,所有的士兵都在看不见的情况下,等待着进攻的命令。

    Unit7

    1. People donate canned food and old clothes most frequently, but rarely do they think about bringing in underwear- it’s one of the most obvious but overlooked needs of the homeless.

    人们最常捐赠罐头食品和旧衣服,但他们很少考虑引进内衣--这是无家可归者最明显但却被忽视的需求之一。

    1. Brian Wood watched his financial life spiral downward just when he thought he had overcome the obstacles which had been dominating his past.

    Brian Wood看着他的财政生活螺旋下降,当他认为他已经克服了障碍,主宰了他的过去。

    1. They are to leave the house with only their personal possessions,for they have got a letter ordering the immediate termination of their occupancy.

    他们只留下他们的个人财产,因为他们有一封信,命令他们立即终止入住。

    1. The company was reportedly going bankrupt and this wold result in the layoff of thousands of employees.

    公司正在破产和世界导致数千名员工的裁员

    1. The princess who was brought up in wealth understood that many things that are common and everyday to her are unimaginable luxuries to people on subsistence wages.

    在财富中长大的公主明白,许多她普遍的和日常的东西对靠维持生活工资的人是难以想象的奢侈品

    1. Young students should develop a broad spectrum of interests,which their parents should encourage and support as best as possible.

    年轻的学生应该培养广泛的兴趣,他们的父母应该鼓励和支持尽可能最好的。

    1. I asked the waitress to refill my coffee cup and she happily complied repeatedly until I had consumed enough coffee to stay up all night and study for my exam.

    我让女服务员重新装满我的咖啡杯,她愉快地遵守了多次,直到我吃了我喝了足够的咖啡熬夜,为我的考试。

    1. Though she lost the title of female world swimming champion last year,she reclaimed it this year when she gave it all she could.

    虽然去年她失去了世界游泳冠军的头衔,但她在今年的时候她收回了这个冠军。

    1. This type of system which originated in the United Kingdom has been widely used Throughout Europe and is gaining in popularity in the United States of America and Japan.

    这种起源于英国的系统在整个欧洲被广泛使用,并在美利坚合众国和日本获得了普及。

    1. Failure to make the request will be fatal to the accuser’s claim if the relevant limitation period has expired unless an extension of time is granted.

    失败使请求将原告的索赔致命如果相关时效已过期,除非延长时间是理所当然的。

     

    1. He put down $20,000 as a deposit on the beautiful $200,000 villa believing that his investment would increase over time.

    20000美元作为一个存款在美丽的200000美元的别墅,相信他的投资会随着时间的推移增加。

    1. The parents who feel that their own lives are miserable and are failures can wind up doing an immense amount of damage to their kids.

    父母认为他们自己的生活以是悲惨的,失败的告终可能会造成巨大的伤害给他们的孩子们。

    1. Families that are paying for college or saving for college are trying to scrape together and save the money for their kids.

    支付大学或为学院的储蓄的家庭试图凑在一起,并为他们的孩子省下钱

    1. Reporters were openly and aggressively questioning whether the party was on the verge of being taken over by extremists.

    记者们公开和积极地质疑党是否已经被极端分子接管的边缘

    1. The factory had just started production and in all likelihood it would take five to seven years to achieve full production.

    工厂刚开始生产,在所有的可能性,将需要五至七年,以实现充分的生产

    1. The conditions for the majority of the workforce will continue to deteriorate into widespread and extreme poverty if relief payment is late in coming.

    如果救济金很晚了,大多数劳动力的条件将继续恶化到广泛和极端的贫困。

    1. Only those who are weighing the advantages and disadvantages of each choice are in a position to know which one is best for them.    

    只有那些权衡各种选择的利弊的人,才知道哪一种选择对他们来说能够做的才是是最适合的。

    1. Her romantic illusions of being married gave way to recognizing her adult responsibilities that come with marriage.

    她结婚的浪漫幻想让位了她认识到婚姻中的成人责任的方式。

    Unit8

    1. He could hardly control his indignation at the conditions under which the miners were forced to work, without water and enough food.

    他几乎无法控制自己的愤怒,在这种条件下,矿工被迫工作,没有水和足够的食物。

    1. Both sides were very careful when drafting the ceasefire agreements;they wanted to prevent any actions that could be considered provocative by either side.

    双方在起草停火协议时非常谨慎,他们想阻止任何可能被双方视为挑衅的行为。

    1. She has always had a militant personality;she is always prepared and ready to do battle when she believes that the cause is right.

    她一直有一个激进的个性,她总是准备好,准备做战斗时,她认为,事业是正确的。

    1. News stories overlap : Morning paper headlines take account of the previous evening’s radio and TV stories,and the electronic media pick up items from the daily press.

    新闻故事重叠:晨报头条考虑了前一个晚上的广播和电视故事,以及电子媒体从日常新闻中拿起的项目。

    1. Lucy stretched up to kiss her dad’s cheek lightly,and he patted his daughter as if he was conferring an honor to her.

    露西轻轻地吻了一下她爸爸的脸颊,他轻轻地拍了一下女儿,好像他是在她一种荣誉似的。

    1. Inspired by Martin Luther King’s famous speech, “I Have a Dream”, thousands of people went out onto the streets to support the civil rights movement in defiance of the curfew.

    灵感来自马丁·路德·金的著名的演讲,“我有一个梦想”,成千上万的人走上街头,在宵禁的蔑视人权运动的支持。

    1. Beth was hesitant about visiting his ex-boy friend;she worried that he might refuse to talk to her.

    Beth很犹豫是否要去拜访他的前男友,她担心他可能拒绝和她说话。

    1. When humans first traveled into outer space,it was as revolutionary a milestone in human culture as the invention of the wheel.

    当人类第一次进入外层空间,它是作为一个革命性的一个里程碑,人类文化的发明的车轮

    1. Perplexed, she turned and noticed her husband had collapsed and was slumped on the floor behind the counter. She rushed to him and cradled his head in her arms.

    她不知所措,转过身来,注意到她的丈夫已经倒了,倒在柜台后面的地板上。她向他冲过去,将他的头在怀里

    1. Health experts are now preaching that even a little exercise,such as doing housework or light gardening , is far better than none at all.

    健康专家现在讲道,即使是一点运动,如做家务或轻园艺,是远远优于没有一个。

     

    1. Our students have almost limitless resources at their disposal a well-equipped library,student workrooms , a large cafeteria , an undergraduate office and a computer center.

    我们的学生有几乎无限的资源在他们的处置设备齐全的图书馆、学生工作室、一个大餐厅,一个本科室和计算机中心。

    1. South Africa’s government imprisoned Nelson Mandela for 27 years , but never succeeded in its attempt to insulate him from his sacred cause against racial separation.

    南非政府囚禁27年的Nelson Mandela,但从来没有成功地使他从神圣的事业,反对种族分离的尝试。

    1. Please remember to keep a copy for yourself as we cannot return manuscripts,irrespective of whether or not they are published.

    请记得给自己留一个副本,因为我们不能返回手稿,不论他们是否被出版。

    1. He won’t be able to make any progress if he always has a high opinion of himself and criticism flows off him like water off a duck’s back.

    如果他总是对自己有很高的评价和批评,他就不会取得任何进展,就像鸭子的背上的水一样。

    1. Since Mary won the money and bought up the majority of the company’s stock shares,she now has authority over the people she used to take orders from.

    自从玛丽赢了钱,买了大部分的公司的股票,她现在有权在她过去的人从订单。

    1. Your new boss is nice and will be kind to you, provided that you,for your part,work diligently without complaining too much.

    你的新老板很好,会对你很好,只要你,为你的一部分,努力工作,没有抱怨太多。

    1. Despite the measures put in place to prevent plagiarism,it is still not clear how students can get away with cheating in their exams.

    尽管采取了措施防止剽窃,但仍不清楚学生们如何能在考试中作弊。

    1. When the economic slump hit the country,many people who had lost their jobs had to dispense with a lot of luxuries.

    当经济滑坡袭击这个国家时,许多失去工作的人不得不放弃许多奢侈品

    1. The majority of people are not lazy ; they want to work hard,want to have a better future , and want to provide for their families.

    大多数人并不懒惰,他们想努力工作,想有一个更好的未来,并想为他们的家庭提供

    1. In 1940,some people thought Franklin Roosevelt was tiptoe around the question of war, instead of confronting it, until the Japanese suddenly attacked the United States Navy Pacific Fleet in Pearl Harbor.
    1. 有人认为Franklin Roosevelt是避而不谈在战争问题上,而不是直面它,直到日本突然袭击美国海军太平洋舰队在珍珠港。

    英译汉

    Unit1

    Global citizen is someone who identifies with being part of an emerging world community and whose actions contribute to building this community's values and practices.

    Global citizenship believes that humankind is essentially one and each individual has the power to change things. In our interdependent world, global citizenship encourages us to recognize our responsibilities toward each other and learn from each other. Global citizens care about education, disease, poverty, and environmental issues around the world. Today, the forces of global engagement are helping some people identify themselves as global citizens who have a sense of belonging to a world community. This growing global identity in large part is made possible by the forces of modern information, communications and transportation technologies. Global citizenship aims to empower people to lead their own action. Along with the knowledge and values that they have gained from learning about global issues, people need to be equipped with the necessary skills to give themselves the ability and confidence to be pro-active in making a positive difference in the world.

    世界公民是指一个人承认自己是新兴的全球社区的一分子, 而且其行动对全球社区的价值打造和实践活动有所贡献。世界公民相信人类从本质上来说是一个整体, 每个人都有改变事物的能力。在我们这样一个相互依赖的世界中,世界公民意识鼓励我们认识到对彼此的责任,并从对方身上学习。世界公民关心全球的教育、疾病、贫穷和环境问题,让他们拥有对全球社区的归属感。这种不断发展的世界公民意识在很大程度上来讲, 要归功于现代信息、通信和交通技术的力量。世界公民意识致力于给予人们力量, 让他们付诸行动。世界公民除了要从世界问题中学习知识和价值观, 还要拥有必需的技能, 使他们拥有能力和自信,积极推动世界的发展。

     

    Unit2

    The American Dream is a national ethos(精神特质)of the United States. The term is used in many ways,but it essentially is an idea that suggests that anyone in the US can succeed through hard work and has the potential to lead a happy,successful life. Many people have expanded upon or refined the definition to include things such as freedom,fulfillment and meaningful relationships. The idea of an American Dream is older than the US,dating back to the 1600s,when people began to have all sorts of hopes and aspirations for what was a new and largely unexplored continent to European immigrants. And the meaning of the Dream has changed over the course of history,including both personal components and a global vision. But not everybody thinks the American Dream is a positive thing. Some people believe that the structure of society in the US prevents such an idealistic goal for everyone. Critics often point to examples of inequality rooted in class,race,religion and ethnicity that suggest that the American Dream is not attainable for everyone.

    美国梦是美利坚合众国的民族精神。该词有各种各样的用法, 但其根本含义是, 在美国任何人都可以通过努力获得成功, 都有可能过上幸福而成功的生活。许多人美国梦的概念以拓展和提炼,涵盖了像自由、自我实现和深厚的人际关系等方面的内容。美国梦的思想比美国本身更为久远,可以追溯到17 世纪,当时的欧洲移民面对这一新发现的、未经开发的广袤大陆,开始纷纷怀揣希望,追逐梦想。随着历史的发展,美国梦的含义也已改变,既包含了个人元素, 也包含了全局视野。但并不是每个人都对美国梦持肯定态度。一些人认为美国的社会结构决定了不是每个人都能拥有这样的理想目标。批评者常常举以实例, 揭露植根于阶级、种族、宗教和民族的不平等现象,指出美国梦并非每个人都可企及。

     

     

    Unit4

    Venice is the world's famous island city in northern Italy. Founded in the 5th century, Venice became a major maritime power in the 10th century. In the Middle Ages and the Renaissance, Venice was a major center for commerce and trade, and became an extremely wealthy European city, a leader in political and economic affairs. After several hundred years in power, Venice began to decline in the 15th century. Nowadays, it is regarded as one of the world's most beautiful cities and one of the most important tourist destinations in the world. Venice has a rich and diverse architectural style, the most famous of which is the Gothic style.

    Venice is also known for several important artistic movements in history, especially the Renaissance period. The influence of Venice on the development of architecture and arts has been considerable. Today, it is still playing an important role in contemporary arts and popular cultures. In 1987, Venice was listed as a World Heritage Site. In March

    1980, Venice became a sister city of China's Suzhou City.

    威尼斯是意大利北部一座世界闻名的岛城。威尼斯建立于公元5 世纪,在公元10 世纪时成为二支重要的海上力量。在中世纪和文艺复兴时期, 威尼斯曾是重要的商贸中心, 是当时欧洲极为富裕的城市,在政治和经济事务中居领导地位。几百年的兴盛之后,威尼斯在15 世纪开始衰落。如今,威尼斯被公认为是全世界最美的城市之也是全世界最重要的旅游胜地之二。威尼斯的建筑风格丰富多样, 其中最出名的是哥特式风格。威尼斯还因历史上的几次重要的艺术运动而闻名,特别是文艺复兴时期。威尼斯对建筑和艺术的发展影响巨大。至今,威尼斯仍对现代艺术和流行文化的发展起着重要作用。1987 年,威尼斯被列入《世界遗产名录》。1980 年3 月,威尼斯与中国苏州结为“友好城市” 。

     

    Unit5

    The English ceremony of afternoon tea dates back to the 1840s.The tradition evolved out of the rituals and routines that surrounded tea drinking in Britain before that time. Tea was first introduced to England in the late 1650s,but for a long time,it was only consumed by the royal family and the aristocracy due to its high cost. The habit of having afternoon tea did not become established until almost 200 years later. In those days,the British ate only two daily meals: a large breakfast late in the morning and a late dinner around 8 o'clock in the evening. Anna,the 7th Duchess of Bedford,can be credited for creating the tradition of afternoon tea to soothe hunger pangs before supper. She invited friends to join her for an additional afternoon meal at four to five o'clock. The menu included tea and snacks such as dainty cakes and sandwiches. Fine porcelain(瓷器)was used to serve this minor feast. Afternoon tea soon became popular,and is now a symbol of the elegant British way of life. As novelist Henry James wrote,“There are few hours in life more agreeable than the hour dedicated to the ceremony known as afternoon tea.”

    英式下午茶的仪式可以追溯到19 世纪40 年代,该传统是由之前英国的茶饮仪式和习惯发展而来的。茶最初在17 世纪50 年代晚期被引入英国, 但由于价格昂贵, 所以很长一段时间里,只有皇家和贵族才能享用。直到将近200 多年之后, 英国人才养成吃下午茶的习惯。在当时,英国人一日两餐快接近中午时分的丰盛早餐和晚上八点左右的晚餐。据说第七代贝德福德公爵夫人安娜开创了下午茶的传统, 以此来缓解晚餐前的饥饿感。她邀请朋友和她一起在下午

    四五点钟吃下午茶。下午茶中包括茶一些点心, 比如精致的蛋糕及三明治。这些小巧的美食用精美的瓷器盛装。下午茶很快就流行开来,现在已经成为优雅英国生活方式的一个象征。正如小说家亨利·詹姆斯写道的那样: “人生鲜有比全心全意享用下午茶这一仪式更惬意的时刻了。”

     

    Unit8

    The New Year's Concert of the Vienna Philharmonic(爱乐乐团)is a concert of classical music that takes place each year in the morning of New Year's Day in Vienna,Austria. The music always includes pieces from the Strauss family-with occasional additional music from other main Austrian composers. The demand for tickets is so high that people have to pre-register one year in advance in order to participate in the drawing of tickets for the following year. The popularity of the concerts can be attributed to the creative energy of the compositions of the Strauss Dynasty,as well as their authoritative interpretations. These concerts not only delight the audiences in the Musikverein(金色大厅)in Vienna,but also enjoy great international popularity through the worldwide television broadcast,which now reaches over 90 countries. Originating during the darkest chapter in Austria's history,these concerts convey the desire of the Philharmonic not only to provide musically definitive interpretations of the master works of this genre,but at the same time,as musical ambassadors of Austria,to send people all over the world a New Year's greeting in the spirit of hope,friendship and peace.

     

    维也纳爱乐乐团新年音乐会是古典音乐会, 每年元旦上午在奥地利维也纳举行。音乐会通常选取施特劳斯家族的作品, 偶尔也会选取来自奥地利的其他知名作曲家的音乐。新年音乐会的门票一票难求, 人们必须提前一年注册, 才能参与下一年门票的抽签。新年音乐会大受欢迎,这不仅归功于施特劳斯家族作品的创新力, 还要归功于其对音乐的权威诠释。音乐会给维也纳金色大厅中的听众带来了愉悦,在全世界也广受喜爱,现在已经有90 多个国家可以通过电视转播收看。维也纳新年音乐会创始于奥地利历史上最黑暗的时期, 它表达了爱乐乐团对古典音乐经典作品进行诠释的渴望, 同时,本着希望、友谊以及和平的精神, 乐团也希

    望音乐会能成为奥地利的音乐使者,为全球送去音乐祝福。

    展开全文
  • UE4这篇官方文档大体上讲解了UE4本身的诸多特性以及如何编写基本的C++代码,对理解UE4的编程基础内容非常有帮助,还是因为没有对于的汉语翻译。所以,这里我把这篇文档翻译出来,之后还会简洁的对其进行必要的总结。...

    这篇文章开始写的时间比较早,当时还没有官方翻译,不过现在大家可以直接到官方文档查看该文章的汉语翻译了

    UE4这篇官方文档大体上讲解了UE4本身的诸多特性以及如何编写基本的C++代码,对理解UE4的编程基础内容非常有帮助,但是没有对应的汉语翻译。所以,我把这篇文档翻译出来,之后还会对其进行必要的总结。由于内容比较多,会分两个部分进行编写,持续更新~



    Unreal C++ is Awesome!(虚幻4的C++是了不起的)

    This guide is about learning how to write C++ code in Unreal Engine. Do not worry, C++ programming in Unreal Engine is fun, and actually not hard to get started with! We like to think of Unreal C++ as "assisted C++", because we have so many features to help make C++ easier for everyone.

    Before we go on, it is really important that you are already familiar with C++ or another programming language. This page is written with the assumption that you have some C++ experience, but if you know C#, Java, or JavaScript, you should find many aspects familiar.

    If you are coming in with no programming experience at all, we have got you covered also! Check out our Blueprint Visual Scripting guide and you will be on your way. You can create entire games using Blueprint scripting!

    It is possible to write "plain old C++ code" in Unreal Engine, but you will be most successful after reading through this guide and learning the basics about the Unreal programming model. We will talk more about that as we go along.

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    这篇编程指导是讲解如何在虚幻引擎书写C++代码的。并不用担心,虚幻引擎中的C++编程会比你想象的要有趣的多,而且上手难度也并不大。我们认为虚幻的C++是“自动协助的C++”,因为我们有许多让C++用起来更简单的特性来给大家去使用。

    在开始前,你应该至少熟悉C++或者其他任何一门语言,这是非常重要的。这篇文档就假设你有一些C++的编程经验 ,不过如果你了解C#,java或者JavaScript,你也会发现他们都是想相通的。

    如果你之前一点编程经验都没有,那我们也替你考虑到了!去查看一下 蓝图可视化指导(Blueprint Visual Scripting guide),你也可以开始你的UE4旅程了。你完全可以使用UE4提供的蓝图功能做一款游戏,不需要写一行代码!

    在UE引擎里面你可以写原生的C++代码,但是一旦你浏览过这篇文档并学会了UE引擎里的编程模型,你就会收获的更多。接下来我们会讲解更多的内容。

    C++ and Blueprints

    Unreal Engine provides two methods, C++ and Blueprints Visual Scripting, to create new gameplay elements. Using C++, programmers add the base gameplay systems that designers can then build upon or with to create the custom gameplay for a level or the game. In these cases, the C++ programmer works in their favorite IDE (usually Microsoft Visual Studio, or Apple's Xcode) and the designer works in the Unreal Editor's Blueprint Editor.

    The gameplay API and framework classes are available to both of these systems, which can be used separately, but show their true power when used in conjunction to compliment each other. What does that really mean, though? It means that the engine works best when programmers are creating gameplay building blocks in C++ and designers take those blocks and make interesting gameplay.

    With that said, let us take a look at a typical workflow for the C++ programmer that is creating building blocks for the designer. In this case, we are going to create a class that is later extended via Blueprints by a designer or programmer. In this class, we are going to create some properties that the designer can set and we are going to derive new values from those properties. The whole process is very easy to do using the tools and C++ macros we provide for you.

    虚幻引擎提供两种方式两种方式来创建游戏元素,分别是C++和可视化蓝图。使用C++,程序员可以创建一个游戏系统来让设计者在上面给游戏关卡构建或创建游戏内容。这样,C++程序员就可以在他们最喜欢的IDE(一般是Visual Studio和Xcode)里工作,而设计师只在虚幻编辑器里面操作就好了。

    游戏里面的API以及框架相关的类在这两个系统都可以获取到,你可以分开来使用,但是当你将这两个系统结合的时候你才会真正的体会虚幻的强大所在。那么这意味着什么?当程序员创建了游戏的C++代码块并提供给设计师来制作丰富有趣的游戏时,才能发挥虚幻引擎的真正优势。

    既然已经整体的介绍了C++模块,不妨让我们看看C++程序员给设计师创建游戏模块的一个工作流程。这样,我们会创建一个类并让设计师或程序员通过蓝图对其进行扩展。接下来,我们会创建一些属性,设计师可以设置这些属性并产生一些新的值。使用引擎提供的工具和C++的宏,整个流程其实非常简单。

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Class Wizard(类向导)

    First thing we are going to do is use the class wizard within the Unreal Editor to generate the basic C++ class that will be extended by Blueprints later. The image below shows the wizard’s first step where we are creating a new Actor.

    第一件要做的事就是使用虚幻编辑器来说来生成C++的类并在之后用蓝图去拓展。这个图片展示了创建一个新的Actor(后面会介绍Actor,也可以参考链接:UE4碰撞规则详解 的第一条)的第一步。

    image alt text

    The second step in the process tells the wizard the name of the class you want generated. Here's the second step with the default name used.

    第二步是在流程中告诉向导你想要生成的类名。下面是步骤二,使用了默认的名称。

    image alt textOnce you choose to create the class, the wizard will generate the files and open your development environment so that you can start editing it. Here is the class definition that is generated for you. For more information on the Class Wizard, follow this link.

    一旦你选择了创建类,向导就会生成文件并且打开你的开发环境来让你进行编辑。下面是引擎生成类的定义如果想知道更多关于类向导的内容,点击这个链接link.

    #include "GameFramework/Actor.h"
    #include "MyActor.generated.h"
    
    UCLASS()
    class AMyActor : public AActor
    {
        GENERATED_BODY()
    
    public: 
        // Sets default values for this actor's properties
        AMyActor();
        // Called when the game starts or when spawned
        virtual void BeginPlay() override;
    
        // Called every frame
        virtual void Tick( float DeltaSeconds ) override;
    };

    The class wizard generates your class with BeginPlay() and Tick() specified as overloads. BeginPlay() is an event that lets you know the Actor has entered the game in a playable state. This is a good place to initiate gameplay logic for your class. Tick() is called once per frame with the amount of elapsed time since the last call passed in. There you can do any recurring logic. However if you do not need that functionality, it is best to remove it to save yourself a small amount of performance. If you remove it, make sure to remove the line in the constructor that indicated ticking should occur. The constructor below contains the line in question.

    类的向导给你的类生成了BeginPlay()Tick()两个重载函数(分别在游戏开始和每帧循环时调用)。BeginPlay()是触发一个事件,让你知道角色刚刚进入了游戏模式。这个位置很适合你的类来初始化一些数据与逻辑。Tick()就是在上次调用过后每过一小段时间来触发的帧循环事件在这里你可以做任何的循环逻辑处理。不过如果你不需要这两个功能,你可以移除这这个函数并保存为自己的风格。如果你移除了他,确保你移除了构造函数内设置循环是否开启的语句。下面的构造函数包含了问题中描述的这个开关。

    AMyActor::AMyActor()
    
    {
    
        // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you do not need it.
    
        PrimaryActorTick.bCanEverTick = true;
    
    }

    Making a property show up in the editor(生成一个显示在编辑器的属性

    We have our class created, so now let us create some properties that can be set by designers in the Unreal Editor. Exposing a property to the editor is quite easy using our special macro, UPROPERTY(). All you have to do is use the UPROPERTY(EditAnywhere) macro before your property declaration as seen in the class below.

    我们现在已经创建了自己的类,接下来要创建一些可以在虚幻编辑器设置的一些属性。通过使用引擎提供的宏( UPROPERTY())来将一个属性显示在编辑器其实很简单。你所需要做的就是将宏 UPROPERTY(EditAnywhere) 声明在属性的前面。

    UCLASS()
    class AMyActor : public AActor
    {
        GENERATED_BODY()
    
        UPROPERTY(EditAnywhere)
        int32 TotalDamage;
    
        ...
    };

    That is all you need to do to be able to edit that value in the editor. There are more ways to control how and where it is edited. This is done by passing more information into the UPROPERTY() macro. For instance, if you want the TotalDamage property to appear in a section with related properties, you can use the categorization feature. The property declaration below shows this.

    想在编辑器里面编辑这个属性,这么做就足够了。不过有更多的方式去控制如何以及在哪里去编辑他。想实现这些效果就在宏 UPROPERTY()里面添加更多的参数就可以了。举例来说,如果你想 TotalDamage 属性 出现在一个里面含有很多相关联属性的模块,你可以使用分类特性。属性的声明如下所示。(所有Category=“Damage”的属性都会被归为一个名为Damage的分支里面)

    UPROPERTY(EditAnywhere, Category="Damage")
    int32 TotalDamage;

    When the user looks to edit this property, it now appears under the Damage heading along with any other properties that you have marked with this category name. This is a great way to place commonly used settings together for editing by designers.

    Now let us expose that same property to Blueprints.

    当用户去查看并编辑该属性时,他就会出现在Damage标题的分类下面,同时你也会看到其他你标记过的分类标题。对于设计师来说,这是一个非常好的将常用属性分类的方式。

    下面我们换个写法同样将这个属性添加进去。

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
    int32 TotalDamage;

    As you can see, there is a Blueprint specific parameter to make a property available for reading and writing. There's a separate option, BlueprintReadOnly, you can use if you want the property to be treated as const in Blueprints. There are quite a few options available for controlling how a property is exposed to the engine. To see more options, follow this link.

    Before continuing to the section below, let us add a couple of properties to this sample class. There is already a property to control the total amount of damage this actor will deal out, but let us take that further and make that damage happen over time. The code below adds one designer settable property and one that is visible to the designer but not changeable by them.

    正如你所看到的,宏里面有一个特定的蓝图参数来让属性可以阅读和编辑。这个位置也可以换成另外一个参数,BlueprintReadOnly,如果想要你的属性在蓝图里面是const常量你就可以使用这个参数。当然,虚幻还提供了许多的参数来决定你的属性以什么样的方式显示在引擎中。想看到更多的参数选项,点击这个链接link.

    UCLASS()
    class AMyActor : public AActor
    {
        GENERATED_BODY()
    
        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
        int32 TotalDamage;
    
        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
        float DamageTimeInSeconds;
    
        UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Transient, Category="Damage")
        float DamagePerSecond;
    
        ...
    };
    
    DamageTimeInSeconds is a property the designer can modify. The DamagePerSecond property is a calculated value using the designer's settings (see the next section). The VisibleAnywhere flag marks that property as viewable, but not editable in the Unreal Editor. The Transient flag means that it won't be saved or loaded from disk; it is meant to be a derived, non-persistent value. The image below shows the properties as part of the class defaults.

    image alt text

    Setting defaults in my constructor(在构造函数里面设置默认值)

    Setting default values for properties in a constructor works the same as your typical C++ class. Below are two examples of setting default values in a constructor and are equivalent in functionality.

    给属性设置默认值和平时的C++类操作一样。下面是两种在构造函数里面设置默认值例子并且在功能上是相同的。(不过对C++有一定理解的朋友知道,第二种列表初始化省去了拷贝的操作,对于类类型的初始化效率要高)

    AMyActor::AMyActor()
    {
        TotalDamage = 200;
        DamageTimeInSeconds = 1.f;
    }
    
    AMyActor::AMyActor() :
        TotalDamage(200),
        DamageTimeInSeconds(1.f)
    {
    }

    Here is the same view of the properties after adding default values in the constructor.

    下面是在构造器里面添加默认值后的效果图。

    image alt text

    In order to support per instance designer set properties, values are also loaded from the instance data for a given object. This data is applied after the constructor. You can create default values based off of designer set values by hooking into the PostInitProperties() call chain. Here is an example of that process where TotalDamage and DamageTimeInSeconds are designer specified values. Even though these are designer specified, you can still provide sensible default values for them, as we did in the example above.

    为了使设计师可以随时修改每一个实例的值,这些值也会在一个类的实例构建完成后被及时加载。这些数据在构造函数执行后被提交。你可以通过关联到函数PostInitProperties(),创建一个新的基于之前已经有的属性而计算出来的值。下面是一个例子,该例子里面的 TotalDamage DamageTimeInSeconds是由关卡设计师来设计编辑的。即使这些值是由设计师来决定的,你仍可以像我们在上述例子中那样给他设置默认值。

    If you do not provide a default value for a property, the engine will automatically set that property to zero or nullptr in the case of pointer types.

    如果你不给一个属性提供默认值,引擎就会自动的给他设置为0或nullptr(如果是指针类型的话)。

    void AMyActor::PostInitProperties()
    {
        Super::PostInitProperties();
        DamagePerSecond = TotalDamage / DamageTimeInSeconds;
    }

    Here again is the same view of the properties after we have added the PostInitProperties() code that you see above.

    在添加了上述的代码PostInitProperties后,就会像下面一样显示属性视图。

    image alt text

    Hot Reloading(热加载)

    Here is a cool feature of Unreal that you might be surprised about if you are used to programming C++ in other projects. You can compile your C++ changes without shutting down the editor! There are two ways to do this:

    下面要展示虚幻引擎一个非常酷的特性,如果你在其他的工程中使用过C++编程的话,你肯定会大吃一惊。那就是你可以在不关闭编辑器的同事重新编译C++工程!有两种方式去做:

    1. With the editor still running, go ahead and Build from Visual Studio or Xcode like you normally would. The editor will detect the newly compiled DLLs and reload your changes instantly! your changes instantly! your changes instantly! your changes instantly! your changes instantly!                                                                                                                                                  在编辑器运行的时候,就像你在VS或Xcode平时那样编译的操作一样。编辑器会察觉到新的需要编译的DLL并且立刻重新加载修改的代码!随时编译修改的代码!       

      image alt text

      (Note that if you are attached with the debugger, you'll need to detach first so that Visual Studio will allow you to Build.提示一下,如果你是正在调试,你得先将调断开这样VS才能允许你重新编译)

    2. Or, simply click the Compile button on the editor's main toolbar.

      image alt text

           或者简单的在编辑器里面点击Compile按钮。

    You can use this feature in the sections below as we advance through the tutorial. What a time saver!

    你可以在接下来的教学中使用这个特性。这无疑会大大节省你的时间!

    Extending a C++ Class via Blueprints(通过蓝图拓展你的C++类)

    So far, we have created a simple gameplay class with the C++ Class Wizard and added some properties for the designer to set. Let us now take a look at how a designer can start creating unique classes from our humble beginnings here.

    First thing we are going to do is create a new Blueprint class from our AMyActor class. Notice in the image below that the name of the base class selected shows up as MyActor instead of AMyActor. This is intentional and hides the naming conventions used by our tools from the designer, making the name friendlier to them.

    目前为止,我们已经通过C++类向导创建了一个简单的游戏类并且添加了一些可以设置的属性。下面我们看看一个设计师怎样通过最简单的C++类来在蓝图中拓展出一个独特的类。

    image alt text

    Once you choose Select, a new, default named Blueprint class is created for you. In this case, I set the name to CustomActor1 as you can see in the snapshot of the Content Browser below.

    一旦你点击了select按钮,一个新的默认的名为Blueprint的类就会被创建。这里,我设置类的名字为 CustomActor1,你可以在内容浏览窗口里面看到该文件的快照。

    image alt text

    This is the first class that we are going to customize with our designer hats on. First thing we are going to do is change the default values for our damage properties. In this case, the designer changed the TotalDamage to 300 and the time it takes to deliver that damage to 2 seconds. This is how the properties now appear.

    这是第一个我们将要给设计师订制的类。第一件事就是去改变我们damage属性的默认值。从下面来看,设计师把TotalDamage改为300并且递交的时间改为两秒。属性现在显示的就如下面这样。

    image alt text

    Our calculated value does not match what we would expect. It should be 150 but it is still at the default value of 200. The reason for this is that we are only calculating our damage per second value after the properties have been initialized from the loading process. Runtime changes in the Unreal Editor are not accounted for. There is a simple solution to this problem because the engine notifies the target object when it has been changed in the editor. The code below shows the added hooks needed to calculate the derived value as it changes in the editor.

    我们计算的值与我们期待的结果并不匹配。他应该是150但是显示的却仍是200。造成这样的原因是我们只在属性初始化之后计算了我们每秒的伤害。运行时的改变在虚幻引擎中并没有被及时捕获。下面有一个简单的解决方式,原理是引擎会在属性被修改时进行目标的标记。下面的代码添加了一个关联hook,当编辑器里面属性值改变时添加的就会关联的计算派生的值。

    void AMyActor::PostInitProperties()
    {
        Super::PostInitProperties();
    
        CalculateValues();
    }
    
    void AMyActor::CalculateValues()
    {
        DamagePerSecond = TotalDamage / DamageTimeInSeconds;
    }
    
    #if WITH_EDITOR
    void AMyActor::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
    {
        CalculateValues();
    
        Super::PostEditChangeProperty(PropertyChangedEvent);
    }
    #endif

    One thing to note is that the PostEditChangeProperty() method is inside an editor specific #ifdef. This is so that building your game only the code that you need for the game, removing any extra code that might increase the size of your executable unnecessarily. Now that we have that code compiled in, the DamagePerSecond value matches what we would expect it to be as seen in the image below.

    有一点需要注意,PostEditChangeProperty()这个方法在编辑器需要用#ifdef来标记。这么写的原因就是在你的游戏需要这样的代码时才编译,移除任何多余的代码会提升你执行不必要的功能的效率(了解C++的朋友都知道这是预编译,网上讲解的博客有很多)。由于我们已经将代码编译完成,下面图片里的DamagePerSecond 属性已经和我们所预期的一样了。

    image alt text

    Calling Functions across the C++ and Blueprint Boundary(通过C++和蓝图内部调用函数)

    So far, we have shown how to expose properties to Blueprints, but there is one last introductory topic that we should cover before you dive deeper into the engine. During the creation of the gameplay systems, designers will need to be able to call functions created by a C++ programmer as well as the gameplay programmer calling functions implemented in Blueprints from C++ code. Let us start by first making the CalculateValues() function callable from Blueprints. Exposing a function to Blueprints is just as simple as exposing a property. It takes only one macro placed before the function declaration! The code snippet below show what is needed for this.

    目前来看,我们已经展示了如何把属性公开显示给蓝图,但是在你深入引擎之前还有最后一个提示我们应该注意。在整个游戏系统的创建期间,设计师需要能调用C++工程师创建的函数同时也能在继承于 由C++类创建的蓝图 中调用函数。现在让我们从调用蓝图的CalculateValues()函数开始。将一个方法暴露给蓝图其实和将一个属性暴露给蓝图一样简单。只要在函数前面加上宏的声明即可!下面的代码段展示了我们需要做的操作。

    UFUNCTION(BlueprintCallable, Category="Damage")
    void CalculateValues();

    The UFUNCTION() macro handles exposing the C++ function to the reflection system. The BlueprintCallable option exposes it to the Blueprints Virtual Machine. Every Blueprint exposed function requires a category associated with it, so that the right click context menu works properly. The image below shows how the category affects the context menu.

    UFCTION()宏将C++的函数句柄传递给了UE4的反射系统。蓝图唤醒选项又将他传递给蓝图的虚拟机系统。每一个蓝图暴露其方法都需要一个相关联的种类,所以右键点击显示的目录菜单才能正确的工作。下面的图片展示类型如何影响目录菜单的。

    image alt text

    As you can see, the function is selectable from the Damage category. The Blueprint code below shows a change in the TotalDamage value followed by a call to recalculate the dependent data.

    正如你所见,这个函数可以从Damage种类中选取。下面的蓝图代码展示了通过调用重计算关联数据的方法来改变TotalDamage 的数值。

    image alt text

    This uses the same function that we added earlier to calculate our dependent property. Much of the engine is exposed to Blueprints via theUFUNCTION() macro, so that people can build games without writing C++ code. However, the best approach is to use C++ for building base gameplay systems and performance critical code with Blueprints used to customize behavior or create composite behaviors from C++ building blocks.

    这和我们先前添加的计算关联属性的方法是相同的。引擎中大部分的函数都是通过UFCTION()宏展示给蓝图的。所以人们就不用写C++代码就可以构建游戏。然而,最好的实现操作是使用C++构建整个游戏系统然后使用蓝图来表现游戏的具体行为或者通过C++构建的模块再创建复杂一点的操作。

    Now that our designers can call our C++ code, let us explore one more powerful way to cross the C++/Blueprint boundary. This approach allows C++ code to call functions that are defined in Blueprints. We often use the approach to notify the designer of an event that they can respond to as they see fit. Often that includes the spawning of effects or other visual impact, such as hiding or unhiding an actor. The code snippet below shows a function that is implemented by Blueprints.

    既然我们的设计师已经能调用C++的代码了,不妨来找一个更强大的方法来进行蓝图与C++的交互。这个方法允许C++代码调用蓝图定义的方法。我们通常使用这个方法来给设计师,他们觉得合适就可以去编写该事件的响应内容。一般,这包括特效的生成以及其他可见的效果,如隐藏或显示一个actor。下面的代码片段展示了一个被蓝图继承实现的函数。

    UFUNCTION(BlueprintImplementableEvent, Category="Damage")
    void CalledFromCpp();

    This function is called like any other C++ function. Under the covers, the Unreal Engine generates a base C++ function implementation that understands how to call into the Blueprint VM. This is commonly referred to as a Thunk. If the Blueprint in question does not provide a function body for this method, then the function behaves just like a C++ function with no body behaves: it does nothing. What if you want to provide a C++ default implementation while still allowing a Blueprint to override the method? The UFUNCTION() macro has an option for that too. The code snippet below shows the changes needed in the header to achieve this.

    这个函数调用起来和其他函数一样。虚幻引擎生成一个C++函数的实现并且他知道该如何调用到蓝图的虚拟机。这通常涉及到形式转换。如果蓝图给没有给这个方法提供一个函数体,那么这个函数就会如C++函数所写的那样:什么也不做。如果你想提供一个C++的默认的实现而且还允许蓝图重载这个方法改怎么做?UFCTION()宏也有一个对应的选项。下面的代码段展示了要实现这个效果的代码改动。

    UFUNCTION(BlueprintNativeEvent, Category="Damage")
    void CalledFromCpp();

    This version still generates the thunking method to call into the Blueprint VM. So how do you provide the default implementation? The tools also generate a new function declaration that looks like _Implementation(). You must provide this version of the function or your project will fail to link. Here is the implementation code for the declaration above.

    这个版本仍然会生成形式转换的方法来调用蓝图的虚拟机。所以你怎么给函数提供默认的声明呢?虚幻引擎的工具本身也会生成一个像_Implementation的函数声明。所以你必须再提供这个版本的函数实现否则你的工程就会出现链接失败的错误。下面时这个声明的实现代码。

    void AMyActor::CalledFromCpp_Implementation()
    {
        // Do something cool here
    }

    Now this version of the function is called when the Blueprint in question does not override the method. One thing to note, is that in future versions of the build tools the auto generated _Implementation() declaration will go away and you'll be expected to explicitly add that to the header. As of version 4.7, the auto generation of that declaration still occurs.

    如果蓝图没有覆盖这个函数,这个默认的版本就会被调用。有一点需要注意,之后的版本的构建工具将不会自动生成generated _Implementation()并且需要你准确的自己手动添加。在4.7版本中,这个自动的生成功能仍然会保留。

    Now that we have walked through the common gameplay programmer workflow and methods to work with designers to build out gameplay features, it is time for you to choose your own adventure. You can either continue with this document to read more about how we use C++ in the engine or you can jump right into one of our samples that we include in the launcher to get a more hands on experience.

    既然我们已经浏览了一般游戏程序编写的工作流程以及给设计师提供构建游戏特性的方法,那么现在是时候选择你接下来要了解的内容了。你可以继续浏览这个文档来获取更多的关于C++在引擎中的使用内容,你也可以跳到例子程序部分来获得更多的实际操作经验。

    Diving Deeper(深入引擎)

    I see you are still with me on this adventure. Excellent. The next topics of discussion revolve around what our gameplay class hierarchy looks like. In this section, we'll start with the base building blocks and talk through how they relate to each other. This is where we'll look at how the Unreal Engine uses both inheritance and composition to build custom gameplay features.

    你现在仍然跟随我的讲解去看这篇文档,这非常棒!那么下一个话题是关于我们游戏类的层级结构的。在这一部分,我们将会从几个主要的模块开始并详细说明他们之间是如何关联的。我们在这里会看到虚幻引擎是怎样使用继承和合成来构建出针对游戏的特性与操作。
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------

    Gameplay Classes: Objects, Actors, and Components

    There are 4 main class types that you derive from for the majority of gameplay classes. They are UObjectAActorUActorComponent, and UStruct. Each of these building blocks are described in the following sections. Of course, you can create types that do not derive from any of these classes, but they will not participate in the features that are built into the engine. Typical use of classes that are created outside of the UObject hierarchy are: integrating 3rd party libraries; wrapping of OS specific features; etc.

    在所有的和游戏进行相关的类里面(gameplay),有四个主要的基类来让你去继承,分别是UObject,AActor,UActorComponent,UStruct,他们几乎涵盖了所有的游戏内容。接下来会逐个对每个部分进行描述。当然,你完全可以创建一个不继承于上述任何的类的类。但是这样的话,你的类就不能实现引擎独有的一些特性。一些典型的没有使用UObject的类如下所示:第三方的库,一些系统特性封装的包等。
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------

    Unreal Objects (UObject)

    The base building block in the Unreal Engine is called UObject. This class, coupled with UClass, provides a number of the most important base services in the engine:

    • Reflection of properties and methods

    • Serialization of properties

    • Garbage collection

    • Finding UObjects by name

    • Configurable values for properties

    • Networking support for properties and methods

    Each class that derives from UObject has a singleton UClass created for it that contains all of the meta data about the class instance. UObject and UClass together are at the root of everything that a gameplay object does during its lifetime. The best way to think of the difference between a UClass and a UObject is that the UClass describes what an instance of a UObject will look like, what properties are available for serialization, networking, etc. Most gameplay development does not involve directly deriving from UObjects, but instead from AActor and UActorComponent. You do not need to know the details of how UClass/UObject works in order to write gameplay code, but it is good to know that these systems exist.

    虚幻引擎构建的基础模块是UObject。这个类与UClass一同合作可以给引擎提供许多重要有基础的服务。

     ●属性和方法的反射
     ●属性的序列化
     ●垃圾回收
     ●通过名字找到UObject
     ●可以配置的属性值
     ●属性与方法的网络支持

    每一个继承自UObject的类都有一个匹配的UClass宏,他包含了所有该类实例相关的数据与代码。UObject和UClass二者在游戏对象生命周期中是一切的基础。区别二者最好的方式就是UClass描述了一个UObject实例的样子,有什么特性可以用于序列化及网络传输。大部分的游戏开发不会直接涉及到UObject,反而AActor和UActorComponent会被大量使用。你并不需要很清楚UObject和UClass在代码里面是如何工作的但是有必要知道他们的存在。

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------

    AActor

    An AActor is an object that is meant to be part of the gameplay experience. AActors are either placed in a level by a designer or created at runtime via gameplay systems. All objects that can be placed into a level extend from this class. Examples include AStaticMeshActor,ACameraActor, and APointLight actors. AActor derives from UObject, so enjoys all of the standard features listed in the previous section. AActors can be explicitly destroyed via gameplay code (C++ or Blueprints) or via the standard garbage collection mechanism when the owning level is unloaded from memory. AActors are responsible for the high-level behaviors of your game's objects. AActors are also the base type that can be replicated during networking. During network replication, AActors can also distribute information for any UActorComponents owned by that AActor that require network support.

    AActors have their own behaviors (specialization through inheritance), but they also act as containers for a hierarchy of UActorComponents (specialization through composition). This is done through the AActor's RootComponent member, which contains a single UActorComponent that, in turn, can contain many others. Before an AActor can be placed in a level, that AActor must contain at least a USceneComponentwhich contains the translation, rotation, and scale for that AActor.

    AActors have a series of events that are called during the lifecycle of the AActor. The list below is a simplified set of the events that illustrate the lifecycle.

    • BeginPlay - called when the object first comes into gameplay existence

    • Tick - called once per frame to do work over time

    • EndPlay - called when the object is leaving the gameplay space

    See Actor for a more detailed discussion on AActor.

    一个Actor是游戏进行中的一个实际存在的对象。Actor类既可以通过设计师在场景中创建也可以通过游戏系统在运行时创建。所有的对象都可以通过拓展后被放到一个关卡中。比如 AStaticMeshActor(静态网格Actor),ACameraActor(相机), and APointLight(点光源)等。Actor继承自UObject,所以Actor享有前面列举的所有Uobject的特性。Actor类型可以通过C++与蓝图精确的销毁,也可以在关卡卸载时被垃圾回收机制自动销毁。Actor本身负责游戏对象的高层次的行为,同时也是网络传输中被复制的主要类型。在网络中,只要Actor自身的ActorComponent组件需要网络支持,Actor就可以给其提供足够的信息。

    Actor拥有他们自己的行为(尤其是通过继承),但同时他们也扮演者UActorComponent的容器的角色(尤其是通过组合)。这个是通过Actor的根节点成员来实现的,根节点本身可以包含其他的UActorComponent组件。既然Actor需要放在一个关卡中,那么他就必须包含一个USceneComponent组件来记录他的运动位置,旋转,大小比例。

    Actor在他的生命周期中有一系列可以触发的事件。下面简单的列举了几个例子:

    • BeginPlay - 当Actor第一次以实体进入场景中时触发

    • Tick -在场景中的每一帧都触发

    • EndPlay -当Actor实体离开场景(被销毁等)触发

    查看Actor 来浏览更多相关的信息,


    ---------------------------------------------------------------------------------------------------------------------------------------------------------------

    Runtime Lifecycle(运行时生命周期)

    Just above we discussed a subset of an AActor's lifecycle. For actors that are placed in a level, understanding the lifecycle is pretty easy to imagine: actors are loaded and come into existence and eventually the level is unloaded and the actors are destroyed. What is the process for runtime creation and destruction? Unreal Engine calls the creation of an AActor at runtime spawning. Spawning an actor is a bit more complicated than creating a normal object in the game. The reason is that an AActor needs to be registered with a variety of runtime systems in order to serve all of its needs. The initial location and rotation for the actor need to be set. Physics may need to know about it. The manager responsible for telling an actor to tick needs to know. And so on. Because of this, we have a method devoted to the spawning of an actor, UWorld::SpawnActor(). Once that actor is spawned successfully, its BeginPlay() method is called, followed by Tick() the next frame.

    我们上面刚刚讨论了一个Actor的生命周期的一部分。对于存在于关卡当中的actor,他的生命周期还是比较容易理解的:actor一开始被加载到场景里面并且在场景卸载的时候被销毁。那么在运行时的创建和销毁流程是什么样的呢?虚幻引擎在运行时执行spawning(生成)时调用actor的创建方法。生成一个actor比在游戏同创建一个object对象复杂一点。原因就是actor需要被注册到一系列的运行时系统来满足自身的需求。actor的位置和朝向需要一开始就被初始化。物理模块也需要了解他的相关信息。管理器需要负责告诉一个actor在tick时需要知道哪些东西。这些都需要actor与运行时系统紧密相连。既然我们不得不这么做,引擎肯定就会提供一个生成actor的方法,那就是UWorld::SpawnActor()。一旦生成执行成功,他的方法BeginPlay()就会被调用,接下来就会下一帧执行Tick事件。

    Once an actor has lived out its lifetime, you can get rid of it by calling Destroy(). During that process EndPlay() will be called where you can do any custom logic for destruction. Another option for controlling how long an actor exists is to use the Lifespan member. You can set a timespan in the constructor of the object or with other code at runtime. Once that amount of time has expired, the actor will automatically have Destroy() called on it.

    To learn more about spawning actors see the 生成 Actors page.

    一旦一个actor离开了他的生命周期,你可以通过调用Destroy()方法来销毁他。在这个过程中,EndPlay() 将会被调用,你可以在里面写任何和销毁相关的客户逻辑。另一种来控制actor生存时间的方法就是使用Lifespan(生存时间)成员。你可以在object的构造器或者在其他的代码里设置一个时间间隔。一旦这个时间耗尽,这个actor就会自动的调用Destroy()方法。

    想知道更多关于生存actor的内容请参考生成 Actors 页面。

    UActorComponent(Actor组件)

    UActorComponents have their own behaviors and are usually responsible for functionality that is shared across many types of AActors, e.g. providing visual meshes, particle effects, camera perspectives, and physics interactions. While AActors are often given high-level goals related to their overall roles your game, UActorComponents usually perform the individual tasks that support those higher-level objectives. Components can also be attached to other Components, or can be the root Component of an Actor. A Component can only attach to one parent Component or Actor, but it may have many child Components attached to itself. Picture a tree of Components. Child Components have location, rotation, and scaling relative to their parent Component or Actor.

    While there are many ways to use Actors and Components, one way to think of the Actors-Component relationship is that Actors might answer the question "what is this thing?" while Components might answer "what is this thing made of?"

    • RootComponent - this is the member of AActor that holds the top level Component in the AActor's tree of Components

    • Ticking - Components are ticked as part of the owning AActor's Tick()

    UActorComponents 有他们自己的行为并且通常负责分享多种actor的特有功能。例如,提供可见的网格实体,粒子效果,摄像机视角以及物理交互等。如果说actor在游戏中通常被赋予其相关角色高层次的任务和目标,那么每个ActorComponent就是表现自己独立的效果和任务从而支持那些高层次的目标。组件可以和组件相关联,也可以成为一个actor的根节点。一个组件只能挂在一个组件或者一个actor下面,但是他自身可以挂任意数量的组件。这个感觉就像是一个有组件而构成的树。子组件有位置,朝向,大小等信息,这些信息被关联到他的父组件和父actor(注意:这里所说的父组件只是单纯的从数据结构的方式来描述其位置关系,并不是C++里面的继承关系

    有很多使用actor和Component的方式,其中一种理解Actors-Component关系的方式就是Actor会解释“这是什么?”而Component会解释“这由什么组成”
    • 根组件 - 这是actor的根节点成员,下面关联着actor整棵子树 

    • Ticking - 组件作为其附属actor的成员也会随着actor的ticking来进行自己的tick


    Dissecting the First Person Character(剖析第一人称角色)

    Over the last few sections we have done a lot of talking and not a lot of showing. In order to illustrate the relationship of an AActor and its UActorComponents, let us dig into the Blueprint that is created when you generate a new project based off of the First Person Template. The image below is the Component tree for the FirstPersonCharacter Actor. The RootComponent is the CapsuleComponent. Attached to the CapsuleComponent is the ArrowComponent, the Mesh component, and the FirstPersonCameraComponent. The leaf most component is the Mesh1P component which is parented to the FirstPersonCameraComponent, meaning that the first person mesh is relative to the first person camera.

    之前的几个部分谈论的较多,展示的较少。为了说明 AActor 和其 UActorComponent 之间的关系,我们来研究基于第一人称模板创建新项目时创建的蓝图。下图是FirstPersonCharacter Actor 的组件树。根节点RootComponent 为 CapsuleComponent。附着到 CapsuleComponent 的是 ArrowComponentMesh 组件和FirstPersonCameraComponent。叶最多的组件是以 FirstPersonCameraComponent 为父节点的 Mesh1P 组件,意味着第一人称网格体与第一人称摄像机关系是相对的。

    image alt text

    Visually, this tree of Components looks like the image below, where you see all of the components in 3D space except for the Meshcomponent.

    从可是的效果来看,组件树展示的就如下面的图片一样,可看到除 Mesh 组件外的所有组件均在 3D 空间中。

    image alt text

    This tree of components is attached to the one actor class. As you can see from this example, you can build complex gameplay objects using both inheritance and composition. Use inheritance when you want to customize an existing AActor or UActorComponent. Use composition when you want many different AActor types to share the functionality.

    此组件树被附着到一个 actor 类。正如在此例中所见到的 - 你可以使用继承和合成来构建复杂的游戏对象。想要对现有 AActor 或 UActorComponent 进行自定义时需要使用继承。想要多个不同 AActor 类型共享功能时要使用合成。

    UStruct

    To use a UStruct, you do not have to extend from any particular class, you just have mark the struct with USTRUCT() and our build tools will do the base work for you. Unlike a UObject, UStructs are not garbage collected. If you create dynamic instances of them, you must manage their lifecycle yourself. UStructs are meant to be plain old data types that have the UObject reflection support for editing within the Unreal Editor, Blueprint manipulation, serialization, networking, etc.

    Now that we have talked about the basic hierarchy used in our gameplay class construction, it is time to choose your path again. You can read about our gameplay classes here, head out to our samples in the launcher armed with more information, or continue digging deeper into our C++ features for building games.

    要使用虚幻4提供的一个结构体UStruct,你不需要从任何具体的类里面扩展,只要在结构体前面只需要使用 USTRUCT() 标记,编译工具就会执行基础工作。与UOBject不同,UStruct没有垃圾回收机制。如果你创建一个动态的实例,那么你必须要自己控制好他的生命周期。UStruct 为纯旧式数据类型。它们拥有 UObject 反射支持,以便在虚幻编辑器、蓝图操作、序列化和网络通信中进行编辑。

    到此为止,我们已经讨论了游戏性类构建中使用的基础层级。下面你可以再次选择你的学习路线。你可以在 此处 阅读关于游戏性类的内容、使用 launcher 中带有更多信息的例子、或进一步深入研究构建游戏的 C++ 特性。

    展开全文
  • 大连交通大学2016届本科生毕业设计(论文)外文翻译外文原文2.5 Paging in LinuxLinux adopts a common paging model that fits both 32-bit and 64-bit architectures. As explained in the earlier section "Paging ...

    大连交通大学2016届本科生毕业设计(论文)外文翻译外文原文2.5 Paging in LinuxLinux adopts a common paging model that fits both 32-bit and 64-bit architectures. As explained in the earlier section "Paging for 64-bit Architectures" two paging levels are sufficient for 32-bit architectures, while 64-bit architectures require a higher number of paging levels. Up to version 2.6.10, the Linux paging model consisted of three paging levels. Starting with version 2.6.11, a four-level paging model has been adopted. The four types of page tables illustrated in Figure 2-12 are called:This change has been made to fully support the linear address bit splitting used by the x86_64 platform (see Table 2-4)

    Page Global DirectoryPage Upper DirectoryPage Middle DirectoryPage Table

    The Page Global Directory includes the addresses of several Page Upper Directories, which in turn include the addresses of several Page Middle Directories, which in turn include the addresses of several Page Tables. Each Page Table entry points to a page frame. Thus the linear address can be split into up to five parts. Figure 2-12 does not show the bit numbers, because the size of each part depends on the computer architecture.

    For 32-bit architectures with no Physical Address Extension, two paging levels are sufficient.Linux essentially eliminates the Page Upper Directory and the Page Middle Directory fields by saying that they contain zero bits. However, the positions of the Page Upper Directory and the Page Middle Directory in the sequence of pointers are kept so that so that the same code can work on 32-bit and 64-bit architectures. The kernel keeps a position for the Page Upper Directory and the Page Middle Directory by setting the number of entries in them to 1 and mapping these two entries into the proper entry of the Page Global Directory.For 32-bit architectures with the Physical Address Extension enabled, three paging levels are used. The Linux's Page Global Directory corresponds to the 80*86's Page Directory Pointer

    展开全文
  • AssertionError: In PaddlePaddle 2.x, we turn on dynamic graph mode by default, and 'data()' is only supported in static graph mode. So if you want to use this api, please call ' ' before this api to ...
  • turn over/turn around/turn up等动词词组

    千次阅读 2020-08-26 20:00:54
    本博文讲述treat to/treat with/trust to/trust with/try on /try out/turn away(from)/turn back/turn down/turn off/turn on/turn out/turn over/turn around/turn up等动词词组
  • 大学英语综合教程一 Unit 4 课文内容英译中 中英翻译   大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址为:亓官劼的博客 本文原创为亓官劼,请...
  • 大学英语综合教程三 Unit 6 课文内容英译中 中英翻译   大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址为:亓官劼的博客 本文原创为亓官劼,请...
  • 大学英语综合教程三 Unit 1至Unit 8课文内容英译中 中英翻译   大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址为:亓官劼的博客 本文原创为亓官劼...
  • 大学英语综合教程四 Unit 7 课文内容英译中 中英翻译   大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址为:亓官劼的博客 本文原创为亓官劼,请...
  • 大学英语综合教程三 Unit 5 课文内容英译中 中英翻译   大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址为:亓官劼的博客 本文原创为亓官劼,请...
  • The idea of becoming a writer had come to me off and on since my childhood in Belleville, but it wasn't until my third year in high school that the possibility took hold. Until then I'd been bored by
  • 原标题:翻译硕士MTI词条翻译经常用到的成语(中英对照)名山大川famous mountains and great rivers名胜古迹scenic spotsand historical sites湖光山色landscape of lakes and hills青山绿水green hills and clear ...
  • 版权声明:本文为博主原创翻译,如需转载请注明出处。 苹果源文档地址 - 点击这里 About AVFoundation - AVFoundation概述 AVFoundation is one of several frameworks that you can use to play ...
  • 大学英语综合教程二 Unit 4 课文内容英译中 中英翻译   大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址为:亓官劼的博客 本文原创为亓官劼,请...
  • # return states in the training model, but we will use them in inference. decoder_lstm = LSTM(latent_dim, return_sequences=True, return_state=True) decoder_outputs, _, _ = decoder_lstm(decoder_inputs,...
  • 基于生成的方法使用编码器解码框架来生成响应,这与机器翻译类似。 定义任务:给定上下文C、当前查询Q、候选答案R,建模预测候选答案是正确答案的概率 score = g(C, Q, R) 四个层次:context、utterances、words、...
  • 大学英语综合教程三 Unit 4 课文内容英译中 中英翻译   大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址为:亓官劼的博客 本文原创为亓官劼,请...
  • 翻译☞http://www.html5rocks.com/en/tutorials/webrtc/infrastructure/   !WebRTC中文社区原创,转载请注明出处,谢谢,水平有限,部分意思可能不到位,建议参考英文原帖! WebRTC 可以p2p视频通话
  • Everything in Gradle sits on top of two basic concepts: projects and tasks. 任何一个Gradle构建都是由一个或多个项目组成。一个项目代表着什么,取决于你想通过Gradle来做什么。比如,一个项目可能代表着一个...
  • 大学英语综合教程二Unit 1 课文内容英译中 中英翻译   大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址为:亓官劼的博客 本文原创为亓官劼,请大家...
  • 配置TURN服务器实现NAT穿透

    千次阅读 2019-07-07 20:07:31
    我在刚接触TURN时的一些疑问 搭建TURN服务器 如何测试我的TURN服务器是否成功运行? 解决ICE问题过程中遇到的另一个问题 最近使用WebRTC传输媒体流时,接收端已经成功收到了发送端发来的offer,并且传回的...
  • AssertionError: In PaddlePaddle 2.x, we turn on dynamic graph mode by default, and 'data()' is only supported in static graph mode. So if you want to use this api, please call 'paddle.enable_static()'...
  • There's a fire starting in my heart 我怒火中烧 Reaching a fever pitch and it's bringing me out the dark 熊熊烈焰带我走出黑暗 Finally, I can see you crystal clear 最终 我将你看得一清二楚 Go ahead ...
  • 最近学习UE4的使用,发现这篇官方文档没有中文翻译,就想着翻译一下给大家参考参考吧。由于水平有限,里面一些翻译掺杂了我个人的理解,如果有任何问题欢迎提出,我会及时修改的~同时这里需要声明一点,官方的中文...
  • 本人经过多次整理,将很多翻译的文档综合成目前我认为 是比较全的文档贡献给大家,同时我提醒各位在课本上也附录了许多翻译,不要忘记查看呀A program instruction or a piece of data is stored in a specific primary...
  •  This section discusses each the of modules in turn. The Core package is the most fundamental part of the framework and provides the Dependency Injection features allowing you to manage bean ...
  • 版权声明:本文为博主原创翻译,如需转载请注明出处。 苹果源文档地址 - 点击这里 Playback - 播放 To control the playback of assets, you use an AVPlayer object. During playback, you can use ...
  • Unit 10 - The Fantastic Spurt in Technology Alvin Toffler writes about the fact that technology is advancing much faster today than ever before in history. The symbols of technology are no longer ...
  • It’s impossible.” That is ok, because we just turn off. As I said earlier I hear the “no” being a “yes”, “you can’t do it” to “you can do it” all that. So it’s possible to do that amongst...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 18,239
精华内容 7,295
关键字:

turnin翻译