photoprism/internal/face/embedding_test.go

88 lines
86 KiB
Go
Raw Normal View History

package face
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEmbedding_Kind(t *testing.T) {
t.Run("Kids", func(t *testing.T) {
e := Embedding{0.00956450719281242, 0.017594281506414216, 0.0034308274819826088, 0.024433304607454274, 0.03652508157150199, 0.01116447955266469, -0.0006183593003596696, -0.0010943688685074449, 0.012357249196308354, 0.07457883842289448, 0.11295248899194929, -0.02418406752662526, -0.03966302269448837, -0.029571157983607717, 0.012989095386324657, -0.01884545675582356, -0.0069224719061619705, 0.03909949171874258, -0.02592672230417116, 0.013062778420539366, 0.015368576777594475, -0.009386404443325268, 0.038085957161254354, -0.07454640790820122, -0.08851962122652265, 0.03059599507186148, -0.002311327417070667, -0.026430425544579823, -0.06707751088672215, 0.02089460481268664, -0.01521601515479334, 0.030341569748189714, -0.0012923568590647644, 0.06852907459768984, 0.00929470748330156, 0.0015921768240837587, 0.01932051172479987, -0.005583951042758094, -0.028357081613244697, -0.015834319405257702, -0.007910402310598228, -0.010658817055324713, 0.01000140067966034, 0.053078942828708224, -0.030584194386998814, 0.015025267015314765, -0.013891826978781156, -0.006699096670167314, -0.060938968426651426, -0.053249146375391215, 0.02276569032013261, -0.04673161241225898, 0.016461304233719904, 0.045863549328512616, -0.04880381665296025, -0.034031555263532534, -0.026937679646329746, 0.03530077305104998, -0.05340263620018959, 0.04798200478156408, -0.025280179145435493, 0.02274432245434986, -0.07815711489982075, -0.00208588682128013, -0.020324266308711633, -0.04560547932568523, -0.026446496395187244, -0.04672709583408303, 0.03089646663930681, 0.0329096753978067, -0.0031386990772767197, 0.0030701529855529466, 0.01198785288983749, -0.0720665372080273, 0.016065222754453618, -0.008565091230492625, -0.06524603068828583, 0.014324400331436967, 0.012642266590976052, 0.03916913395126661, 0.017239611298363242, -0.0022940708117352594, -0.00000737705785367224, -0.013188478122982714, 0.023865339604930744, 0.08236957093079884, -0.019251494202762842, 0.05471697532468372, 0.005972680687490437, 0.040493461613853775, -0.0688300368686517, 0.004474718201284607, -0.04370514086137215, 0.008753968299263053, 0.07228374770945972, 0.007629580582336833, 0.03886009587181939, 0.08576714330249363, -0.021909458562731743, -0.010310174200438067, 0.011320573885718154, 0.05167221174471908, -0.011920124732164873, 0.09136995921532313, 0.07861344681845771, -0.02466051270150476, 0.03293021395802498, -0.031370491824216314, -0.006256768428203132, -0.028057354321289394, -0.001464772762523757, 0.015254409194716977, -0.02345223191918598, -0.11720789555046293, -0.03956084408693843, 0.017618920240137313, 0.02171551130918993, 0.000804237904958427, 0.0040997833841376835, 0.05092603630489773, 0.010734342167981796, -0.024763399010731116, -0.05916011126505004, 0.013965856510266248, -0.015584999747160409, -0.07232196339302593, 0.00037505472492840554, -0.004479492106636624, 0.006297527954706715, -0.043400421945585146, -0.02631447795364592, 0.06060819741752413, 0.06364250307281812, -0.014363453361309238, 0.0452708558489879, 0.02589565556910303, 0.010107092559337616, -0.04670443137486776, -0.054579869016177125, 0.1046515769428677, 0.029628220428195264, 0.019528768439259794, -0.05553832401831945, 0.07381440409355694, -0.06197152224679788, -0.03346837612075938, -0.028401009428004425, 0.045492336774865784, -0.014222729860598015, 0.052605656906962395, 0.028711968515482213, -0.006189175881445408, -0.039265539290176496, 0.017252425456212625, 0.018786909783052072, 0.013216451851702813, -0.07228060687581699, 0.06143035077386432, -0.029247661742071312, -0.07368612289428711, 0.06836203527119425, 0.045540636819269925, -0.06008780002593994, 0.053936791916688286, 0.016778231805397406, -0.006840274158296072, -0.053641265258193016, -0.027871736118363008, 0.025869831843819056, 0.071573406457901, 0.014396547469206981, -0.009195981288535727, -0.07452616840600967, 0.013345200232935086, -0.016935504455533292, 0.049057218349642225, -0.01680893502715561, -0.014038488268852234, -0.022829299352856144, -0.059434341887633, -0.012434359924453828, 0.04231061150009433, 0.01735861397658785, 0.052751378466685615, 0.0359374259
assert.Equal(t, KidsFace, e.Kind())
})
t.Run("Ignored", func(t *testing.T) {
e := Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.0078794
assert.Equal(t, IgnoredFace, e.Kind())
})
t.Run("Regular", func(t *testing.T) {
e := Embedding{-0.037731018, -0.005501065, 0.04339579, 0.050818004, -0.059338734, 0.033849984, -0.006599584, -0.0017643301, 0.049746443, -0.103716515, 0.037138782, -0.0064612515, 0.071909964, 0.013218528, -0.065359734, 0.11057091, 0.031195551, 0.025612833, 0.0075477255, -0.034973715, -0.013490629, -0.08104751, -0.022038054, -0.05304818, 0.008366317, -0.056096837, -0.008484318, 0.049539477, 0.019540254, 0.067417614, -0.027856546, -0.008532138, -0.017063588, -0.00016265438, -0.106199585, 0.03904082, 0.030587498, 0.043008707, -0.015111545, -0.022849092, 0.0025588698, -0.012814152, 0.037556626, -0.0086288145, 0.05265788, 0.011832273, 0.00015048613, -0.0081366515, 0.0013409692, 0.028389124, 0.022627315, -0.015008434, -0.0007749727, 0.013927345, -0.012275729, -0.0090859635, 0.019502806, -0.011900984, 0.016286656, 0.08094661, 0.000306613, -0.06327904, 0.018552454, 0.08885108, -0.07583091, 0.09275318, -0.018484656, 0.074180886, -0.039385945, -0.08063905, -0.05360434, -0.037074074, 0.09909196, 0.025063906, -0.009406389, -0.029612983, -0.018644262, 0.08433939, -0.04466277, -0.07118042, -0.0053266245, -0.07471344, 0.06739151, -0.05399609, 0.03125197, -0.00007781149, -0.04214992, -0.044316035, 0.025013437, 0.031466946, 0.0023496088, 0.042693187, -0.046198968, 0.026152546, -0.017578958, 0.023763098, 0.027511515, -0.05229892, -0.005204117, 0.035853546, -0.031919815, -0.027175877, -0.033706605, 0.018576957, -0.0010251165, -0.006808904, 0.009910016, -0.046926413, -0.02833718, 0.0132687995, -0.033933964, 0.06434295, 0.046245363, 0.044698197, 0.041076522, 0.04224362, -0.050834127, 0.0037004466, 0.061506275, -0.018232772, 0.067569405, 0.048701495, 0.042266034, -0.11045008, 0.03627151, -0.07259142, -0.0027725939, 0.040572345, 0.010365194, -0.018683784, 0.004533848, 0.037213936, -0.050944775, 0.07134523, 0.004012727, 0.036228556, -0.013853831, -0.06910639, -0.011394227, -0.012075533, 0.036311198, -0.02587341, -0.04086224, -0.024498813, -0.019423751, -0.022674281, 0.052483488, 0.026303312, -0.051178075, 0.008410645, 0.039851066, -0.028721321, -0.027934253, -0.029567441, 0.054549955, 0.07423011, -0.07211806, 0.015979288, 0.002092099, 0.049062036, 0.025120452, 0.045975365, 0.025024865, -0.04019101, 0.0013054911, -0.0049644294, 0.0065203104, -0.03237452, -0.020704443, 0.028736785, -0.027353559, 0.07551169, 0.0842262, 0.019992182, 0.11138123, -0.028617613, 0.06700691, -0.048681036, -0.008201593, -0.058066163, 0.027867565, 0.07693089, -0.033642102, -0.05855467, -0.08575646, -0.019721355, 0.018443357, -0.0037373751, 0.032450553, -0.0074002664, -0.028135147, 0.046631414, 0.0192969, -0.0071076434, -0.004898368, 0.011896125, -0.026020564, 0.074016415, -0.033884488, -0.07919758, 0.021606326, -0.0142197255, 0.0807476, 0.03722956, -0.0015949347, 0.008076167, -0.009640628, 0.02341143, 0.015375526, -0.059428506, 0.051759534, 0.028049389, 0.07790443, 0.0478649, 0.09191913, -0.055882096, -0.026637457, 0.01236174, -0.0033003334, 0.008522798, 0.027216703, -0.033221588, -0.028086975, -0.11505473, -0.044336796, 0.013873659, 0.03982099, 0.060988583, -0.07439005, 0.01333661, -0.004818605, 0.02561305, -0.059055943, 0.0081638545, -0.032278564, 0.046092775, 0.025316834, -0.046857174, -0.0341012, 0.04379944, -0.029710777, 0.09238533, 0.009769442, 0.018552538, -0.02632421, 0.033739865, -0.022547472, 0.016400741, -0.05336998, -0.012623122, -0.08303054, -0.010368709, 0.01690871, 0.0014627968, -0.050720602, 0.038742293, -0.065664165, -0.10676187, -0.013403239, 0.075702645, -0.055623896, -0.03871971, -0.042371742, 0.03794916, -0.0590573, -0.002583715, -0.029995736, -0.08144537, -0.043295015, -0.034286328, -0.026538746, 0.01953962, 0.08203153, 0.036415525, 0.045531306, 0.004713152, 0.026550433, -0.0055336948, -0.031087596, -0.01923592, -0.1047651, 0.051826596, -0.009522955, 0.0023846119, -0.030824797, 0.0011774554, 0.03384506, 0.010090165, -0.033521466, -0.052155476, 0.0032979914, -0.004305921, -0.08622774, 0.03262125, 0.06332183, 0.00067599304, 0.01989574, 0.04406689, 0.019945903, -0.003796719, 0.00025200442, -0.010055775, 0.04070448, -0.004082432, -0.026942603, 0.11013
assert.Equal(t, RegularFace, e.Kind())
})
}
func TestEmbedding_Ignored(t *testing.T) {
t.Run("Blur1", func(t *testing.T) {
e := Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.0078794
t.Logf("Blur1 magnitude: %f", e.Magnitude())
t.Logf("Blur1 blacklist dist: %f", IgnoredEmbeddings.Dist(e))
assert.True(t, e.Ignored())
})
t.Run("Blur2", func(t *testing.T) {
e := Embedding{-0.040659550577402115, -0.03220542520284653, 0.05863650515675545, 0.07900159806013107, -0.03954162076115608, -0.03830844908952713, -0.09981349855661392, -0.03843552619218826, 0.021984204649925232, 0.021209893748164177, 0.05058338865637779, 0.026279529556632042, -0.037386082112789154, 0.019860034808516502, 0.01779518648982048, 0.029238300397992134, 0.025665590539574623, 0.053838297724723816, 0.01769574172794819, 0.04497014731168747, -0.0034581704530864954, 0.05082075297832489, 0.00983431376516819, -0.055299241095781326, -0.08863261342048645, 0.026919297873973846, -0.003238844918087125, 0.06171567738056183, -0.006652790121734142, 0.03024955280125141, -0.07668674737215042, 0.02599654719233513, 0.03656956925988197, -0.040286894887685776, -0.07485620677471161, 0.007622404955327511, 0.004450628533959389, 0.022175054997205734, 0.024441875517368317, 0.02038322575390339, -0.008045016787946224, 0.02700800821185112, 0.037923432886600494, 0.037730343639850616, 0.0019298223778605461, -0.025241704657673836, 0.07439867407083511, 0.025373654440045357, -0.062184471637010574, 0.019462162628769875, 0.011163688264787197, 0.05711067467927933, -0.007787591777741909, 0.006090524140745401, -0.01247440930455923, -0.0002892761258408427, -0.022054091095924377, 0.09874352067708969, 0.02230732887983322, -0.03625740855932236, 0.01047681737691164, 0.023006660863757133, -0.03572215884923935, -0.047631122171878815, -0.004130185581743717, 0.13868559896945953, 0.004021449480205774, 0.0056119272485375404, -0.03055204637348652, 0.03540297970175743, 0.08558189123868942, 0.04478949308395386, 0.08267980813980103, 0.0001782427862053737, -0.09348706901073456, 0.01561333891004324, -0.012885896489024162, 0.01995423436164856, -0.06154691055417061, -0.021583547815680504, 0.07658854871988297, 0.03818646818399429, 0.019400358200073242, 0.048004768788814545, 0.03896840661764145, 0.007684631273150444, 0.006036552134901285, 0.061359286308288574, -0.06359504908323288, 0.06033588945865631, 0.003095539752393961, 0.01086103729903698, 0.024172229692339897, 0.035893380641937256, -0.015560186468064785, 0.0011388470884412527, 0.01351285818964243, 0.05575203895568848, -0.006037220358848572, -0.04045598953962326, 0.001389052253216505, -0.02900969795882702, -0.044179223477840424, -0.012978514656424522, 0.036748431622982025, 0.009548956528306007, 0.12157998234033585, -0.027398979291319847, -0.028363993391394615, 0.03085082396864891, -0.03142939507961273, -0.033452536910772324, -0.062204647809267044, 0.03741671144962311, -0.037081167101860046, 0.005499409511685371, 0.042599402368068695, 0.026988882571458817, 0.037901923060417175, 0.026043692603707314, -0.02773086354136467, -0.07317446917295456, 0.000101863632153254, 0.01806195266544819, -0.03163762018084526, -0.049250949174165726, 0.017383672297000885, 0.06737986952066422, -0.018057355657219887, -0.03998659923672676, 0.005807057488709688, -0.028374463319778442, 0.026576239615678787, -0.01071916613727808, -0.05852247774600983, 0.01768427900969982, -0.04401516914367676, 0.0035484740510582924, 0.01177794486284256, 0.029788490384817123, 0.0022414580453187227, 0.012311144731938839, 0.014886411838233471, 0.060596615076065063, -0.00679460633546114, -0.01986791379749775, 0.017852429300546646, -0.03839694708585739, -0.010994594544172287, 0.0516304187476635, 0.06284306943416595, -0.009843732230365276, -0.033825311809778214, 0.010088239796459675, 0.002782990923151374, -0.007669741753488779, 0.0036510066129267216, -0.0347248837351799, -0.034374918788671494, -0.015334841795265675, 0.06460481137037277, -0.01482471451163292, -0.022562984377145767, 0.0660383328795433, 0.039143770933151245, -0.04959432780742645, -0.04688224941492081, -0.08884536474943161, 0.035801686346530914, -0.011035206727683544, -0.048159871250391006, -0.012846723198890686, -0.08550407737493515, -0.02462676912546158, -0.05736429616808891, -0.023693742230534554, 0.06937230378389359, 0.008348439820110798, 0.046880267560482025, -0.007452292367815971, -0.026880638673901558, -0.02645084448158741, -0.008707266300916672, 0.039963752031326294, -0.039603643119335175, 0.0
t.Logf("Blur2 magnitude: %f", e.Magnitude())
t.Logf("Blur2 blacklist dist: %f", IgnoredEmbeddings.Dist(e))
assert.True(t, e.Ignored())
})
}
func TestEmbedding_CanMatch(t *testing.T) {
t.Run("Noise", func(t *testing.T) {
e := Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.0078794
assert.False(t, e.CanMatch())
})
t.Run("RealPerson1", func(t *testing.T) {
e := Embedding{-0.037731018, -0.005501065, 0.04339579, 0.050818004, -0.059338734, 0.033849984, -0.006599584, -0.0017643301, 0.049746443, -0.103716515, 0.037138782, -0.0064612515, 0.071909964, 0.013218528, -0.065359734, 0.11057091, 0.031195551, 0.025612833, 0.0075477255, -0.034973715, -0.013490629, -0.08104751, -0.022038054, -0.05304818, 0.008366317, -0.056096837, -0.008484318, 0.049539477, 0.019540254, 0.067417614, -0.027856546, -0.008532138, -0.017063588, -0.00016265438, -0.106199585, 0.03904082, 0.030587498, 0.043008707, -0.015111545, -0.022849092, 0.0025588698, -0.012814152, 0.037556626, -0.0086288145, 0.05265788, 0.011832273, 0.00015048613, -0.0081366515, 0.0013409692, 0.028389124, 0.022627315, -0.015008434, -0.0007749727, 0.013927345, -0.012275729, -0.0090859635, 0.019502806, -0.011900984, 0.016286656, 0.08094661, 0.000306613, -0.06327904, 0.018552454, 0.08885108, -0.07583091, 0.09275318, -0.018484656, 0.074180886, -0.039385945, -0.08063905, -0.05360434, -0.037074074, 0.09909196, 0.025063906, -0.009406389, -0.029612983, -0.018644262, 0.08433939, -0.04466277, -0.07118042, -0.0053266245, -0.07471344, 0.06739151, -0.05399609, 0.03125197, -0.00007781149, -0.04214992, -0.044316035, 0.025013437, 0.031466946, 0.0023496088, 0.042693187, -0.046198968, 0.026152546, -0.017578958, 0.023763098, 0.027511515, -0.05229892, -0.005204117, 0.035853546, -0.031919815, -0.027175877, -0.033706605, 0.018576957, -0.0010251165, -0.006808904, 0.009910016, -0.046926413, -0.02833718, 0.0132687995, -0.033933964, 0.06434295, 0.046245363, 0.044698197, 0.041076522, 0.04224362, -0.050834127, 0.0037004466, 0.061506275, -0.018232772, 0.067569405, 0.048701495, 0.042266034, -0.11045008, 0.03627151, -0.07259142, -0.0027725939, 0.040572345, 0.010365194, -0.018683784, 0.004533848, 0.037213936, -0.050944775, 0.07134523, 0.004012727, 0.036228556, -0.013853831, -0.06910639, -0.011394227, -0.012075533, 0.036311198, -0.02587341, -0.04086224, -0.024498813, -0.019423751, -0.022674281, 0.052483488, 0.026303312, -0.051178075, 0.008410645, 0.039851066, -0.028721321, -0.027934253, -0.029567441, 0.054549955, 0.07423011, -0.07211806, 0.015979288, 0.002092099, 0.049062036, 0.025120452, 0.045975365, 0.025024865, -0.04019101, 0.0013054911, -0.0049644294, 0.0065203104, -0.03237452, -0.020704443, 0.028736785, -0.027353559, 0.07551169, 0.0842262, 0.019992182, 0.11138123, -0.028617613, 0.06700691, -0.048681036, -0.008201593, -0.058066163, 0.027867565, 0.07693089, -0.033642102, -0.05855467, -0.08575646, -0.019721355, 0.018443357, -0.0037373751, 0.032450553, -0.0074002664, -0.028135147, 0.046631414, 0.0192969, -0.0071076434, -0.004898368, 0.011896125, -0.026020564, 0.074016415, -0.033884488, -0.07919758, 0.021606326, -0.0142197255, 0.0807476, 0.03722956, -0.0015949347, 0.008076167, -0.009640628, 0.02341143, 0.015375526, -0.059428506, 0.051759534, 0.028049389, 0.07790443, 0.0478649, 0.09191913, -0.055882096, -0.026637457, 0.01236174, -0.0033003334, 0.008522798, 0.027216703, -0.033221588, -0.028086975, -0.11505473, -0.044336796, 0.013873659, 0.03982099, 0.060988583, -0.07439005, 0.01333661, -0.004818605, 0.02561305, -0.059055943, 0.0081638545, -0.032278564, 0.046092775, 0.025316834, -0.046857174, -0.0341012, 0.04379944, -0.029710777, 0.09238533, 0.009769442, 0.018552538, -0.02632421, 0.033739865, -0.022547472, 0.016400741, -0.05336998, -0.012623122, -0.08303054, -0.010368709, 0.01690871, 0.0014627968, -0.050720602, 0.038742293, -0.065664165, -0.10676187, -0.013403239, 0.075702645, -0.055623896, -0.03871971, -0.042371742, 0.03794916, -0.0590573, -0.002583715, -0.029995736, -0.08144537, -0.043295015, -0.034286328, -0.026538746, 0.01953962, 0.08203153, 0.036415525, 0.045531306, 0.004713152, 0.026550433, -0.0055336948, -0.031087596, -0.01923592, -0.1047651, 0.051826596, -0.009522955, 0.0023846119, -0.030824797, 0.0011774554, 0.03384506, 0.010090165, -0.033521466, -0.052155476, 0.0032979914, -0.004305921, -0.08622774, 0.03262125, 0.06332183, 0.00067599304, 0.01989574, 0.04406689, 0.019945903, -0.003796719, 0.00025200442, -0.010055775, 0.04070448, -0.004082432, -0.026942603, 0.11013
assert.True(t, e.CanMatch())
})
t.Run("RealPerson2", func(t *testing.T) {
e := Embedding{0.05743743, 0.06322246, 0.04731233, -0.01582013, -0.014022472, 0.028749773, -0.079572044, 0.010417165, 0.012425559, -0.013655686, -0.05018789, 0.026249807, 0.037449032, 0.051438555, -0.055292394, 0.018136416, 0.035481997, 0.021924775, 0.0449153, -0.046709806, 0.025960712, -0.063309774, 0.037570722, 0.0053055496, 0.07164356, -0.058082405, 0.0017537506, 0.05310737, 0.008366767, 0.001858572, -0.0444527, -0.04880738, -0.033274952, -0.08379612, -0.018964237, -0.0029277618, -0.021386296, 0.0375952, -0.034034044, -0.060141306, -0.0727236, 0.05060482, -0.082235344, 0.04422095, 0.074947104, 0.020209799, 0.0017703519, -0.015411033, 0.012017898, 0.02179871, -0.013231191, -0.08483583, 0.0057485234, -0.019012775, -0.04857383, 0.084329374, 0.009039854, 0.040807534, -0.01692938, 0.0017201875, 0.036594935, -0.08844029, -0.00285713, 0.054565318, -0.047155175, 0.017556412, 0.009818504, 0.113506615, -0.009222306, -0.0004704829, -0.0005908021, 0.023356704, 0.015126567, 0.035651624, 0.025497274, -0.10676789, -0.06828348, 0.112095155, 0.08150907, 0.0007053766, -0.008199173, -0.03852071, 0.029535439, -0.030568745, -0.08978221, -0.004848515, -0.03737906, 0.036448833, 0.004548617, 0.08181337, -0.0087715015, 0.02876368, -0.0060202847, -0.013462866, -0.05015226, -0.03569624, 0.049505115, 0.011994855, -0.010969182, -0.0038046215, -0.004821639, 0.01422656, -0.05946822, -0.013812223, 0.039755587, 0.034921456, -0.05158028, -0.0008751564, -0.031674784, -0.002480392, 0.013109971, -0.017252844, 0.064675435, 0.07642624, 0.08362122, 0.030908048, 0.067052245, 0.021291262, 0.01784629, -0.0507172, 0.052007917, 0.04663132, 0.0064223176, -0.027726524, 0.08033194, 0.038676508, 0.018382965, 0.048913725, -0.022436062, 0.0056725373, -0.040102404, 0.037674494, -0.022307452, -0.03098931, 0.0577183, -0.022725038, -0.0055031423, 0.045162845, -0.014300147, -0.018093627, -0.040114313, -0.051383376, -0.030573318, -0.101557806, -0.008447289, 0.014637746, 0.050047614, -0.011550598, 0.027773034, -0.03317795, -0.048737925, -0.02800452, -0.016925864, -0.037572905, 0.025179392, 0.031473313, -0.010588548, -0.0119464, 0.0057186596, 0.049826983, -0.026282294, -0.00095309806, 0.04696705, -0.0444816, -0.04687481, -0.05711774, 0.07398202, -0.0066416007, -0.016446855, 0.051111717, -0.0419391, -0.013271554, 0.043318115, 0.0012680996, 0.037176434, -0.021031545, 0.03968714, 0.048614495, -0.0058204047, -0.010237752, 0.07029732, 0.018752169, -0.0616816, 0.008854898, 0.06205655, -0.009874518, -0.050585378, 0.012557405, 0.01626891, 0.017797807, -0.03568621, -0.007182635, 0.015247179, 0.02795279, 0.009831571, 0.045041207, -0.055870973, -0.025731718, 0.01907759, -0.034226514, 0.029678043, -0.021697098, -0.020734878, 0.057307053, -0.008900531, -0.019598745, -0.03082626, 0.014591779, 0.06420119, -0.059627317, -0.03732171, 0.016718497, -0.0027331563, 0.013793794, 0.06873449, 0.031878877, -0.025323479, 0.017207827, -0.00025769856, 0.01302832, -0.033877812, 0.1036087, -0.031368185, -0.0062403507, -0.020410763, 0.064998895, -0.049161144, 0.075556606, -0.005309279, 0.024778325, -0.055955246, -0.053952686, 0.04611469, -0.040877238, 0.0366899, 0.05907716, -0.023292458, -0.081198305, 0.078474045, 0.050623402, -0.06233864, 0.07453958, 0.0152983265, -0.04816594, 0.023196025, -0.03438517, -0.024680838, -0.04664079, 0.054698855, 0.0038191404, 0.0024043208, 0.0034349218, -0.03711057, 0.001107596, -0.0028691792, 0.00030419108, 0.037632354, 0.060571946, -0.0946064, 0.042204216, -0.037838906, 0.021439435, -0.076814726, 0.06236704, 0.012242562, -0.061841127, 0.016115433, -0.063648604, 0.025584254, 0.10527214, -0.079565875, 0.008840051, 0.06655628, -0.0051484755, -0.08278825, -0.023478502, 0.0713399, -0.018204115, 0.048147563, -0.12774643, -0.014040633, 0.052833144, 0.0025820592, 0.029898077, 0.09640923, 0.08246072, 0.02947083, -0.015254255, -0.05879318, -0.08034651, -0.03984985, -0.008921548, 0.0035848247, 0.01210673, 0.01669468, -0.011540037, 0.043646365, 0.12930681, 0.028525097, -0.033249676, 0.009854595, 0.020683004, -0.03317388, 0.030189851, -0.037221596, 0.056988247, 0.028217647, -0.098849
assert.True(t, e.CanMatch())
})
}
func TestEmbedding_SkipMatching(t *testing.T) {
t.Run("True", func(t *testing.T) {
e := Embedding{-0.00959064718335867, 0.03787063807249069, -0.0030881548300385475, 0.02789853885769844, 0.017454572021961212, 0.0396987721323967, -0.03091704286634922, 0.005318029318004847, 0.021617550402879715, -0.08214963972568512, -0.003952134400606155, 0.0269720908254385, 0.048880551010370255, -0.03537372127175331, -0.042236171662807465, 0.021553633734583855, 0.03937383368611336, 0.01815507560968399, 0.08373168110847473, -0.11838400363922119, -0.038254253566265106, -0.04993032291531563, 0.07148619741201401, 0.006384310312569141, 0.05344310402870178, -0.027579499408602715, 0.021648988127708435, -0.07013172656297684, -0.06400937587022781, 0.10622639954090118, -0.01507984846830368, -0.02844894863665104, -0.013048898428678513, -0.03571505844593048, -0.022063886746764183, 0.022826166823506355, 0.01703103445470333, 0.00679031852632761, -0.09583312273025513, 0.03446732088923454, -0.045221585780382156, 0.03292521834373474, -0.012820744886994362, 0.06122862547636032, 0.01973198726773262, -0.013975882902741432, 0.027514882385730743, 0.12478502094745636, -0.09630053490400314, -0.008597812615334988, -0.019534612074494362, 0.03927983343601227, 0.04311678186058998, 0.025297729298472404, -0.035719674080610275, 0.05421024188399315, 0.07541341334581375, 0.040334682911634445, -0.0632546916604042, -0.004164006095379591, 0.027950556948781013, 0.017827920615673065, 0.02774866297841072, -0.025094853714108467, 0.00012262807285878807, 0.04165732488036156, -0.03155842795968056, 0.03801475837826729, 0.0031508952379226685, -0.011753040365874767, 0.06262513995170593, 0.05895991623401642, -0.02384188584983349, -0.025149181485176086, -0.016906173899769783, -0.03138834610581398, -0.06759334355592728, 0.018074069172143936, 0.028748946264386177, 0.03350280225276947, 0.001738330232910812, -0.035873714834451675, 0.0050230612978339195, -0.005394259933382273, -0.035111431032419205, 0.005703517701476812, -0.060869812965393066, 0.044046416878700256, 0.05451945215463638, -0.0012109529925510287, 0.04929054155945778, 0.03312966600060463, -0.02503111958503723, -0.0699458047747612, 0.09152142703533173, -0.035196661949157715, -0.02000804804265499, 0.003603762947022915, -0.0549810416996479, 0.041149843484163284, 0.019640415906906128, -0.06913350522518158, -0.08494774252176285, 0.047828249633312225, 0.011485084891319275, 0.11441357433795929, 0.012079037725925446, 0.026444999501109123, 0.008605830371379852, -0.014796323142945766, 0.042191699147224426, 0.0360623262822628, -0.01067506056278944, -0.02117612026631832, -0.0003311904729343951, 0.020912105217576027, 0.02051572874188423, 0.04119933396577835, 0.011461400426924229, 0.02468070574104786, -0.030830683186650276, -0.024522947147488594, 0.07760800421237946, -0.044838037341833115, 0.007875975221395493, 0.03662760183215141, -0.031315844506025314, 0.028968002647161484, -0.007360775955021381, -0.052097514271736145, 0.004892056342214346, 0.0051552411168813705, 0.058972474187612534, -0.05307154729962349, -0.02330617979168892, 0.0560041144490242, -0.06173492223024368, 0.00004632262425730005, 0.007912986911833286, 0.0031768144108355045, -0.08211413770914078, -0.02641596458852291, -0.07240095734596252, -0.04998013749718666, 0.016048355028033257, -0.023686233907938004, 0.08416120707988739, 0.002466161735355854, 0.0017551603959873319, 0.000651281327009201, 0.018105899915099144, -0.05974912270903587, -0.03980677202343941, 0.019075721502304077, 0.0014616637490689754, 0.06682229787111282, 0.02257758192718029, 0.04021807014942169, 0.09144134074449539, 0.020396307110786438, 0.055604636669158936, 0.026022544130682945, -0.03050902672111988, 0.011569516733288765, -0.014519683085381985, 0.0038184933364391327, -0.03115340694785118, 0.029596896842122078, -0.055038318037986755, -0.005584381986409426, -0.015937503427267075, -0.01591162569820881, 0.034234486520290375, 0.010233158245682716, 0.0364360548555851, 0.02957785315811634, 0.038372594863176346, -0.04782934859395027, -0.03462134674191475, -0.0432763509452343, -0.041607096791267395, 0.019871780648827553, -0.026665959507226944, 0.046689242124557495, 0.020541366189718246, 0.03362491
assert.True(t, e.SkipMatching())
})
t.Run("False", func(t *testing.T) {
e := Embedding{0.004882930312305689, -0.028871430084109306, -0.014925234951078892, 0.042015232145786285, 0.03289106860756874, 0.00047218144754879177, -0.04626072198152542, 0.08869951218366623, -0.08738508075475693, 0.041352055966854095, 0.025143291801214218, 0.027804607525467873, 0.03851303085684776, 0.059128664433956146, 0.029246464371681213, -0.01177206914871931, -0.055604543536901474, 0.04581688344478607, -0.021625488996505737, 0.014038625173270702, 0.04526897147297859, -0.003151113400235772, 0.01755913719534874, -0.016582749783992767, -0.04034445434808731, 0.03751881793141365, 0.11246222257614136, 0.025973817333579063, 0.046221256256103516, -0.03560330346226692, 0.010319976136088371, -0.06042899936437607, -0.02092718705534935, -0.015790656208992004, -0.015058585442602634, -0.031521182507276535, -0.014863084070384502, 0.09852202981710434, -0.026713669300079346, -0.09230262786149979, -0.0645485445857048, 0.03376315161585808, -0.016680343076586723, -0.0032860636711120605, 0.0289445947855711, -0.04086116701364517, 0.01185047347098589, -0.03036908246576786, -0.050068069249391556, 0.0013629610184580088, -0.10402216762304306, 0.020886534824967384, 0.06360501796007156, -0.038404129445552826, -0.10402511060237885, 0.019234996289014816, -0.0301763117313385, 0.04926493763923645, -0.014555397443473339, 0.023388627916574478, 0.045102808624506, -0.07065623998641968, 0.01779104769229889, 0.04318133369088173, 0.006222338881343603, -0.03631843626499176, 0.005155006889253855, -0.03126167878508568, 0.02961049973964691, 0.042098451405763626, -0.05473579093813896, -0.030505038797855377, 0.05462753400206566, -0.018857350572943687, -0.013100373558700085, 0.024632159620523453, -0.029910949990153313, -0.06632661819458008, 0.04453831911087036, -0.050670187920331955, 0.037967462092638016, 0.07036780565977097, 0.07603567838668823, 0.02958795428276062, -0.06687693297863007, 0.030427396297454834, 0.040562309324741364, 0.081810861825943, -0.01210289727896452, -0.027030745521187782, -0.08186805993318558, 0.017522599548101425, -0.07442684471607208, 0.032609228044748306, -0.008241117000579834, -0.02420344017446041, 0.010065721347928047, -0.07006815820932388, -0.023965315893292427, -0.095053531229496, -0.0066795386373996735, -0.007384734693914652, 0.017342889681458473, 0.048182494938373566, -0.007601919583976269, -0.034079138189554214, -0.06012185662984848, -0.048203855752944946, -0.00012411877105478197, -0.0702674463391304, -0.053258661180734634, 0.09610331803560257, -0.08409681171178818, 0.0006605522357858717, 0.09284624457359314, -0.003066445467993617, -0.01669788733124733, 0.07133719325065613, -0.001136226230300963, -0.038388170301914215, 0.036363981664180756, -0.03186909109354019, -0.011004592292010784, -0.04703499376773834, -0.033754657953977585, 0.009894444607198238, -0.0651240348815918, 0.07229526340961456, 0.018740307539701462, -0.021803900599479675, 0.012212129309773445, 0.022386791184544563, 0.05509564280509949, -0.002009343821555376, 0.052710991352796555, -0.03911963477730751, 0.0037262304686009884, 0.04576747119426727, -0.06396473199129105, 0.016327453777194023, -0.01841137744486332, 0.08133656531572342, 0.027454890310764313, 0.017934516072273254, -0.05057291314005852, 0.05975693091750145, -0.007352042011916637, 0.00653004040941596, 0.045967090874910355, 0.0636090412735939, -0.04789235070347786, 0.020336657762527466, 0.003387229749932885, -0.036981452256441116, -0.005459815263748169, -0.015007982961833477, -0.046427641063928604, -0.0265751201659441, -0.02166137658059597, -0.04442169517278671, -0.0388776957988739, 0.014315947890281677, 0.07145505398511887, 0.023914091289043427, -0.009579996578395367, 0.000555231177713722, -0.07929696887731552, -0.04671946167945862, 0.04548916965723038, 0.04007089138031006, 0.0777222141623497, -0.05238672345876694, -0.03217660263180733, 0.010117340832948685, -0.07449944317340851, -0.021306153386831284, -0.041546110063791275, 0.004237184766680002, 0.009483197703957558, 0.06297741830348969, -0.000040676473872736096, -0.0072582196444272995, 0.027166014537215233, -0.03531072288751602, 0.04809935390949249, -0
assert.False(t, e.SkipMatching())
})
}
func TestUnmarshalEmbedding(t *testing.T) {
t.Run("Success", func(t *testing.T) {
emb, err := UnmarshalEmbedding("[-0.013,-0.031]")
assert.NoError(t, err)
assert.Equal(t, Embedding{-0.013, -0.031}, emb)
})
t.Run("NoPrefix", func(t *testing.T) {
emb, err := UnmarshalEmbedding("-0.013,-0.031]")
assert.Error(t, err)
assert.Nil(t, emb)
})
t.Run("InvalidValues", func(t *testing.T) {
emb, err := UnmarshalEmbedding("[true, false]")
assert.Error(t, err)
assert.Equal(t, Embedding{0, 0}, emb)
})
}