Update README.md
#1
by
zhichao-geng
- opened
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(
|
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.
|
103 |
-
# score in query: 2.
|
104 |
-
# score in query: 2.
|
105 |
-
# score in query:
|
106 |
-
# score in query: 1.
|
107 |
-
# score in query:
|
108 |
-
# score in query:
|
109 |
-
# score in query:
|
110 |
-
# score in query:
|
111 |
-
# score in query:
|
112 |
-
# score in query:
|
113 |
-
# score in query:
|
114 |
-
# score in query: 0.
|
115 |
-
# score in query: 0.
|
116 |
-
# score in query: 0.
|
117 |
-
# score in query: 0.
|
118 |
-
# score in query: 0.
|
119 |
-
# score in query: 0.
|
120 |
-
# score in query: 0.
|
121 |
-
# score in query: 0.
|
122 |
-
# score in query: 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|