쉐도잉 연습: Analyze SEC filings with Transformers for fun and profit - 영상으로 영어 말하기 배우기

연습 모드 선택

각 모드는 전체 화면 연습실로 열립니다.

310 문장
문장이 너무 짧거나 길면 Edit를 눌러 조정하세요.
1
Hi everybody, this is Julian from Hugging Face.
2
Processing financial documents is a very strong use case for natural language processing and transformers.
3
In fact, most organizations in financial services and beyond need to work with a mountain of documents from company filings
4
to analyst reports and more in order to extract information, classify the documents,
5
run sentiment analysis and summarize documents etc etc so there are really
6
so many things you could do here
7
so in this video i'm going to work with company filings
8
that i download from the sec website and we'll use a pretty cool sdk
9
that i found to do this and then we'll process the filings
10
and we will run a few transformer models namely summarization
11
and emotion detection or sentiment analysis okay so let's get started so let's take a look at the raw material the documents
12
so starting on the sec website we go to filings
13
and we select edgar which is the name of the database
14
that includes company filings
15
and we could look for any particular company just to take a look maybe at one of those documents before
16
we start processing them so why not pick amazon
17
and so we see different filing types 10k
18
which are the annual reports 10q quarterly reports and 8k current reports
19
and we'll be able to work with all of these in our example
20
so let's maybe take a look at the latest quarterly report
21
the structure of this document is is well defined the table of contents is always the same
22
so we'll find lots of financial information then we'll find this section called management discussion
23
and analysis of financial condition and results of operation
24
and this is uh usually very interesting
25
because you get you know the management's opinion on how things are going
26
and and they highlight you know stuff that's going well stuff that's not going well
27
etc etc so for financial analysis this is pretty pretty interesting
28
and we'll we'll take a look at this section again
29
when we start uh processing documents okay so uh you can go
30
and have fun and find the information that you need here.
31
But of course, what we want to do is automate that process, download the documents, process them,
32
extract the text sections that we're interested in, and run transformer models on them.
33
And there is an API for Edgar documents, but as it turns out,
34
I found
35
recently i should say that some of my former colleagues at aws have actually built an sdk
36
that lets you easily retrieve scc filings and uh
37
and break down those filings into different sections
38
that we can save in a csv file and process so this is a huge time saver i mean
39
Personally, I'm not a big fan of text processing and regular expression,
40
so these people have done the heavy lifting for us.
41
So thank you very much, and I'll be happy to reuse what you've built.
42
They've written also a couple of blog posts on the SDK and how to use it for different use cases.
43
and the notebooks are actually integrated in SageMaker Jumpstart, which lets you easily deploy machine learning solutions on SageMaker.
44
So I'll put all the links in the video description and you can go and read about it.
45
I'll just show you how to use the SDK.
46
But yeah, thank you for building this.
47
It's quite useful.
48
And of course, this SDK is on GitHub and it's called the Jumpstart Industry SDK,
49
although it's only about financial documents for now.
50
But maybe we'll see other industries integrated there.
51
Okay.
52
All right.
53
So that's what we're going to do.
54
Grab some filings from the SEC website,
55
process them with this SDK so that we get a data frame with individual document sections in different columns,
56
and then we can apply some transformer magic to that.
57
Okay, so let's get started.
58
I've broken down my example in two notebooks.
59
So the first notebook is data prep.
60
Okay, so downloading, processing, and saving to CSV files.
61
And the second notebook is about running transformers.
62
It makes it a little easier to keep track of everything.
63
All right, here we go.
64
So I include for reference the name of the Jumpstart solution that I grabbed some code from, and it's called Dashboarding SCCText for Financial NLP.
65
And again, that's the SDK we're using.
66
So maybe let me zoom in a little bit.
67
So of course we need to install the SageMaker SDK and the Jumpstart Industry SDK.
68
Okay, so import them.
69
Create some objects that we're going to need, like an S3 bucket to download filings, the IAM role for permissions,
70
I mean the usual stuff.
71
Okay.
72
And next we can configure the downloading job, so to speak.
73
And of course, this is based on SageMaker.
74
And SageMaker users will easily guess that this is based on SageMaker processing,
75
which is an easy way to run batch jobs on SageMaker.
76
And it's really pretty easy to set up.
77
So we need a bucket to store the process documents.
78
So it's downloading the raw documents to one bucket, saving the process documents to another bucket.
79
And okay, this is the file name
80
that we're going to save the documents too
81
and the first step is to create this edgar dataset config object the first line here is
82
which tickers or company ids do we want to include so here i'm only fetching amazon documents
83
and these are the stock tickers right so
84
if you wanted google you'd say you know gog and
85
if you wanted tesla you'd have you know tsla etc etc and you can have as many as you want form types.
86
So here I'm grabbing 10
87
Ks and 10 Qs.
88
The SDK actually support other document types, and you'll find the information in the SDK, right?
89
The time range, so the start date, end date.
90
So then I'm grabbing old docs for 2019, 2020.
91
And this is just a bogus email that we need to retrieve documents.
92
You don't need a user account, by the way, to go and grab at your documents, although throttling is a thing,
93
so don't expect that you can pull 2 million documents in 5 minutes and not being throttled.
94
So you have to be considerate here.
95
Okay, so that's what we want to get.
96
Now that's the infrastructure setup, And this is where you can tell it's based on SageMaker processing.
97
So we'll run this on one ML C5 to Excel instance, which should be large enough.
98
No problem here.
99
And then we just launch that data loading job with the buckets,
100
the file name to save everything to.
101
And that's it.
102
Right?
103
And so you run this and, you know, I hidden the log.
104
It runs for a little bit.
105
It's based on PySpark, which SageMaker Processing supports.
106
And funny enough, the internal code name for this was Gecko.
107
And if you've seen the movie
108
Wall Street with Michael Douglas, you know why.
109
Okay, so good name for this.
110
Okay, and let's skip the log, which is really, really long.
111
And so at the end of that job, all I have is this CSV file in S3.
112
Okay, so I can go and grab it, read it, and this is what I get.
113
The ticker code, the form type, some numbers and dates, the text,
114
the full text of the filing, and the management discussion and analysis,
115
which is broken down as a separate section, because as I've said before, this is probably the most interesting part of the document.
116
Now, if we want to go one step further, we can actually break down this text column into individual sections.
117
So, going back to my example here, let's go to the contents.
118
Okay, we want to break down every single item here as a separate column, because we may want to run some analysis on that.
119
And this is where you really have to like the fact that it's all done for you, right?
120
Because you don't want to run those regular expressions.
121
And so they've included that code in a notebook, which is called SCC functions, whatever.
122
So I cleaned it up a bit because it included other stuff that I didn't need for visualization,
123
etc. But all that code is also a part of the SageMaker Jumpstart solutions.
124
So they extract all the items, and you can see the regex here is pretty intense.
125
Good thing I didn't have to write that.
126
Yeah, let's not spend too much time on that.
127
Basically, we'll just use those functions and map the column names to the right names,
128
etc. So it's all done here.
129
and this is the only bit that I wrote or adapted.
130
I just put together a simple function where I can pass a data frame with filings, the form type we want to process,
131
and then just do everything automatically, right?
132
And then it applies all that regexp and returns a data frame with one section in each column, okay?
133
So that's what we have for data prep
134
And the only thing we need to do, starting from this initial data frame, is this, which is pretty nice.
135
So just pass this data frame, say, hey, process all the 10K here.
136
And then it returns another data frame.
137
And now I can see in this data frame
138
that the individual sections of the filing have been broken down into individual columns,
139
which makes it easier to zoom in and examine and process particular things here,
140
except of that huge blob of text.
141
So I do the same for the 10Q filings.
142
So it's a different data frame, different names.
143
And then I just save those two process data frames to CSV files.
144
Simple enough.
145
Okay.
146
So now I've got my two files, right?
147
I could open one of them, I guess.
148
And we'll see exactly the same thing, right?
149
All nicely broken down into text sections.
150
Perfect.
151
So now we can move on to data processing.
152
And the original blog post runs some NLP functions on the text,
153
so you may want to read about that, although it feels more like traditional
154
statistics
155
and not there's no machine learning at work i think there's there's a bit of a hugging face summarization somewhere
156
but generally they're just using traditional techniques here but still
157
and that's part of the sdk so if you want to go
158
and compute those uh those scores those nlp scores yeah you can go
159
and do that but i've i've ignored that bit okay so i installed some dependencies
160
pandas of course i'm going to need nltk i'm going to need to break down text sections into individual sentences
161
and of course transformers for modeling okay fine
162
so this is the tokenizer i'm going to use to break down text into individual sentences
163
i'm loading my two data frames i should say
164
i'm loading my two files into data frames here
165
we just extracted very few documents to keep the demo very short you can go
166
and extract much more okay so i have two 10ks
167
because 2019 2020 and i have six 10qs
168
because there are three quarters in between the the 10ks right for each year makes sense
169
so um which model are we gonna use here so um
170
and this is where you can start adapting my code of course here
171
i just figured hey let's do a classification so i'm gonna analyze
172
uh individual sentences in the uh in the the management analysis section and i'm gonna keep
173
the most significant ones so the ones that are either highly positive or highly negative and ignore everything else.
174
And then I'm going to concatenate all the positive sentences and summarize them and concatenate all the negative sentences and summarize them.
175
But again, feel free to explore.
176
You have this data frame.
177
You can easily work with it.
178
So for summarization, I'm going to use the T5 model, T5 base.
179
And for classification, I've tried a couple of models.
180
I've tried FinBert, which is, as the name implies, a BERT version fine-tuned on financial documents.
181
And it can do sentiment analysis with three classes.
182
But I've found that this one is also very interesting.
183
It's a distilled BERT model fine-tuned on emotion detection.
184
And it has a wider range.
185
Anger, disgust, fear, joy, sadness, surprise.
186
And it does pick up interesting things.
187
We'll give it a go.
188
So just use a summarizer, use a classifier, and you can see I'm using the pipeline API from the Transformers library,
189
so it's really a one-liner to go and grab the model.
190
And here's how I'm going to process those docs.
191
So I have the first function called find emotional sentences where I pass text section,
192
and it's going to tokenize that text section into sentences, okay, break it down into individual sentences.
193
And then for each sentence, it's going to classify it.
194
And if it's not neutral, and if the score is actually higher than a certain threshold,
195
okay, so the really negative ones or the really positive ones or the really angry ones, maybe, I'm going to keep, okay?
196
And I just append them to a list stored in a dictionary, right?
197
So I'll have a list for positive sentences, a list for negative sentences, and so on.
198
So I'm just grouping those, okay?
199
And printing a summary and returning that dictionary.
200
So that will return a dictionary with a list of sentences for each emotion, right?
201
And then I have a summarization function where starting from that same dictionary,
202
I just join all the sentences for each emotion and I summarize them and print the summary, okay?
203
Just, you know, you could elaborate on that.
204
You could certainly improve this function here
205
because if you concatenate many sentences that actually exceed the max sequence size of the model,
206
then it gets truncated and you lose information.
207
So if you want to chunk this bit of text into,
208
let's say, 512 tokens, that would certainly yield a better summary.
209
Okay, exercise for the reader.
210
Okay, so that's what we do here.
211
So let's just try it.
212
And let's just start from...
213
We'll take one of those 10 Qs and point at the management discussion section.
214
And we'll try to find...
215
Let's run this.
216
We'll try to find the non-neutral sentences with a score higher than .95.
217
Okay?
218
So we can see even this section is already quite long, right?
219
over 40k characters and 174 sentences.
220
So that's a lot of text, right?
221
And I've got nine highly positive sentences and nine highly negative sentences.
222
Okay, so maybe we could just take a look at those, by the way.
223
So why don't we do this?
224
Let's look at the negative ones.
225
Whoops.
226
Here we go.
227
Okay, so yeah, these assumptions about future disposition of inventory are inherently uncertain.
228
Yeah, that's all good.
229
Liquidity is also affected by restricted cash balances, blah, blah, blah.
230
Changes in foreign currency exchange rates impacted net sales by 814 million.
231
Okay, so these are all pretty negative things, okay?
232
So now, as I've said before, we're going to concatenate all the negative sentences, all the positive sentences, and we're going to summarize.
233
So let's just go and run this.
234
And here I'm running this on a GPU instance in SageMaker Studio,
235
because that will just run faster.
236
Okay, and it's done.
237
So the positive summary is, as we utilize our federal net operating losses and tax credit, we expect cash paid for taxes to increase.
238
So you could argue that's actually positive.
239
Yeah, they're using credits, which is probably good, but taxes increase, right?
240
Nothing's free.
241
AWS sales increased 37%.
242
Okay, so I'm guessing that's good news.
243
And the negative summary is change in foreign exchange rates impacted sales.
244
Decrease in North America operated income is primarily due to increased marketing expenses.
245
Ha ha!
246
Marketing expenses.
247
Increase in international operating loss is due to increase in marketing expense at sales.
248
Okay.
249
All right.
250
So these are negative things.
251
And you can control the output, of course, with the minimum length and the maximum length of the summarizer.
252
Okay, so now let's try the emotion detection model and see what it picks up.
253
So just remove this one now.
254
Okay, just run this one, run this one.
255
Yes.
256
yeah this is a very high threshold with uh six or seven emotions so maybe i need to uh
257
lower it a little bit let's see what it picks up
258
yeah it didn't pick up much so let's just say maybe point i don't know 0.7
259
is there any angry sentence in here oh yeah all right oh
260
we have a lots of joyful sentences who thought
261
we could have thought
262
you know amazon reports would be joyful interesting uh yeah let's look at the angry ones now i'm curious
263
We are also currently subject to tax controversies in various jurisdictions.
264
Okay.
265
Developments in an audit investigation or other tax controversy could have a material effect on our operating results.
266
Okay.
267
I will refrain from any comment here.
268
But this is pretty funny, I think.
269
Okay, so why don't we summarize that stuff and see what happens?
270
Okay, so summarizing anger.
271
Yeah, we only have two sentences, so I'm guessing we'll see.
272
It does look like a summary.
273
Tax controversy could have a material impact on our results.
274
Yeah, it's actually not in here.
275
Yeah, okay, so that's a good summary.
276
yeah so joy um what do we have uh so fear and joy and sadness
277
okay
278
so see we have yeah the input for fear is all
279
is higher than the maximum token length for the model
280
so this is where you know we'd want to chunk that fear bit into uh 512 blocks and summarize
281
each one of them but you know i didn't go
282
that far okay yeah so joy again is probably too long to be properly summarized
283
and sadness gives us this guidance anticipates an unfavorable impact of approximately 30 basis points for foreign exchange rates okay
284
so that's yeah that's the good one that's a good one that's definitely not a happy fact okay
285
so as you can see you know you need to tweak this a little bit
286
and probably do a little more processing on the text um
287
and and and chunk it to get a better summary but this isn't too bad for just a few lines of code.
288
So that's pretty much what I wanted to show you today.
289
So if you thought it was crazy difficult to go and build a solution that analyzes SSD filings,
290
it's actually not.
291
a lot of the again a lot of the heavy lifting is done by this jumpstart SDK
292
and then you get your CSV file and you can just grab models
293
and these are off the shelf I didn't fine-tune anything here
294
and just start processing that stuff right
295
and of course you could you could even train your own language model on that right
296
if you download enough enough data about it yeah you could do I have to say it gets big really quickly.
297
I've downloaded, I think, a full year of 10Ks and 10Qs for all S&P 500 companies.
298
So that's about, yeah, that's a few thousand documents, and it's almost already a gigabyte of data.
299
So if you want to go back in time and download, I don't know, 20 years, it's going to be a long download,
300
which you probably need to break into
301
different jobs because you'll be throttled
302
and yeah it's going to be a lot of data
303
but yeah this data is out there you can process it very easily and
304
so you can build pretty cool models maybe we'll see more
305
financial models on the hogging face up thanks to this right and
306
if you need help ping me okay all right
307
i'll put all the links in the video description i hope this was informative and fun who knows for ICC filings.
308
I'll see you soon with more content.
309
Until next time, have fun, keep learning.
310
Bye bye!

앱 다운로드

유창하게 말하는 데 필요한 모든 것

AI 발음 평가문장마다 점수 확인
IPA 발음 연습모든 소리 마스터
단어 학습나만의 단어장 만들기
단어 게임놀면서 외우기
FOR YOU

추천 영상

이 레슨의 어휘와 말하기 포인트

이 말하기 레슨은 영상 “Analyze SEC filings with Transformers for fun and profit”을(를) 바탕으로 합니다. 가장 자주 반복되는 단어는 다음과 같습니다: document, sentence, filing, section, text. 이 영상에는 섀도잉할 문장 310개와 단어 3365개가 있습니다. 말하는 구간의 길이는 25:46입니다. 화자는 분당 약 131단어의 일정한 속도로 말해서 섀도잉하기에 편한 속도입니다. 단어의 82%가 영어에서 가장 많이 쓰이는 3,000단어에 속합니다. 나머지는 연습 전에 미리 확인해 두세요.

이 영상의 핵심 어휘

영상에 나오는 익혀 둘 만한 단어 15개를 발음, 뜻과 함께 정리했습니다.

단어발음뜻
summary 명사/ˈsʌm.ə.ɹi/요약, 개요
emotion 명사/ɪˈməʊ.ʃən/감정
bucket 명사/ˈbʌkɪt/양동이
notebook 명사/ˈnoʊtˌbʊk/공책, 노트
column 명사/ˈkɒləm/기둥
dictionary 명사/ˈdɪk.ʃəˌnɛ.ɹi/사전, 자서
tune 명사/tjuːn/곡, 곡조
controversy 명사/kənˈtɹɒv.ə.si/논쟁, 토론
expense 명사/ɪkˈspɛns/비용
detection 명사/dɪˈtɛk.ʃən/탐지, 수색
sadness 명사/ˈsædnəs/슬픔
chunk 명사/t͡ʃʌŋk/조각
ignore 동사/ɪɡˈnɔː/무시하다
anger 명사/ˈæŋɡə/성, 분노
neutral 형용사/ˈnuː.tɹəl/중립의

영상에 나오는 구동사

단어뜻
pick up 동사줍다
put together 동사조립하다

따라 말해 볼 만한 문장

영상에 나오는 짧고 완결된 문장으로, 일상 대화에서 그대로 쓸 수 있습니다:

  • I've broken down my example in two notebooks.
  • Because you don't want to run those regular expressions.
  • Good thing I didn't have to write that.
  • We'll give it a go.
  • So why don't we do this?

이 영상의 문법

화자가 가장 많이 쓰는 문형을 영상 속 실제 표현과 함께 정리했습니다.

문형영상 속 표현
현재완료 have/has + 과거분사 — 과거의 일이 지금도 관련이 있을 때have actually built · have done · you've built
수동태 be + 과거분사 — 누가 하는지보다 무슨 일이 일어나는지에 초점are actually integrated · is based · being throttled
관계절 who / which + 절 — 사람이나 사물에 대한 추가 정보edgar which is · log, which is · notebook, which is

주의할 발음

화자는 I'm, we'll, I've 같은 축약형과 약화된 형태를 90번 사용합니다. 들리는 대로 짧게 발음하세요.

  • “th” 소리: threshold /ˈθɹɛʃ(h)oʊld/, throttle /ˈθɹɔ.tl̩/
  • “sh”와 “zh” 소리: emotion /ɪˈməʊ.ʃən/, dictionary /ˈdɪk.ʃəˌnɛ.ɹi/, detection /dɪˈtɛk.ʃən/, classification /ˌklæsɪfɪˈkeɪʃən/, threshold /ˈθɹɛʃ(h)oʊld/
  • 긴 단어 — 강세 위치에 주의: dictionary /ˈdɪk.ʃəˌnɛ.ɹi/, controversy /kənˈtɹɒv.ə.si/, classification /ˌklæsɪfɪˈkeɪʃən/, primarily /ˈpɹaɪ.mə.ɹə.li/, infrastructure /ˈɪnfɹəˌstɹʌkt͡ʃə/

한국어 화자가 어려워하는 소리:

  • /f/ — ㅍ(/p/)으로 바꾸지 말고 윗니를 아랫입술에 대기: filing /ˈfaɪ.lɪŋ/, classification /ˌklæsɪfɪˈkeɪʃən/, infrastructure /ˈɪnfɹəˌstɹʌkt͡ʃə/, shelf /ʃɛlf/, fetch /fɛt͡ʃ/
  • /v/ — ㅂ(/b/)과 구별하기: controversy /kənˈtɹɒv.ə.si/, retrieve /ɹɪˈtɹiːv/, inventory /ˈɪn.vən.tɹi/, informative /ɪnˈfɔːmətɪv/, saver /ˈseɪvəɹ/
  • /z/ — ㅈ이 아니라 성대를 울리는 /s/: columns /ˈkɑləmz/, analyze /ˈæn.əˌlaɪz/, zoom /zuːm/, examine /ɪɡˈzæmɪn/, utilize /ˈjuː.tɪ.laɪz/

이 영상으로 연습하는 방법

  1. 먼저 말하지 않고 영상을 끝까지 듣고 모르는 단어를 적어 둡니다.
  2. 보통 속도로 한 문장씩 섀도잉하고, 화자의 리듬과 맞을 때까지 반복합니다.
  3. 자신의 목소리를 녹음해 원본과 비교하고, summary, emotion, bucket 같은 단어에 특히 주의합니다.

쉐도잉이란? 영어 실력을 빠르게 키우는 과학적 방법

쉐도잉(Shadowing)은 원래 전문 통역사 훈련을 위해 개발된 언어 학습 기법으로, 다언어 학자인 Dr. Alexander Arguelles에 의해 대중화된 방법입니다. 핵심 원리는 간단하지만 매우 강력합니다: 원어민의 영어를 들으면서 1~2초의 짧은 지연으로 즉시 소리 내어 따라 말하는 것——마치 '그림자(shadow)'처럼 화자를 따라가는 것입니다. 문법 공부나 수동적인 청취와 달리, 쉐도잉은 뇌와 입 근육이 동시에 실시간으로 영어를 처리하고 재현하도록 훈련합니다. 연구에 따르면 이 방법은 발음 정확도, 억양, 리듬, 연음, 청취력, 말하기 유창성을 크게 향상시킵니다. IELTS 스피킹 준비와 자연스러운 영어 소통을 원하는 분들에게 특히 효과적입니다.

섀도잉 방법: 단계별 전체 가이드 읽기 →