Skip to Content
Python计算机视觉和自然语言处理
book

Python计算机视觉和自然语言处理

by Posts & Telecom Press, Álvaro Morena Alberolaï, Gonzalo Molina Gallegoï, Unai Garay Maestreï
May 2024
Intermediate to advanced
274 pages
4h 17m
Chinese
Packt Publishing
Content preview from Python计算机视觉和自然语言处理

第7章 构建基于文本的对话系统(聊天机器人)

学习目标

阅读完本章之后,你将能够:

  • 理解GloVe、Word2Vec和词嵌入的概念;
  • 构建你自己的Word2Vec模型;
  • 选择用来创建对话代理的工具;
  • 预测对话的意图;
  • 创建对话代理。

本章介绍GloVe、Word2Vec和词嵌入的概念,以及用来创建对话代理的一些工具。

深度NLP的最新趋势之一是创建对话代理,也称为聊天机器人。聊天机器人是一种基于文本的对话系统,可以理解人类的语言,并与人进行真正的对话。许多公司利用这种系统来和顾客互动,从而获取信息和反馈,例如对新产品的看法。

聊天机器人也可以用作助理,例如Siri、Alexa和Google Home,它们能够提供关于天气或者交通情况的实时信息。

那么,机器人是如何理解我们的呢?前面几章已经介绍过语言模型(LM)及其工作原理,LM中最重要的问题是词语在句子中的位置。根据句子中已经存在的词语的不同,每个词语有一定的概率会在该句子中出现。然而,概率分布的方法不是很适合这个任务,因为这个任务需要的是理解含义,从而让模型理解给定语料库中一个词语的含义,而不是预测下一个出现的词语。

一个词语只有放在一个上下文或者语料库之中才有更准确的含义。理解句子的含义是一件非常重要的事情,而句子的含义又是由其结构(即句子中词语的位置)所决定的,所以模型会根据每个词语附近的词语来预测该词语的含义。那么,如何在数学上描述这个想法呢?

第4章介绍了使用独热编码向量表示词语的方法,这种向量由1和0构成。然而,这种表示无法提供词语的实际含义,例如:

  • Dog -> [1,0,0,0,0,0];
  • Cat -> [0,0,0,0,1,0]。

狗和猫都是动物,但如果用1和0来表示这两个词,就无法体现出任何与词语含义相关的信息。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Kafka权威指南(第2版)

Kafka权威指南(第2版)

Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty
精益AI

精益AI

Lomit Patel
基于Azure的自动机器学习

基于Azure的自动机器学习

Deepak Mukunthu, Parashar Shah, Wee Hyong Tok
Spark机器学习实战

Spark机器学习实战

Posts & Telecom Press, Siamak Amirghodsi, Meenakshi Rajendran, Broderick Hall, Shuen Mei

Publisher Resources

ISBN: 9781836201175