-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathweek11.html
More file actions
113 lines (98 loc) · 4.48 KB
/
week11.html
File metadata and controls
113 lines (98 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Week 11: Natural Language Processing in Finance</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Data Analytics I</a>
</div>
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
</nav>
<div style="height: 80px;"></div>
<main class="container">
<h1>Week 11: Natural Language Processing in Finance</h1>
<section>
<h2>Resources</h2>
<ul>
<li>Core Reading
<ul>
<li><a href="https://github.com/CinderZhang/DataAnalytics/blob/main/Documents/Textual%20Analysis%20in%20Finance.pdf" target="_blank">Textual Analysis in Finance</a></li>
</ul>
</li>
<li>Implementation Examples
<ul>
<li><a href="https://github.com/CinderZhang/DataAnalytics/blob/main/code/10-K/parsing10k-Mar2022.ipynb" target="_blank">SEC Filings Analysis: 10-K Item 7</a></li>
<li><a href="https://github.com/CinderZhang/DataAnalytics/tree/main/code/10-K" target="_blank">SEC Filings: Download and Process</a></li>
<li><a href="https://github.com/CinderZhang/DataAnalytics/blob/main/code/Sentiment%20and%20Classification/Sentiment_Classification.py" target="_blank">Sentiment Analysis Implementation</a></li>
</ul>
</li>
<li>Modern NLP Approaches
<ul>
<li><a href="https://platform.openai.com/docs/guides/text-analysis" target="_blank">OpenAI API for Text Analysis</a></li>
<li><a href="https://huggingface.co/docs/transformers/tasks/sequence_classification" target="_blank">FinBERT and Financial NLP Models</a></li>
<li>Example Code:
<pre><code>
import openai
from transformers import pipeline
# OpenAI approach
def analyze_sentiment_openai(text):
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "Analyze the sentiment of this financial text. Return POSITIVE, NEGATIVE, or NEUTRAL."},
{"role": "user", "content": text}
]
)
return response.choices[0].message['content']
# FinBERT approach
sentiment_analyzer = pipeline("sentiment-analysis",
model="ProsusAI/finbert")
def analyze_sentiment_finbert(text):
result = sentiment_analyzer(text)
return result[0]['label']
# Example usage
text = "Company X reported strong earnings growth and increased market share."
print(analyze_sentiment_openai(text)) # Requires API key
print(analyze_sentiment_finbert(text)) # Local model
</code></pre>
</li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Assignment</h2>
<p>SEC Filings Analysis Project</p>
<ul>
<li>Process and analyze 10-K SEC filings</li>
<li>Compare traditional and LLM-based sentiment analysis</li>
</ul>
</section>
<div style="text-align: center; margin-top: 20px;">
<a href="week10.html">← Previous Week</a>
|
<a href="week12.html">Next Week →</a>
</div>
<div class="back-to-home">
<a href="index.html">← Back to Home</a>
</div>
</main>
<footer class="container text-center">
<p>© 2024 Cinder Zhang. All rights reserved. Contact us at <a href="mailto:xzhang@walton.uark.edu">xzhang at walton uark</a></p>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</body>
</html>