Files changed (1) hide show
  1. README.md +50 -22
README.md CHANGED
@@ -88,7 +88,7 @@ sparse_vector = get_sparse_vector(feature, output)
88
 
89
  # get similarity score
90
  sim_score = torch.matmul(sparse_vector[0],sparse_vector[1])
91
- print(sim_score) # tensor(22.3299, grad_fn=<DotBackward0>)
92
 
93
 
94
  query_token_weight, document_query_token_weight = transform_sparse_vector_to_dict(sparse_vector)
@@ -99,27 +99,55 @@ for token in sorted(query_token_weight, key=lambda x:query_token_weight[x], reve
99
 
100
 
101
  # result:
102
- # score in query: 2.9262, score in document: 2.1335, token: ny
103
- # score in query: 2.5206, score in document: 1.5277, token: weather
104
- # score in query: 2.0373, score in document: 2.3489, token: york
105
- # score in query: 1.5786, score in document: 0.8752, token: cool
106
- # score in query: 1.4636, score in document: 1.5132, token: current
107
- # score in query: 0.7761, score in document: 0.8860, token: season
108
- # score in query: 0.7560, score in document: 0.6726, token: 2020
109
- # score in query: 0.7222, score in document: 0.6292, token: summer
110
- # score in query: 0.6888, score in document: 0.6419, token: nina
111
- # score in query: 0.6451, score in document: 0.8200, token: storm
112
- # score in query: 0.4698, score in document: 0.7635, token: brooklyn
113
- # score in query: 0.4562, score in document: 0.1208, token: julian
114
- # score in query: 0.3484, score in document: 0.3903, token: wow
115
- # score in query: 0.3439, score in document: 0.4160, token: usa
116
- # score in query: 0.2751, score in document: 0.8260, token: manhattan
117
- # score in query: 0.2013, score in document: 0.7735, token: fog
118
- # score in query: 0.1989, score in document: 0.2961, token: mood
119
- # score in query: 0.1653, score in document: 0.3437, token: climate
120
- # score in query: 0.1191, score in document: 0.1533, token: nature
121
- # score in query: 0.0665, score in document: 0.0600, token: temperature
122
- # score in query: 0.0552, score in document: 0.3396, token: windy
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  ```
124
 
125
  The above code sample shows an example of neural sparse search. Although there is no overlap token in original query and document, but this model performs a good match.
 
88
 
89
  # get similarity score
90
  sim_score = torch.matmul(sparse_vector[0],sparse_vector[1])
91
+ print(sim_score) # tensor(38.6112, grad_fn=<DotBackward0>)
92
 
93
 
94
  query_token_weight, document_query_token_weight = transform_sparse_vector_to_dict(sparse_vector)
 
99
 
100
 
101
  # result:
102
+ # score in query: 2.7273, score in document: 2.9088, token: york
103
+ # score in query: 2.5734, score in document: 0.9208, token: now
104
+ # score in query: 2.3895, score in document: 1.7237, token: ny
105
+ # score in query: 2.2184, score in document: 1.2368, token: weather
106
+ # score in query: 1.8693, score in document: 1.4146, token: current
107
+ # score in query: 1.5887, score in document: 0.7450, token: today
108
+ # score in query: 1.4704, score in document: 0.9247, token: sunny
109
+ # score in query: 1.4374, score in document: 1.9737, token: nyc
110
+ # score in query: 1.4347, score in document: 1.6019, token: currently
111
+ # score in query: 1.1605, score in document: 0.9794, token: climate
112
+ # score in query: 1.0944, score in document: 0.7141, token: upstate
113
+ # score in query: 1.0471, score in document: 0.5519, token: forecast
114
+ # score in query: 0.9268, score in document: 0.6692, token: verve
115
+ # score in query: 0.9126, score in document: 0.4486, token: huh
116
+ # score in query: 0.8960, score in document: 0.7706, token: greene
117
+ # score in query: 0.8779, score in document: 0.7120, token: picturesque
118
+ # score in query: 0.8471, score in document: 0.4183, token: pleasantly
119
+ # score in query: 0.8079, score in document: 0.2140, token: windy
120
+ # score in query: 0.7537, score in document: 0.4925, token: favorable
121
+ # score in query: 0.7519, score in document: 2.1456, token: rain
122
+ # score in query: 0.7277, score in document: 0.3818, token: skies
123
+ # score in query: 0.6995, score in document: 0.8593, token: lena
124
+ # score in query: 0.6895, score in document: 0.2410, token: sunshine
125
+ # score in query: 0.6621, score in document: 0.3016, token: johnny
126
+ # score in query: 0.6604, score in document: 0.1933, token: skyline
127
+ # score in query: 0.6117, score in document: 0.2197, token: sasha
128
+ # score in query: 0.5962, score in document: 0.0414, token: vibe
129
+ # score in query: 0.5381, score in document: 0.7560, token: hardly
130
+ # score in query: 0.4582, score in document: 0.4243, token: prevailing
131
+ # score in query: 0.4539, score in document: 0.5073, token: unpredictable
132
+ # score in query: 0.4350, score in document: 0.8463, token: presently
133
+ # score in query: 0.3674, score in document: 0.2496, token: hail
134
+ # score in query: 0.3324, score in document: 0.5506, token: shivered
135
+ # score in query: 0.3281, score in document: 0.1964, token: wind
136
+ # score in query: 0.3052, score in document: 0.5785, token: rudy
137
+ # score in query: 0.2797, score in document: 0.0357, token: looming
138
+ # score in query: 0.2712, score in document: 0.0870, token: atmospheric
139
+ # score in query: 0.2471, score in document: 0.3490, token: vicky
140
+ # score in query: 0.2247, score in document: 0.2383, token: sandy
141
+ # score in query: 0.2154, score in document: 0.5737, token: crowded
142
+ # score in query: 0.1723, score in document: 0.1857, token: chilly
143
+ # score in query: 0.1700, score in document: 0.4110, token: blizzard
144
+ # score in query: 0.1183, score in document: 0.0613, token: ##cken
145
+ # score in query: 0.0923, score in document: 0.6363, token: unrest
146
+ # score in query: 0.0624, score in document: 0.2127, token: russ
147
+ # score in query: 0.0558, score in document: 0.5542, token: blackout
148
+ # score in query: 0.0549, score in document: 0.1589, token: kahn
149
+ # score in query: 0.0160, score in document: 0.0566, token: 2020
150
+ # score in query: 0.0125, score in document: 0.3753, token: nighttime
151
  ```
152
 
153
  The above code sample shows an example of neural sparse search. Although there is no overlap token in original query and document, but this model performs a good match.