File size: 6,382 Bytes
fbad523 | 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 | import type { Document, Query } from '../types';
export const IDFS: Record<string, number> = {
'what': 0.12,
'is': 0.08,
'the': 0.05,
'daily': 2.85,
'life': 1.94,
'of': 0.06,
'a': 0.04,
'thai': 4.12,
'monk': 4.78,
'buddhist': 3.91,
'monastery': 4.35,
'morning': 2.15,
'alms': 5.21,
'meditation': 3.82,
'blood': 2.45,
'pressure': 2.89,
'hypertension': 4.62,
'diet': 2.31,
'exercise': 2.74,
'garlic': 4.88,
'transformer': 4.41,
'attention': 3.65,
'neural': 3.12,
'retrieval': 3.78,
'bm25': 5.60,
'dense': 3.89,
};
export const SAMPLE_DOCUMENTS: Document[] = [
{
id: 'doc-70231',
title: 'Daily Routine of Buddhist Monks in Thailand',
text: 'In Thailand, a Buddhist monk starts his daily life at 4:00 AM with meditation and chanting. At dawn, monks walk barefoot through village streets to collect morning alms (food) from local laypeople. After eating the morning meal, monks study Buddhist scriptures (Dharma) and engage in afternoon meditation.',
length: 54,
termFreqs: {
'thai': 1,
'monk': 2,
'daily': 1,
'life': 1,
'meditation': 2,
'alms': 1,
'buddhist': 2,
'morning': 2,
},
denseVector: [0.82, 0.65, -0.21, 0.44, 0.73, -0.12, 0.58, 0.31],
spladeTokens: {
'thai': 2.8,
'monk': 3.4,
'buddhist': 3.1,
'alms': 2.9,
'daily': 1.8,
'life': 1.6,
'meditation': 2.4,
'temple': 1.9,
'sangha': 2.2,
'theravada': 2.0,
},
goldRelevance: 2,
},
{
id: 'doc-84912',
title: 'Life in Rural Northern Thailand',
text: 'Daily life in northern Thailand is centered on agriculture and sticky rice cultivation. Families awaken before sunrise to prepare breakfast and feed water buffalo before heading into the fields.',
length: 32,
termFreqs: {
'thai': 1,
'daily': 1,
'life': 1,
'morning': 1,
},
denseVector: [0.35, 0.22, 0.15, -0.42, 0.31, 0.05, 0.18, -0.22],
spladeTokens: {
'thai': 2.1,
'daily': 1.4,
'life': 1.5,
'agriculture': 2.6,
'farming': 2.4,
'chiang': 1.8,
},
goldRelevance: 0,
},
{
id: 'doc-10492',
title: 'Theravada Monastic Disciplines & Vinaya',
text: 'Monastic life for Theravada bhikkhus adheres strictly to the Vinaya code consisting of 227 rules. Monks shave their heads, wear saffron robes, and depend entirely on the generosity of the community for sustenance.',
length: 38,
termFreqs: {
'monk': 2,
'life': 1,
'buddhist': 1,
},
denseVector: [0.71, 0.58, -0.18, 0.39, 0.62, -0.09, 0.49, 0.28],
spladeTokens: {
'monk': 3.1,
'theravada': 2.8,
'vinaya': 2.9,
'buddhist': 2.6,
'thai': 1.7,
'robes': 2.1,
'monastery': 2.3,
},
goldRelevance: 1,
},
{
id: 'doc-44210',
title: 'Hypertension Management: Diet & Lifestyle',
text: 'Managing high blood pressure requires consistent lifestyle modifications including sodium restriction, regular aerobic exercise, and diets high in potassium. Clinical studies show garlic extract and hibiscus tea also exhibit mild anti-hypertensive effects.',
length: 36,
termFreqs: {
'blood': 1,
'pressure': 1,
'hypertension': 1,
'diet': 1,
'exercise': 1,
'garlic': 1,
},
denseVector: [-0.62, -0.31, 0.77, 0.12, -0.45, 0.81, -0.29, 0.54],
spladeTokens: {
'hypertension': 3.2,
'blood': 2.4,
'pressure': 2.5,
'cardiovascular': 2.8,
'diet': 1.9,
'garlic': 2.1,
},
goldRelevance: 0,
},
{
id: 'doc-55102',
title: 'Garlic Supplementation for Blood Pressure Reduction',
text: 'A meta-analysis of randomized controlled trials suggests garlic supplements can lower systolic blood pressure by an average of 8-10 mmHg in hypertensive individuals through endothelial nitric oxide synthesis.',
length: 32,
termFreqs: {
'garlic': 2,
'blood': 1,
'pressure': 1,
'hypertension': 1,
},
denseVector: [-0.58, -0.28, 0.81, 0.15, -0.41, 0.79, -0.25, 0.60],
spladeTokens: {
'garlic': 3.4,
'blood': 2.3,
'pressure': 2.4,
'hypertension': 2.9,
'systolic': 2.7,
'cardiovascular': 2.5,
},
goldRelevance: 0,
},
{
id: 'doc-99411',
title: 'Self-Attention in Transformer Language Models',
text: 'The transformer architecture relies on multi-head scaled dot-product attention to compute contextual representations across input tokens without recurrence, enabling efficient parallel training and state-of-the-art neural IR retrieval models.',
length: 33,
termFreqs: {
'transformer': 1,
'attention': 1,
'neural': 1,
'retrieval': 1,
},
denseVector: [0.12, -0.75, -0.42, 0.88, 0.15, -0.33, 0.67, -0.51],
spladeTokens: {
'transformer': 3.5,
'attention': 3.2,
'neural': 2.8,
'retrieval': 2.9,
'bert': 3.0,
'bi-encoder': 2.4,
},
goldRelevance: 0,
},
];
export const PRESET_QUERIES: Query[] = [
{
id: 'qid-1048585',
text: 'what is the daily life of a thai monk',
dataset: 'MS MARCO Passage',
denseVector: [0.79, 0.61, -0.19, 0.40, 0.70, -0.10, 0.55, 0.29],
spladeTokens: {
'what': 0.2,
'daily': 2.2,
'life': 1.9,
'thai': 3.5,
'monk': 4.1,
'buddhist': 2.8,
'monastery': 2.4,
'temple': 2.1,
},
relevantDocIds: ['doc-70231', 'doc-10492'],
},
{
id: 'qid-156493',
text: 'causes of high blood pressure and natural remedies',
dataset: 'NFCorpus',
denseVector: [-0.60, -0.30, 0.78, 0.14, -0.44, 0.80, -0.28, 0.56],
spladeTokens: {
'blood': 2.8,
'pressure': 3.1,
'hypertension': 3.8,
'natural': 2.0,
'remedies': 2.4,
'diet': 2.3,
'garlic': 2.6,
},
relevantDocIds: ['doc-44210', 'doc-55102'],
},
{
id: 'qid-2001',
text: 'deep learning transformer attention mechanism in information retrieval',
dataset: 'Custom',
denseVector: [0.14, -0.73, -0.40, 0.86, 0.16, -0.31, 0.65, -0.49],
spladeTokens: {
'transformer': 3.6,
'attention': 3.4,
'retrieval': 3.1,
'neural': 2.9,
'deep': 2.1,
'learning': 2.0,
'bert': 2.7,
},
relevantDocIds: ['doc-99411'],
},
];
|