-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
337 lines (332 loc) · 13.2 KB
/
index.html
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>YC-Dendrolinguistics: AI Startup Similarity Search</title>
<meta name="description" content="Explore YC startup pitches through linguistic analysis. Use our AI-powered similarity search to find semantically related startups and uncover pitch patterns.">
<meta name="keywords" content="YC-Dendrolinguistics, startup pitches, linguistic analysis, AI, similarity search, Y Combinator">
<meta name="author" content="Aman Priyanshu">
<script src="https://cdn.jsdelivr.net/npm/@xenova/[email protected]"></script>
<style>
/* Existing styles */
body {
font-family: 'Arial', sans-serif;
line-height: 1.6;
color: #333;
background-color: #f4f4f4;
padding: 20px;
margin: 0;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 0 20px;
}
h1 {
color: #252c45;
text-align: center;
margin-bottom: 20px;
font-size: 2rem;
}
/* New navigation styles */
nav {
background-color: #252c45;
padding: 10px 0;
margin-bottom: 20px;
}
nav ul {
list-style-type: none;
padding: 0;
margin: 0;
display: flex;
justify-content: center;
}
nav ul li {
margin: 0 10px;
}
nav ul li a {
color: white;
text-decoration: none;
padding: 5px 10px;
border-radius: 5px;
transition: background-color 0.3s ease;
}
nav ul li a:hover {
background-color: #3a4258;
}
.section-title {
text-align: center;
margin-top: 40px;
color: #252c45;
}
/* Existing styles continued */
textarea {
width: 100%;
height: 100px;
margin-bottom: 10px;
padding: 10px;
font-size: 16px;
border: 1px solid #ddd;
border-radius: 4px;
}
button {
padding: 10px 20px;
font-size: 16px;
background-color: #3498db;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #2980b9;
}
button:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
#result {
margin-top: 20px;
}
.startup {
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
margin-bottom: 20px;
overflow: hidden;
}
.startup-header {
background-color: #e9f0f7;
padding: 15px;
cursor: pointer;
user-select: none;
display: flex;
justify-content: space-between;
align-items: center;
}
.startup-header h3 {
margin: 0;
color: #252c45;
}
.startup-content {
display: none;
padding: 20px;
animation: fadeIn 0.5s ease-out;
}
.startup-content.open {
display: block;
}
.startup-header::after {
content: '▼';
transition: transform 0.3s ease;
}
.startup-header.open::after {
transform: rotate(180deg);
}
.tag {
display: inline-block;
padding: 2px 8px;
border-radius: 12px;
font-size: 0.8em;
margin-right: 5px;
color: white;
}
.founders {
margin-top: 15px;
}
.founder {
background-color: #f9f9f9;
padding: 10px;
border-radius: 4px;
margin-bottom: 10px;
}
.tldr-summary {
font-style: italic;
color: #666;
text-align: center;
margin-bottom: 20px;
font-size: 1.1em;
max-width: 80%;
margin-left: auto;
margin-right: auto;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.url { background-color: #3498db; }
.description { background-color: #2ecc71; }
.problem { background-color: #e74c3c; }
.solution { background-color: #f39c12; }
.founder-tag { background-color: #9b59b6; }
</style>
</head>
<body>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="graphs.html">Startup Graphs</a></li>
<li><a href="proba_pages.html">Probability Analysis</a></li>
<li><a href="about.html">About</a></li>
<li><a href="https://amanpriyanshu.github.io/blogs/">AI Blogs</a></li>
</ul>
</nav>
<div class="container">
<h1>YC-Dendrolinguistics</h1>
<p class="tldr-summary">"Cultivating linguistic forests from YC startup pitches using bio-inspired grammar trees to map pitch patterns."</p>
<h2 class="section-title">AI Startup Similarity Search (Limited to W24 & S24)</h1>
<p>Enter a search query and click "Search" to find the top 4 most semantically similar startups. You can find the trees generated within these two batches in <a href="proba_pages.html">Probability Analysis</a></p>
<textarea id="input" placeholder="Enter your startup search query here..."></textarea>
<button onclick="searchSimilarStartups()" disabled>Search</button>
<div id="result"></div>
</div>
<script>
let pipeline;
let documentEmbeddings = {};
let startupDetails = {};
async function init() {
console.log('Initializing model pipeline...');
const { pipeline } = await import('https://cdn.jsdelivr.net/npm/@xenova/[email protected]');
window.pipeline = await pipeline('feature-extraction', 'Snowflake/snowflake-arctic-embed-xs');
console.log('Model pipeline initialized.');
console.log('Loading document embeddings from GitHub...');
try {
// Load document embeddings
const embeddingsResponse = await fetch('https://raw.githubusercontent.com/AmanPriyanshu/YC-Dendrolinguistics/main/data/document_embeddings.json');
if (!embeddingsResponse.ok) {
throw new Error(`HTTP error! Status: ${embeddingsResponse.status}`);
}
const embeddingsData = await embeddingsResponse.json();
for (const [docName, embeddingArray] of Object.entries(embeddingsData)) {
documentEmbeddings[docName] = new Float32Array(embeddingArray);
}
console.log('Document embeddings loaded.');
// Load startup details
console.log('Loading startup details from GitHub...');
const startupsResponse = await fetch('https://raw.githubusercontent.com/AmanPriyanshu/YC-Dendrolinguistics/main/data/startups.json');
if (!startupsResponse.ok) {
throw new Error(`HTTP error! Status: ${startupsResponse.status}`);
}
const startupsData = await startupsResponse.json();
// Create a mapping from startup name to its details
startupsData.forEach(startup => {
startupDetails[startup.name] = startup;
});
console.log('Startup details loaded.');
document.querySelector('button').disabled = false;
console.log('Application is ready.');
} catch (error) {
console.error('Error loading data:', error);
alert('Failed to load data. Please check the console for details.');
}
}
function cosineSimilarity(a, b) {
let dotProduct = 0;
let normA = 0;
let normB = 0;
for (let i = 0; i < a.length; i++) {
dotProduct += a[i] * b[i];
normA += a[i] * a[i];
normB += b[i] * b[i];
}
return dotProduct / (Math.sqrt(normA) * Math.sqrt(normB));
}
async function searchSimilarStartups() {
const input = document.getElementById('input').value.trim();
const resultDiv = document.getElementById('result');
if (!input) {
resultDiv.textContent = "Please enter a search query.";
return;
}
resultDiv.textContent = "Computing embeddings and searching...";
try {
console.log('Computing embedding for the input search query...');
const output = await window.pipeline(input, { pooling: 'mean', normalize: true });
const inputEmbedding = output.data;
console.log('Input embedding computed.');
const similarities = [];
for (const [docName, docEmbedding] of Object.entries(documentEmbeddings)) {
const similarity = cosineSimilarity(inputEmbedding, docEmbedding);
similarities.push({ docName, similarity });
}
similarities.sort((a, b) => b.similarity - a.similarity);
const topResults = similarities.slice(0, 4);
// Display the results
let resultHTML = '';
topResults.forEach((item, index) => {
const docName = item.docName.slice(0, -5);
const startup = startupDetails[docName];
if (startup) {
resultHTML += formatStartupDetails(startup, item.similarity);
} else {
resultHTML += `<p>No details found for ${item.docName}</p>`;
}
});
resultDiv.innerHTML = resultHTML;
// Add event listeners to startup headers
document.querySelectorAll('.startup-header').forEach(header => {
header.addEventListener('click', () => {
header.classList.toggle('open');
header.nextElementSibling.classList.toggle('open');
});
});
console.log('Search completed.');
} catch (error) {
resultDiv.textContent = `Error: ${error.message}`;
console.error('Error during search:', error);
}
}
function formatStartupDetails(startup, similarity) {
let html = `<div class="startup">`;
html += `<div class="startup-header">`;
html += `<h3>${startup.name} (Similarity: ${similarity.toFixed(4)})</h3>`;
if (startup.url) {
html += `<a href="${startup.url}" target="_blank" class="tag url" title="${startup.url}">URL</a>`;
}
html += `</div>`;
html += `<div class="startup-content">`;
if (startup.short_description) {
html += `<p><span class="tag description">Description</span> ${startup.short_description}</p>`;
}
if (startup.description) {
html += `<p><span class="tag description">Full Description</span> ${startup.description}</p>`;
}
if (startup.founders && Object.keys(startup.founders).length > 0) {
html += `<div class="founders">`;
html += `<span class="tag founder-tag">Founders</span>`;
for (const [founderName, founderBio] of Object.entries(startup.founders)) {
html += `<div class="founder">`;
html += `<p><strong>${founderName}</strong></p>`;
html += `<p>${founderBio}</p>`;
html += `</div>`;
}
html += `</div>`;
}
if (startup.tldr_one_sentence) {
html += `<p><strong>TL;DR:</strong> ${startup.tldr_one_sentence}</p>`;
}
if (startup.setting) {
html += `<p><strong>Setting:</strong> ${startup.setting}</p>`;
}
if (startup.problem) {
html += `<p><span class="tag problem">Problem</span> ${startup.problem}</p>`;
}
if (startup.solution) {
html += `<p><span class="tag solution">Solution</span> ${startup.solution}</p>`;
}
if (startup.url) {
html += `<p><strong>URL:</strong> <a href="${startup.url}" target="_blank">${startup.url}</a></p>`;
}
html += `</div></div>`;
return html;
}
// Initialize the pipeline and load data when the page loads
init();
</script>
<div style="text-align: center; margin-top: 20px;">
<a href="https://hits.sh/amanpriyanshu.github.io/YC-Dendrolinguistics/"><img alt="Hits" src="https://hits.sh/amanpriyanshu.github.io/YC-Dendrolinguistics.svg"/></a>
</div>
</body>
</html>