跟讀練習: Natural Language Processing - Tokenization (NLP Zero to Hero - Part 1) - 通過影片學習英語口語
選擇練習模式
每種模式都會開啟全屏練習室。
58 句
如果句子過短或過長,請點選 Edit 進行調整。
1
Hi, and welcome to this series on Zero2Hero for Natural Language Processing using TensorFlow.
2
If you're not an expert on AI or ML, don't worry.
3
We're taking the concepts of NLP and teaching them from first principles.
4
In this first lesson, we'll talk about how to represent words in a way that a computer can process them, with a view to later training a neural network that can understand their meaning.
5
This process is called tokenization.
6
So let's take a look.
7
Consider the word listen, as you can see here.
8
It's made up of a sequence of letters.
9
These letters can be represented by numbers using an encoding scheme.
10
A popular one called ASCII has these letters represented by these numbers.
11
This bunch of numbers can then represent the word listen.
12
But the word silent has the same letters, and thus the same numbers, just in a different order.
13
So it makes it hard for us to understand sentiment of a word just by the letters in it.
14
So it might be easier, instead of encoding letters, to encode words.
15
Consider the sentence, I love my dog.
16
So what would happen if we start encoding the words in this sentence instead of the letters in each words?
17
So for example, the word I could be one.
18
And then the sentence, I love my dog, could be one, two, three, four.
19
Now, if I take another sentence, for example, I love my cat, how would we encode it?
20
Now we see I love my has already been given one, two, three.
21
So all I need to do is encode a cat.
22
I'll give that the number five.
23
And now if we look at the two sentences, they are one, two, three, four and one, two, three,
24
five, which already show some form of similarity between them.
25
And it's a similarity you'd expect because they're both about loving a pet.
26
Given this method of encoding sentences into numbers, now let's take a look at some code to achieve this for us.
27
This process, as I mentioned before, is called tokenization, and there's an API for that.
28
We'll look at how to use it with Python.
29
So here's your first look at some code to tokenize these sentences.
30
Let's go through it line by line.
31
First of all, we'll need the tokenizer APIs, and we can get these from TensorFlow Keras like this.
32
We can represent our sentences as a Python array of strings like this.
33
It's simply the I love my dog and I love my cat that we saw earlier.
34
Now the fun begins.
35
I can create an instance of a tokenizer object.
36
The numWords parameter is the maximum number of words to keep.
37
So instead of, for example, just these two sentences, imagine if we had hundreds of books to tokenize.
38
But we just want the most frequent 100 words in all of that.
39
This would automatically do that for us when we do the next step.
40
And that's to tell the tokenizer to go through all the text and then fit itself to them like this.
41
The full list of words is available as the tokenizer's word index property.
42
So we can take a look at it like this and then simply print it out.
43
The result will be this dictionary showing the key being the word and the value being the token for that word.
44
So, for example, my has a value of three.
45
The tokenizer is also smart enough to catch some exceptions.
46
So, for example, if we updated our sentences to this by adding a third sentence, noting that dog here is followed by an exclamation mark.
47
The nice thing is that the tokenizer is smart enough to spot this and not create a new token.
48
It's just dog.
49
And you can see the results here.
50
There's no token for dog exclamation, but there is one for dog.
51
And there's also a new token for the word you.
52
If you want to try this out for yourself, I've put the code in a colab here.
53
Take it for a spin and experiment.
54
You've now seen how words can be tokenized and the tools in TensorFlow that handle that tokenization for you.
55
Now that your words are represented by numbers like this, you'll next need to represent your sentences by sequences of numbers in the correct order.
56
You'll then have data ready for processing by a neural network to understand or maybe even generate new text.
57
You'll see the tools that you can use to manage this sequencing in the next episode.
58
So don't forget to hit that subscribe button.
FOR YOU
推薦影片
為什麼用這個影片練習口語?
這個講解自然語言處理的影片不僅能幫你瞭解AI知識,更是英語口語練習的好素材。影片中 speaker 用清晰的邏輯和簡單的詞彙講解“標記化”,語速適中,適合影子跟讀(shadow speak)。通過模仿他的發音、語調和節奏,你能同時提升聽力理解和口語流暢度。尤其是他對專業術語的解釋方式,能讓你學會用簡單英語表達複雜概念,這對日常交流和職場表達都很有幫助。
語境中的語法與表達
影片裡有不少實用表達值得關注:
- “If you're not an expert on... don't worry.” 這是典型的安慰句式,在口語中用來緩解對方壓力,可模仿用於日常對話。
- “Consider the word... as you can see here.” 講解時常用的引導語,能讓表達更有條理,適合在分享觀點或解釋事物時使用。
- “The tokenizer is smart enough to... ” 用“be smart enough to”強調某物的功能,比直接說“can”更生動,可用於描述工具或技術的優勢。
常見發音陷阱
練習時要注意這些易出錯的地方:
- “tokenization” 這個專業術語的發音,重音在第二個音節,不要讀成“to-KEN-i-za-tion”。可通過影子跟讀反覆模仿,糾正發音。
- “sentiment” 中的“ti”發 /ʃ/ 音,而非 /tɪ/,容易被誤讀。影片中 speaker 發音清晰,可仔細聽並重復。
- “exclamation” 一詞較長,注意每個音節的連貫性,避免吞音。通過提高英語發音的練習,可增強對長單詞的掌控力。
影片中的語法
說話人最常用的結構,並附上影片中的原話:
| 結構 | 影片中的用法 |
|---|---|
| 被動語態 be + 過去分詞 — 強調發生了什麼,而不是誰做的 | is called · can be represented · been given |
| 現在完成時 have/has + 過去分詞 — 過去發生但與現在仍有關聯的事 | has already been given · I've put · You've now seen |
什麼是跟讀法?
跟讀法 (Shadowing) 是一種有科學依據的語言學習技巧,最初開發用於專業口譯員的培訓,並由多語言者Alexander Arguelles博士普及。這個方法簡單而強大:您在聽英語母語原聲的同時立即大聲重複——就像是一個延遲1-2秒緊跟說話者的影子。與被動聽力或語法練習不同,跟讀法強迫您的大腦和口腔肌肉同時處理並模模擬實的講話模式。研究表明它能顯著提高發音準確性,語調,節奏,連讀,聽力理解和口語流利度——使其成為雅思口語備考和真實英語交流最有效的方法之一。

![#1 Machine Learning Specialization [Course 1, Week 1, Lesson 1]](https://img.youtube.com/vi/vStJoetOxJg/mqdefault.jpg)










