In-Browser Semantic AI Search with PGlite and Transformers.js

29 Aug 2024

11 minute read

A couple of weeks ago during Launch Week 12 we introduced a new in-browser Postgres sandbox experience built in collaboration with the ElectricSQL team utilizing PGlite to run Postgres and the pgvector extension in the browser.

This gave me the idea to try and build a fully local, in-browser semantic search experience, utilising

  • PGlite to store text and embeddings locally in IndexedDB.
  • pgvector to perform inner product search.
  • Hunggingface's Transformers.js with Supabase/gte-small to generate embeddings.

I'm thinking, something like this can be great for eCommerce sites that want to surface relevant products for user's searches quickly without needing a server roundtrip, or quickly showing similar products to the customer. Any other use cases you can think of? Tweet them at us!

Watch the video guide to see the demo in action, or test it out yourself in this Huggingface Space!

Install the dependencies

In this example we'll be using a simple static React application. If you're starting from scratch, you can use vite create to get started:


_10
npm create vite@latest

Then go ahead and install the required dependencies: @electric-sql/pglite and @huggingface/transformers:


_10
npm install @electric-sql/pglite @huggingface/transformers

Create the Database schema

Next, create a utils/db.js file to set up the database schema:

utils/db.js

_41
import { PGlite } from '@electric-sql/pglite'
_41
import { vector } from '@electric-sql/pglite/vector'
_41
_41
let dbInstance
_41
// Implement a singleton pattern to make sure we only create one database instance.
_41
export async function getDB() {
_41
if (dbInstance) {
_41
return dbInstance
_41
}
_41
const metaDb = new PGlite('idb://supa-semantic-search', {
_41
extensions: {
_41
vector,
_41
},
_41
})
_41
await metaDb.waitReady
_41
dbInstance = metaDb
_41
return metaDb
_41
}
_41
_41
// Initialize the database schema.
_41
export const initSchema = async (db) => {
_41
return await db.exec(`
_41
create extension if not exists vector;
_41
-- drop table if exists embeddings; -- Uncomment this line to reset the database
_41
create table if not exists embeddings (
_41
id bigint primary key generated always as identity,
_41
content text not null,
_41
embedding vector (384)
_41
);
_41
_41
create index on embeddings using hnsw (embedding vector_ip_ops);
_41
`)
_41
}
_41
_41
// Helper method to count the rows in a table.
_41
export const countRows = async (db, table) => {
_41
const res = await db.query(`SELECT COUNT(*) FROM ${table};`)
_41
return res.rows[0].count
_41
}
_41
_41
// [...]

In your App.jsx file, set up the state and reference variables to set up the database:

App.jsx

_34
import { getDB, initSchema, countRows } from './utils/db'
_34
import { useState, useEffect, useRef, useCallback } from 'react'
_34
_34
export default function App() {
_34
const [content, setContent] = useState([])
_34
const initailizing = useRef(false)
_34
// Create a reference to the worker object.
_34
const worker = useRef(null)
_34
_34
// Set up DB
_34
const db = useRef(null)
_34
useEffect(() => {
_34
const setup = async () => {
_34
initailizing.current = true
_34
db.current = await getDB()
_34
await initSchema(db.current)
_34
let count = await countRows(db.current, 'embeddings')
_34
_34
if (count === 0) {
_34
// TODO: seed the database.
_34
}
_34
// Get Items
_34
const items = await db.current.query('SELECT content FROM embeddings')
_34
setContent(items.rows.map((x) => x.content))
_34
}
_34
if (!db.current && !initailizing.current) {
_34
setup()
_34
}
_34
}, [])
_34
_34
// [...]
_34
_34
return <pre>{JSON.stringify(content)}</pre>
_34
}

Seed the Database with text and embeddings

There are various ways of generating the embeddings to seed your database. For example you could use a Database webhook in Supabase anytime a new item is inserted into the database. You can find an example for this here.

For easy prototyping, you can use postgres.new to generate sample data, including embeddings, and then copy and paste that into your application.

Add this seedDB method to your utils/db.js file:

utils/db.js

_21
// [...]
_21
_21
export const seedDb = async (db) => {
_21
return await db.exec(`
_21
insert into embeddings (content, embedding) values
_21
('Bed', '[-0.006822244,-0.0073390524,0.040399525,0.000736064,-0.009085903,0.03851906,0.040384453,0.046808533,0.042115353,0.0016632339,-0.0034933984,-0.08830318,0.010509381,0.058803126,-0.001959153,-0.015982354,0.0057063154,0.013070074,-0.047947004,0.049101133,0.04977712,-0.01529147,0.02679988,-0.016667083,0.02259381,-0.019300632,-0.022183467,-0.0524223,-0.05392063,-0.15442617,-0.016726814,-0.0046356786,-0.0033007693,-0.038389646,0.0034641414,-0.019414157,0.00530319,0.059465468,0.014079502,0.029850144,0.038306333,0.01192391,0.004093596,-0.08163046,-0.012357966,-0.006009865,-0.013621683,-0.02337859,0.08280816,0.010447533,0.03683234,-0.028687134,0.01815019,-0.008677378,0.042089492,0.05065854,0.07357729,0.011352438,0.034780625,0.09188656,0.017418442,0.064832725,-0.20041808,0.10360221,0.0671062,0.018502504,-0.09739072,-0.00019951521,0.022652537,0.06734662,-0.027538104,-0.016570838,0.015677454,0.053861156,0.048691154,-0.054969806,0.04112108,-0.04718161,0.025326118,-0.010980256,-0.007515454,-0.007403816,-0.042940833,-0.013452556,-0.028590562,-0.0272049,-0.018576223,-0.019168183,0.012477406,-0.010323304,-0.025437333,0.026618486,-0.04006101,0.052304097,-0.029081466,-0.020374913,-0.0058097104,0.0049184063,-0.025047028,0.24331976,-0.028509228,0.064583465,0.0582664,-0.008838904,0.029010272,-0.042640913,-0.023065887,0.0009429337,-0.03458494,0.031521663,-0.024115514,0.022468511,0.017324978,-0.021598602,0.057364237,-0.03622212,0.06522789,0.03643067,0.019802976,-0.03882662,-0.024954926,-0.00922944,0.026700335,0.0022999484,0.021236164,-0.1017225,0.034700826,0.10996454,0.015752304,-0.010611508,0.016026804,-0.008537629,-0.025187723,-0.011628215,-0.012928679,0.050661393,0.027768211,0.012645961,-0.014378526,-0.03122859,-0.054974407,-0.11988388,0.010854659,-0.113561414,-0.05754862,0.04890203,-0.074521095,0.042206623,-0.047778264,0.027690561,-0.02492779,0.04351375,-0.0042421916,-0.013825208,0.029148908,0.024689274,-0.0011065236,0.010749134,-0.02179892,0.030476885,0.005788956,-0.011307971,-0.029803434,0.047130115,-0.016205732,-0.07745564,-0.06069879,0.012738268,0.008780021,-0.04605315,0.05029989,0.051564094,-0.06556095,0.0097619705,0.07852359,0.03755774,6.385107e-05,-0.025080299,-0.00807334,0.002826086,0.029596226,-0.06858373,-0.059509,0.042350702,0.008429371,-0.056518193,-0.0038923442,0.0019655668,0.042615306,0.03156147,0.020491784,0.025043039,-0.014860392,-0.04517383,-0.05519179,-0.067039765,-0.01814679,-0.02211169,0.011379715,-0.038663853,0.074394055,-0.0033453933,-0.01922349,0.03422448,0.03382803,0.06018736,-0.040258747,-0.016005179,0.04973765,0.00047837297,-0.0032964202,-0.018018955,0.059821125,-0.02552337,-0.050962154,0.033526286,0.0015766671,0.0008125402,0.055109553,0.035740905,0.06790532,-0.10467817,-0.06608197,-0.22082354,0.04529764,0.04231412,-0.06357316,0.06083306,-0.03584259,-0.045060553,-0.034747567,-0.011515003,0.023540512,0.092857406,-0.015673747,-0.037912108,0.03791529,-0.027737431,0.075638145,0.064396635,0.00039346732,-0.054100823,-0.04585783,-0.013354809,-0.00029281477,-0.03531705,-0.013202513,0.025100702,-0.022423482,0.22803828,0.021944992,0.062074866,-0.033807088,0.063471064,0.058585603,-0.034941155,-0.153415,0.05968843,0.043823935,0.02648161,-0.035211023,-0.027928075,-0.08642302,-0.03428572,0.0782574,0.0048829336,-0.07674112,-0.014943502,-0.0026991852,-0.051111754,-0.02639702,-0.028578043,0.04409947,0.016471509,-0.0153481895,0.05080286,0.035896562,-0.026176613,-0.00410023,-0.054971956,0.0072062816,-0.010886078,0.03109176,0.0062575233,-0.059884343,0.03391246,-0.021350292,0.028362656,-0.03287903,-0.02909052,-0.054189354,0.040938597,-0.043358773,-0.0062902463,0.038029272,-0.017994935,-0.02783497,0.059119657,0.04149558,0.049971994,0.012019358,-0.034788415,-0.034991883,0.037606157,-0.07293067,0.00878965,0.020748338,0.006832928,0.014310711,0.0025819188,-0.026033923,0.063590325,-0.023910472,0.026275495,0.006421037,-0.025870698,-0.03395694,0.013277425,-0.017819595,-0.27904364,0.042438418,-0.040410627,0.060995445,-0.03024428,0.023125576,0.026820898,0.07209522,-0.045738053,0.021097308,0.018815981,0.048715215,-0.0140842525,0.01586625,-0.00600374,0.057657298,0.07749236,-0.04184785,0.04569934,-0.017640881,-0.03221387,0.040331382,0.23157857,-0.022834923,0.043734368,0.015736328,-0.018165922,0.04427944,0.031467006,0.0013029817,0.016038246,0.032582633,0.087903075,-0.0579502,0.034907967,0.056975555,-0.061623715,0.03723524,0.037153512,-0.059985436,-0.048163902,-0.005239113,-0.03370352,-0.024089405,0.082422175,-0.0325414,-0.021374922,-0.05650002,0.00010377556,-0.046514522,-0.061216045,-0.016242305,-0.02899706,0.020795047,0.03967546,0.003870585,-0.024333557,-0.022179967,-0.046025176,-0.026946675,-0.02249182,-0.07122435,-0.042746153,0.010575632,-0.0070871795]'),
_21
('Car', '[-0.013675096,0.027324528,0.06942244,0.0013266953,-0.020453496,0.061512772,0.07301235,0.04290585,0.0023934839,-0.0186373,0.012499963,-0.093231946,0.028258853,0.07755444,0.025344418,-0.013358756,0.023283212,0.027902517,-0.032629456,-0.018587576,0.022121359,-0.01931578,-0.020892585,-0.07198824,0.0230901,0.058177892,-0.020588726,-0.020963376,-0.05223263,-0.13351677,-0.020541323,-0.034604687,0.05377937,0.015278223,-0.059128493,-0.054362193,-0.06885301,0.028906692,-0.052341137,0.01598179,0.027373223,0.015316855,-0.07678603,-0.053560868,-0.013568181,-0.0028432393,0.0071754334,0.020171847,0.07315126,-0.07514821,0.034036174,-0.017486328,0.014351431,0.004913182,-0.03727606,0.022707878,0.04719973,0.012032776,0.04482492,0.024352394,0.022039536,0.0637522,-0.22861159,0.055107087,0.07447692,0.0291307,-0.041218065,-0.040351745,0.047432993,0.054303292,-0.023342311,-0.016348358,0.0017851957,0.08988982,0.02769922,-0.049907178,-0.027979424,-0.042212185,-0.020770581,-0.021024825,0.029763328,-0.053642657,-0.066037476,-0.026011113,-0.010575339,-0.047937546,0.012322384,-0.056541797,0.029350977,0.014430247,-0.045942552,0.02386634,0.0029833463,0.0141003905,-0.05075455,-0.014572922,-0.008882929,-0.032623354,-0.050203778,0.26171875,-0.021519234,0.049280297,0.04079181,-0.028314121,-0.013227541,-0.012881829,-0.035419036,0.013379328,-0.030239435,0.04186359,0.017268283,-0.000105469044,0.0125124715,-0.082406625,0.034267884,-0.016504455,0.038922243,0.06633839,0.006251055,0.00037995656,-0.001207575,0.02512416,0.02109219,-0.02958561,0.0013164878,-0.103339866,0.04863308,0.11800187,0.034086462,0.037300617,0.056644727,-0.037418414,-0.061853807,-0.022136258,-0.019294702,0.017083716,0.012703508,0.015861439,-0.022639215,-0.007921711,-0.0544705,-0.12781276,-0.01872742,-0.123899914,-0.037989907,0.039830185,-0.05202418,0.05241696,-0.056093507,0.0136191305,-0.026056947,0.048660703,-0.0140545815,-0.0027107827,0.026319232,0.0021281333,0.04325188,0.058733158,-0.04723551,0.0404873,-0.034551904,-0.03205584,-0.053433474,0.06742306,-0.01232912,-0.08600591,-0.017429007,0.029419081,0.0026076722,0.013392961,0.03677887,0.031694457,-0.0720888,0.051425304,0.08350261,0.0315462,-0.004771196,0.034244526,-0.010683566,0.0025684177,0.028690292,0.010577877,-0.052667093,0.06373304,0.059627198,-0.019951789,-0.052819874,-0.0048726257,0.013962882,0.054299265,0.040887468,0.061755426,0.007373504,-0.0075591686,-0.062904865,-0.007323224,-0.016505266,-0.033703998,0.0016645732,-0.021243243,0.037611052,-0.020470953,-0.023737112,0.039098095,-0.0017488332,-0.038300857,-0.045891576,-0.016960371,0.022000503,0.043613117,-0.05976287,-0.0041191196,0.0744647,-0.0018894378,-0.03981402,0.012990376,-0.045962907,0.04994432,0.028742177,0.05744724,0.0009102008,-0.08285415,-0.03267054,-0.2337071,0.0072381077,-0.032779843,-0.024238953,0.041009203,-0.05101638,0.03943452,-0.02855554,0.04525813,0.046112273,0.05932983,-0.022565039,-0.009743857,0.061256465,-0.03037518,0.05372682,-0.010801566,0.01609313,-0.0061583905,0.042392224,-0.021107364,0.0141626885,-0.047603372,-0.057255138,0.040890433,-0.011722571,0.24564229,0.027296212,0.019367144,-0.016961388,0.06517703,0.043743007,-0.036653895,-0.055930916,0.013116146,-0.016756361,0.0140022235,-0.002970313,-0.070724085,-0.057791047,-0.013434504,0.029526964,-0.00938867,-0.05977423,0.00040445486,-0.014813439,-0.029890385,0.009259244,-0.027084075,0.041800242,0.06727153,-0.0014996758,-0.00021284568,0.016413646,0.0063286186,-0.019270584,-0.06787658,0.029184967,0.0017431147,0.0158079,-0.019558495,-0.04962892,0.017410701,-0.034534313,0.019038094,0.006610072,-0.04343159,-0.031567868,-0.009124138,-0.036709126,-0.015360762,0.10293102,-0.010821659,-0.015772903,0.07758905,-0.015194392,0.060196437,0.010410943,-0.021493688,-0.06867113,0.0474313,-0.017747577,0.042234425,0.05141044,0.057146773,0.006755126,0.049838375,-0.043111365,0.0029671746,-0.026369067,0.03549969,0.0017129052,-0.028317036,-0.05324385,0.039201375,-0.017168764,-0.2772981,0.04778095,-0.0069068763,0.06153518,-0.041531466,-0.0171643,0.013447191,0.03850731,-0.07578842,-0.029888023,0.012730036,0.03311835,0.059252515,0.040407978,-0.0048704417,0.043922015,0.05727722,-0.019122923,0.06540934,-0.008338455,0.010299639,0.053547956,0.20795242,-0.013018652,0.056953296,0.025129227,-0.018750485,0.008330987,0.02540996,-0.0045585097,0.038341187,0.035392124,0.0776931,-0.032675825,0.01839246,0.008414822,-0.07650357,0.07460887,0.015999481,-0.0143431565,-0.03775232,0.073541395,-0.029160045,-0.033645444,0.05769379,-0.037698034,-0.022761138,-0.066397525,0.013602807,0.005004625,-0.012167106,-0.0090219155,-0.07229144,-0.007818199,0.055839863,-0.023012608,-0.058479514,-0.023438398,0.007111039,-0.039270334,-0.007022913,-0.03873911,-0.016563078,0.015775386,0.025728563]'),
_21
('Train', '[0.008390516,-0.0316401,0.059414063,0.004530007,0.015912173,0.04257927,0.010396404,-0.0041149696,-0.016684545,-0.051473897,0.013823704,-0.105521135,0.016059747,0.06659557,-0.0019725815,0.011045265,0.013066779,0.036172472,-0.043464396,-0.0027326334,0.008696494,-0.04963063,-0.05605746,-0.064520374,0.0071908,0.025355445,-0.050698947,-0.038638834,-0.06742357,-0.12853827,-0.0057572243,-0.052277446,0.019270279,-0.03003436,-0.035267383,-0.019119024,-0.022066116,0.054565392,0.021611325,0.034875706,-0.0043622344,0.014108078,-0.028517855,-0.08079088,-0.019493984,-0.034040015,-0.011598695,0.0022550072,0.0621561,-0.03721019,0.047613103,-0.04455849,0.03295865,-0.0057227607,0.0075348215,0.04554701,0.04224485,0.02329181,0.05805944,0.063204974,-0.031965736,0.048258748,-0.24342363,0.07309152,0.032815777,0.002095711,-0.059097853,-0.015610364,0.004590883,0.066063076,-0.017212633,0.021194763,0.007554856,0.033827275,0.014187226,-0.047569692,0.017875925,-0.017424196,-0.015125725,-0.005130941,0.0029060335,-0.050865818,-0.07343196,-0.0048736315,0.020944353,0.00077292154,0.032206904,-0.05818478,0.02801747,0.017108278,-0.03247216,-0.0065188087,-0.015342016,0.026298964,-0.049516425,-0.005976409,0.01856195,0.0074172006,-0.075506,0.23088165,-0.021115338,0.05222904,0.023529256,0.043604445,0.019573972,-0.026877966,-0.04359997,-0.0046444032,-0.02207065,-0.040870916,0.009780713,-0.025193287,0.024433471,-0.024275476,0.009968814,0.047776353,0.06775558,0.01283433,-0.052475818,0.008022442,-0.0013314247,-0.020480726,0.023044059,-0.028667847,0.0060666455,-0.09205764,0.048958115,0.122405164,0.019911205,0.022110125,0.050222058,0.0015760588,-0.078412116,-0.0021023818,-0.011218934,0.025069945,0.03324381,-0.0006424969,-0.043864336,0.0087585915,-0.05289486,-0.092548065,0.03227165,-0.1332425,-0.072707884,0.03601174,-0.029322848,0.04662253,-0.023045791,0.009186527,-0.04339159,-0.004015751,-0.002390284,-0.03830812,-0.003402778,0.042021804,0.039244883,0.05749609,-0.056686126,-0.007919699,-0.053717893,-0.016760027,-0.06469656,0.07116849,-0.015925482,-0.095182456,-0.019137817,0.011446995,0.022712586,-0.065081745,0.016669888,0.03609432,-0.022235183,0.019483658,0.06453548,0.0013194638,-0.042232916,0.012842303,0.0008133578,0.016946876,0.054184176,-0.061540544,-0.064576425,0.05788913,0.043063283,-0.017957158,-0.00660539,-0.043557957,0.00932838,0.04721575,0.025036044,0.05511638,0.012167107,-0.073137976,-0.05228407,-0.027518198,-0.020088682,-0.04512229,-0.0067941146,-0.038086385,0.026816027,-0.0076302565,-0.030978065,0.011591283,0.010688236,0.062038578,-0.034754917,-0.029522672,0.023187192,0.029613974,-0.03722577,-0.012008098,0.102696836,-0.007421274,-0.027096916,0.02145292,0.026860205,0.06578597,0.01368912,0.040054448,0.04191872,-0.038178593,-0.063167796,-0.22596447,0.06565988,0.04722377,-0.016424103,0.05646301,-0.045248922,0.017223613,0.004723246,0.03433359,0.057964306,0.107756704,-0.040196985,-0.005384249,0.02173068,-0.021337867,0.053607292,0.027281692,0.039454717,0.015027626,0.02693812,-0.003631183,0.048921067,-0.019490749,-0.09182499,0.02951052,0.0186495,0.23003499,0.06202278,0.07585443,-0.06069743,0.0526535,0.02085982,-0.018095134,-0.1384808,0.041433737,-0.026623845,0.07243412,-0.0029134983,-0.0069605466,-0.019240782,-0.018164543,0.029909529,0.01608419,-0.061474107,-0.013469153,-0.029401183,-0.054659907,-0.014086127,-0.028915925,-0.0069666984,0.041868016,-0.013776472,0.039377537,0.028841918,0.015001087,-0.03712765,-0.067391664,0.031860482,-0.041481916,0.037242766,0.0051513095,-0.024946364,0.02921327,-0.038750958,0.037937738,0.025684254,-0.050058123,-0.00971873,0.058333874,-0.020295596,-0.043949526,0.08710765,-0.0069736685,-0.047693014,0.070027076,0.017611913,0.009996941,0.025605714,-0.014843967,-0.0095715,0.03362786,-0.027780171,0.034262065,0.054104224,0.015189927,0.00031930834,0.08402685,-0.020675372,0.05230347,0.00073445373,0.0203266,-0.010717519,-0.017641345,-0.049389035,0.03801163,-0.04896717,-0.2916533,0.02326856,0.030424621,0.057537735,-0.03546315,0.009951743,0.021315183,0.04614926,-0.01757108,-0.025332054,0.047435746,-0.004156035,0.070101835,0.006551285,0.014095617,0.035963845,0.09428639,-0.011006988,0.043139383,-0.028828816,-0.010830479,0.052022237,0.17928188,0.013676716,0.048481107,0.020455515,-0.03715131,0.0030906487,0.014748529,-0.026029117,-0.016452625,0.011987294,0.085855335,-0.012302411,0.037723247,0.0425674,-0.055454608,0.1011866,0.028467475,-0.030435871,-0.061414395,-0.017736189,-0.03107398,-0.06507749,0.09065245,-0.021177005,-0.016372962,-0.038777813,-0.00053287647,-0.031771254,-0.023859626,0.00845833,-0.0049761753,0.020201217,0.013904311,0.069836564,-0.023459928,-0.09671563,-0.0576696,-0.027228847,0.012631596,-0.07193221,-0.028516661,0.023131175,-0.0030631186]'),
_21
('Cat', '[-0.018450698,-0.043701697,0.02752752,0.017822262,-0.02586187,0.028728843,0.087862626,0.09188629,0.04397456,0.019820007,-0.011478988,-0.124914564,0.022496833,0.0789779,0.034404784,-0.0018655953,0.0054757334,0.015263809,-0.057259317,0.036637075,0.023102136,-0.0009833422,-0.04593577,-0.039027687,0.03276482,0.02076609,-0.06291743,-0.03474475,-0.061686616,-0.13878247,-0.031647447,-0.041279692,0.020428147,-0.008723568,0.002749398,-0.029738247,-0.02957134,0.03317581,-0.048957366,0.07942621,0.023558771,-0.014116848,-0.039913174,-0.029095618,-0.024157254,-0.0028368456,-0.002660644,-0.024854222,0.047447667,-0.04207809,0.0380363,-0.053787,0.020617802,0.022927182,0.001773245,0.02898622,0.10264574,0.021385299,0.06101385,0.043469504,-0.0060370597,0.072553396,-0.22571594,0.08177761,0.059967242,0.011605421,-0.059498515,-0.01614959,0.030732593,0.047745787,-0.034631897,0.0045268857,0.008692242,0.06986321,0.062867224,-0.04319344,0.044571005,-0.008040988,-0.007348434,0.0011111188,-0.040033247,-0.013782392,-0.05935072,-0.031029223,-0.025947869,-0.0116114365,0.009943911,-0.04495425,0.039871536,-0.007157675,-0.081404544,0.028082607,0.0002421545,0.0007344536,-0.058870003,-0.03995512,0.02585252,0.005922959,-0.06805756,0.23782046,-0.030170966,0.021609697,0.06485757,0.011116049,0.033888217,-0.021842483,-0.013968073,-0.025392892,-0.017921817,0.028079357,0.025580177,-0.01690473,0.013204528,-0.058830313,0.051414166,0.0056296475,0.042037394,0.010937367,0.03082752,0.017728599,-0.021105066,0.009503924,0.014986898,-0.010639325,0.037019223,-0.08803974,0.027080009,0.089853294,0.022677682,0.03509845,0.062564544,-0.042244546,-0.050651427,0.0051593627,-0.021133807,0.014681318,0.011123185,0.01954461,-0.011593424,-0.048611607,-0.06442908,-0.10776765,-0.0038715384,-0.113250785,-0.0013805063,0.054094467,-0.038793158,0.05252635,-0.02806175,0.028057585,0.00038797883,0.0248274,-0.053739987,0.02358995,0.009615382,0.0459994,0.028359659,0.043745056,-0.039010525,0.04654124,-0.0046896823,-0.046589084,-0.03633851,0.046189457,-0.013919748,-0.058477134,-0.039088316,-0.030274736,-0.03725408,-0.0074797496,0.05141904,0.03529245,-0.05534556,0.029533856,0.022124233,0.030466082,-0.0037198325,0.018125841,0.005400052,-0.0031701697,0.052214794,-0.03613148,-0.06176965,0.07701529,0.04650194,-0.040947113,-0.048056263,-0.018562285,-0.039730188,0.011365426,0.030509792,0.03808681,0.025926674,-0.07370392,-0.014984852,-0.060279783,-0.008129943,0.008534002,0.035145674,-0.023089841,0.0450473,-0.040078282,-0.067101896,0.054339316,0.018377861,-0.00052205054,-0.022381525,0.022282446,0.032699667,-0.004516875,-0.023932414,0.011830043,0.044468176,0.008677854,-0.03468146,0.007745217,-0.018356947,0.05176401,0.04161891,0.0716399,0.043909244,-0.097493835,0.004900012,-0.22551504,0.010759602,0.025497086,-0.057824843,0.03173267,-0.052233122,0.036974248,-0.015762206,0.07025136,0.031058954,0.057086878,0.0040403972,0.0186622,0.076763235,-0.05272903,0.07411572,0.030511323,-0.021784903,0.019807672,0.01646691,-0.03355217,0.039836943,-0.016108982,-0.081623204,0.02503345,0.023985993,0.23101605,0.09275506,0.036845215,-0.012754107,0.0072520603,0.02663752,-0.08013605,-0.122672945,0.029188603,0.047271322,0.029502878,-0.021710804,-0.057916477,-0.033290174,-0.04561619,0.024318889,0.011353906,-0.060632486,0.015315554,-0.017688273,-0.04047208,0.030335227,-0.041746728,0.027059378,0.05104814,-0.024603844,0.0070659635,0.0025729148,0.00940215,-0.024860522,-0.07034691,0.005896322,-0.0069140918,0.01501812,-0.006486526,-0.09685372,-0.0012098794,-0.01242476,0.05278896,-0.0022264088,-0.024227154,-0.012343209,0.023066515,-0.06185465,-0.032793436,0.09016447,0.026167199,-0.051579386,0.023778731,0.02196033,0.011613299,-0.0028875927,0.007213804,-0.077984005,0.04114566,-0.042612676,0.030693077,0.018442027,0.018042548,-0.016633302,0.023955721,0.0065748747,0.048678786,-0.060312748,0.049683105,0.031068243,-0.035726856,-0.04870947,0.009337585,0.00096612197,-0.28237557,0.01650157,0.030606303,0.0030061172,-0.043637928,0.012786108,0.0047959434,-0.018053751,-0.057656318,-0.032992836,0.035492945,0.040239785,0.03308174,0.030363094,-0.0074734306,0.031687234,0.042816583,-0.02827239,0.025122454,-0.017633557,0.05130058,0.019577276,0.26412004,-0.03937151,-0.005285997,-0.026237419,-0.031395175,-0.023909623,0.050147958,-0.021485727,0.008363846,0.020979265,0.05898941,-0.0369355,-0.009970978,0.058567666,-0.053051967,0.07510308,0.007790953,0.0030001537,-0.018105373,-0.0024175737,-0.03822598,-0.054223735,0.07783055,-0.049844712,-0.047537003,-0.016613906,0.014751358,0.005427777,-0.044944577,0.0005177255,-0.036851205,0.035434917,0.0031816638,0.017624011,-0.0002383347,-0.027522223,-0.04817965,-0.02104149,-0.024004659,-0.025815494,-0.0032800396,0.046702977,0.059542835]'),
_21
('Dog', '[-0.03398106,-0.04587913,0.05834977,-0.012510896,-0.020966545,0.024606809,0.06725803,0.04614885,0.021671712,0.0028234783,0.024777666,-0.13095815,0.050201364,0.04163673,-0.0073551466,-0.007788209,0.02349543,0.045571007,-0.101046406,0.026413035,0.006283169,-0.029844765,-0.018307583,-0.067260414,0.0071734344,0.040144853,-0.022258174,-0.035064206,-0.038951498,-0.10791707,0.012508958,-0.029608397,0.01737361,-0.0048551173,-0.0137116825,-0.021252109,0.016257621,0.030800447,-0.010203598,0.05779155,0.03410912,-0.014027831,-0.06014225,-0.0737464,-0.00296503,-0.02995635,-0.048784822,-0.04322933,0.04992729,-0.054626375,0.020585917,-0.02869352,0.027270662,0.028178928,0.023035508,0.027372012,0.07144182,0.027457833,0.006989782,0.026272165,0.020677378,0.1046711,-0.18369348,0.10478375,0.06709782,0.031876415,-0.080784984,-0.0318658,0.0068611726,0.04296069,-0.014369754,0.025120066,0.0064320723,0.07627709,0.009385011,-0.046717513,0.02942915,-0.011798346,0.0024966802,-0.0011040273,-0.01837801,-0.024898572,-0.056603655,-0.0049853246,-0.018484253,-0.047932703,0.005165957,-0.07251493,0.015559436,0.06264581,-0.039077364,-0.02403875,0.013444196,0.014436731,-0.056333177,-0.015642889,0.021741007,-0.013120397,-0.033021655,0.20736612,-0.06262082,0.042408913,0.063680306,-0.047230907,0.07333769,-0.0058781966,-0.019491186,0.001866874,-0.04809916,0.038134225,0.004091026,-0.02022125,0.0114840185,-0.066682085,0.03792327,-0.00015499585,0.027070496,0.049177293,-0.0024667126,-0.01676147,0.005352208,0.03228254,0.020419393,-0.023925079,0.027801491,-0.08195105,0.02263024,0.1127984,-0.01773959,0.013458586,0.023056736,-0.0405365,-0.019467505,-0.007438755,0.014741418,0.019221041,-0.002969519,0.0063020405,0.0050163977,-0.019422691,-0.042474356,-0.11976022,-0.0031393368,-0.09801484,-0.0063687935,0.054927953,-0.034576423,0.018661322,-0.06695973,0.018426672,-0.041533604,0.012827635,-0.0216872,0.029161893,0.035417113,0.014812438,-0.0005086224,0.047981005,-0.033724055,0.02964084,-0.011219084,-0.030708553,-0.05478525,0.061196856,-0.01044451,-0.06580756,-0.071939655,0.028023727,0.019572273,-0.0066324784,0.03371536,0.03889294,-0.043447196,0.023165302,0.02749916,0.036996223,-0.017910937,0.0034960753,-0.017619846,-0.01682099,0.07389422,-0.022559106,-0.075324185,0.068171635,0.039252345,-0.01228445,-0.019303845,0.0061936406,0.0069038905,0.05486719,0.021220824,0.06319413,-0.00862464,-0.07810823,-0.06715591,0.01653162,-0.074353494,-0.0055483994,-0.00432403,-0.029376648,0.044267535,-0.02766178,0.015305978,0.041949403,0.05040478,0.03711134,-0.006646276,-0.024122963,0.04387694,0.042191654,0.0040298956,0.026687108,0.026858974,5.975888e-05,-0.042856377,0.02719497,-0.015184606,0.017931797,0.051872507,0.040260497,0.034908403,-0.10133825,-0.035800662,-0.21634497,0.026843634,-0.0035379566,-0.026145559,0.03874843,-0.0072357524,0.03432515,-0.01789197,0.05520025,0.056067273,0.06292914,-0.0063916366,-0.0250232,0.029002182,0.0048547084,0.09028735,0.063608915,-0.013629017,0.007837473,0.030949071,-0.0305201,-0.016705323,-0.029566336,-0.041564044,0.020007666,-0.029416997,0.24585131,0.071520805,0.027776815,-0.010154821,0.019156493,0.026060665,-0.05332598,-0.117831856,0.05576698,0.0611754,0.023893401,-0.03997265,-0.042899795,-0.053757526,-0.03657568,0.07664591,-0.032604933,-0.07631975,-0.024680613,0.0060682655,-0.0018964773,0.012901344,-0.042611003,0.02288525,0.031216914,-0.034108605,0.022518663,0.01629285,-0.029234616,-0.015426959,-0.034897357,-0.021540005,0.0015016403,0.033357877,0.0284842,-0.092373185,0.02815136,-0.034993514,0.037112426,-0.023349721,-0.03801536,-0.03301411,0.007879143,-0.037546758,-0.010365928,0.07326524,0.048820004,-0.030361317,0.056599807,-0.006202554,0.05078459,-0.046470087,-0.022375962,-0.027263056,0.04430895,-0.066588804,0.048946578,-0.008054631,0.056988873,-0.022817664,0.05487547,-0.00850563,0.06884496,-0.056825235,0.013956117,-2.8598519e-05,-0.008391312,-0.07403139,-0.02054572,0.00740269,-0.28785047,0.035514876,0.018872637,0.016709069,-0.022526452,0.04546725,0.0036777765,0.010296626,-0.07546051,-0.045812447,0.010187619,0.027719049,0.031793963,-0.013236095,-0.020754311,0.03627473,0.011115101,0.014774947,0.04622976,-0.029250441,0.020287355,0.017993618,0.24138238,-0.07568645,0.07751866,0.012238281,-0.041065767,0.051694304,0.04204503,-0.028650045,0.07694258,-0.021129774,0.10736998,-0.045513943,0.010340816,0.046329513,-0.046585277,0.09469313,-0.012459904,-0.055962075,-0.015606321,0.033765897,0.0049535953,-0.07884165,0.08479913,-0.035221465,-0.04052622,-0.02334385,0.022412961,0.017682377,-0.044773374,-0.06094265,-0.044896785,0.022461157,0.039271295,0.01423678,0.011286046,-0.05645138,-0.055751275,-0.06402218,-0.0047324076,-0.059572853,-0.025109097,0.03716784,0.05244787]'),
_21
('Apple', '[-0.01854126,-0.015314187,0.008172714,-0.06233388,0.0151762,0.00095683464,0.046682406,0.036243673,0.014862187,-5.8190515e-05,-0.004585996,-0.061831452,0.0136447605,0.017847551,0.048936155,0.031905275,0.0249166,-0.01723699,-0.074055605,0.0044720536,0.009445661,-0.03197354,0.016330265,-0.05798763,-0.0005444175,0.03345155,-0.06665412,-0.031260885,-0.047729123,-0.15240389,-0.0369158,-0.061498255,0.056001555,-0.00027440977,-0.00062431605,-0.037229452,-0.049931858,0.040858846,-0.031204186,0.03931569,0.05703049,-0.009987068,-0.036490448,-0.018589024,-0.028742589,-0.016836036,-0.024929224,-0.024623353,0.058277316,-0.02126311,0.055800628,-0.016453594,0.023494028,0.011939725,0.006316923,0.05045838,0.052253675,0.0018598125,0.057757597,0.064271055,0.021462984,-0.00598809,-0.20524058,0.098078206,0.07923511,-0.0030400828,-0.0042570103,-0.048181806,-0.0057368493,0.028005809,-0.027782597,0.036583826,0.056569118,0.06672127,0.0072273863,-0.010364808,0.037651714,-0.058841214,-0.0156052,-0.007403201,0.004738195,-0.045108624,-0.043373324,-0.010229558,-0.015398024,-0.027500607,-0.013934623,-0.06390856,0.07244502,-0.03525932,-0.09858975,-0.017686404,0.032276656,0.013345139,-0.07269245,-0.0112332925,0.062022205,-0.0022355681,-0.067187116,0.25026688,-0.03435671,0.0287123,0.054986972,-0.059890773,0.027863948,-0.042722933,-0.01700282,-0.019195212,-0.025022611,0.019158779,0.031251986,-0.01125425,0.03872539,-0.020698383,0.030452145,0.014281089,0.029007183,0.047993574,0.01674457,-0.016619984,-0.017566299,0.061561186,0.029382374,-0.01851396,-0.0062958095,-0.09839809,0.020334389,0.1269149,0.0069205724,0.016504155,0.08306016,-0.060554363,-0.07056581,-0.021461489,0.049540065,0.047961283,-0.018516554,-0.022690471,0.044891648,-0.04310284,-0.078540124,-0.07875601,0.012700777,-0.09502175,-0.022846391,0.0629089,-0.015902612,0.046939265,-0.07262387,0.02601966,-0.005264863,0.04895392,-0.01572132,-0.0102630425,0.015897341,0.053458296,0.03574174,0.04539862,-0.035877213,0.03533559,-0.042159036,-0.0087875,-0.049615107,0.07554764,0.011191862,-0.113151096,-0.017492991,0.043413684,0.002327505,0.0073730038,0.02350307,0.035559066,-0.0059042843,0.05666708,0.044166975,-0.00055669114,-0.036611453,-0.0014730084,0.007564431,-0.011042368,0.05057629,-0.052485,-0.044374328,0.009869594,0.08320784,-0.023855116,0.015617343,-0.030314686,0.07130435,0.03665859,0.00899261,0.05550256,-0.054251857,0.0035008327,-0.046595573,-0.042936403,-0.011023383,0.018025259,0.026859136,-0.029143373,0.049876533,-0.0034112562,-0.041306548,0.055204038,0.019626688,-0.016427225,-0.04123679,0.0017773646,0.046740886,0.012245985,-0.033460714,0.021917453,0.07956837,-0.028794741,-0.08975127,-0.0037019434,-0.00012320856,0.03852602,0.053377513,0.040480774,0.0314433,-0.090866566,-0.081535764,-0.2508107,0.007842401,-0.0103528835,-0.017066024,0.031441532,-0.040664397,0.017248066,-0.034469314,0.016174091,0.04561676,0.05384791,-0.00558743,0.018127529,0.07188737,-0.029698055,0.04265685,0.06104204,0.012198512,-0.0036226169,0.044303454,-0.028414544,0.045141805,-0.028411133,-0.04631903,0.030073958,-0.0515857,0.220293,0.04642099,0.018873105,-0.011720311,0.032426845,0.046402935,-0.03572881,-0.09112599,-0.003913931,0.06326886,0.008865028,-0.041372094,-0.06256474,-0.028682407,-0.040730156,0.047156896,-0.0039689573,-0.05302654,-0.003632981,-0.07732629,-0.01206058,-0.019614374,-0.028614756,-0.011921634,0.05150594,-0.015722616,0.035769034,0.012905213,0.04353579,-0.038506903,-0.12106876,-0.009226098,-0.019487629,0.004457581,-0.014951816,-0.045989387,0.001073027,-0.009420541,0.02853069,0.0024750652,-0.028357819,-0.01819474,0.003554601,-0.090667546,0.004385141,0.08669419,0.017099937,-0.033926927,0.07534967,0.030821681,0.04540305,-0.018767703,-0.037650675,-0.05459591,0.038266014,0.024052124,0.047373742,0.037806187,0.017990775,0.026818357,0.07041108,-0.012912107,0.009049243,-0.06140867,0.026061615,-0.0029175973,-0.0034775157,-0.038097065,0.046520837,0.0017449996,-0.24222106,0.061534416,0.014094019,0.03329052,-0.05666281,-0.0035613445,0.005507172,0.044907637,-0.011295333,0.04069986,0.0023404267,-0.017250648,0.055625506,-0.040635873,0.01642882,0.03416647,0.06721072,-0.081086,0.04945331,-0.037871443,0.022263754,0.02852677,0.21389903,-0.088772774,0.0179931,-0.008538751,-0.02611542,0.043828104,0.0054317755,-0.009777816,0.035113182,-0.007311843,0.07082955,-0.021270387,0.0066470113,0.054239165,-0.06441797,0.038601365,0.0214487,-0.025159193,-0.03238237,0.02582966,-0.079627365,-0.011419387,0.0626605,-0.024815738,-0.03032111,-0.05392778,0.01915368,0.01430781,-0.015028325,-0.050955776,-0.0047285086,0.033127528,0.016017374,-0.016613198,-0.051912326,0.015621767,-0.06378826,-0.056303553,0.040947903,-0.033308335,-0.016811416,0.07314832,0.052192166]'),
_21
('Boat', '[0.003451573,-0.03132442,0.041924234,-0.07151062,0.005656667,0.014033464,0.038280405,0.07405814,0.002665217,-0.020811431,0.02797703,-0.082384676,-0.021522641,0.049683884,0.0051554316,0.05113881,0.011191923,0.08603509,-0.04581075,0.027721966,0.06524101,-0.011254213,0.005719363,-0.06456224,-0.0067095314,0.027434144,-0.03998245,-0.018337745,-0.03024962,-0.12786528,-0.007468822,-0.07965858,0.002841196,-0.026761381,-0.002710397,-0.032941174,-0.01157222,0.01835951,0.025763508,0.017918503,0.01716959,0.04313931,-0.06198612,-0.019062353,-0.045892436,-0.047470637,-0.025586972,0.015134751,0.07648262,-0.04904084,0.013845007,-0.031671703,0.027743243,0.03567014,0.044218108,0.024208087,0.053735733,0.013186276,0.0055202967,0.042314656,0.05348394,0.024783261,-0.22115476,0.08963771,0.013096708,0.044419244,-0.017883042,-0.03910393,0.013514059,0.016817786,-0.052290566,0.017970363,0.042357013,0.10046304,0.027752733,-0.061662477,0.006513319,-0.037006002,0.027272867,0.027006257,0.0142964665,-0.06360955,-0.021836504,-0.029386729,0.003337552,-0.017336056,0.029699676,-0.026593758,0.03526048,0.0039346362,-0.057597876,-0.029524093,-0.01730882,0.014263184,-0.08440352,-0.00041559874,-0.004121953,-0.007147526,-0.066180535,0.21969096,-0.026675701,0.04207458,0.061170112,-0.024306577,0.044024996,-0.02159782,-0.052115727,-0.013863495,-0.04703005,-0.0007212677,0.004346511,-0.014467664,0.00843103,-0.013691538,-0.0072375066,-0.019222913,0.018029733,0.03152813,-0.030557722,-0.029202802,-0.014806717,-0.0122162895,0.05467705,-0.011990872,0.029487923,-0.057703514,0.08271271,0.105192035,0.007058811,-0.005331917,0.001044727,-0.027939413,-0.03841933,-0.039499894,-0.03354715,0.0008674375,0.0028215437,-0.0063504563,-0.0013052999,-0.01605963,-0.08247868,-0.12754385,-0.00035439446,-0.1135988,-0.043434717,0.038759027,0.002496258,0.03332463,-0.021302817,0.03943982,-0.017751513,0.04280311,0.0033914526,-0.023666987,0.018136116,-0.014481841,-0.019508364,0.07897855,-0.043303143,0.018218957,0.006419149,-0.03464293,-0.03316714,0.039618928,0.0014868038,-0.13087988,-0.0063449526,0.04696695,-0.030625926,-0.005813282,-0.01341627,0.05716793,-0.016758876,0.05393186,0.0777393,0.033460576,0.03254571,0.01969365,0.018621385,-0.009796354,0.050934583,-0.015461227,-0.054977313,0.071182206,0.06265597,-0.042554602,-0.02824994,-0.029791066,-0.0006974022,0.028558008,-0.0026959486,0.050376188,0.00981151,-0.026680889,-0.023037922,-0.030151734,-0.002973705,-0.055360682,0.0035032611,-0.049384903,0.075852595,-0.0074333963,-0.02718678,0.053259887,0.025845353,0.009015108,-0.017371554,-0.024869643,-0.013716606,0.07490163,-0.06361879,-0.0013744798,0.059992343,-0.015204999,-0.0040881964,-0.006926333,0.031526998,0.046630118,0.011222064,0.057870165,0.017545212,-0.118089885,-0.038867403,-0.21836688,0.017069299,0.013897999,-0.020572908,0.029985098,-0.011952629,0.015152697,-0.007566515,0.018216064,0.059099764,0.082925186,-0.041308656,-0.05755257,0.04316516,-0.03456597,0.04691071,0.03894865,-0.0013005713,0.0054288697,0.020903084,-0.0019502229,0.068574,-0.012678534,-0.023653781,0.05061183,-0.015460681,0.23320328,0.0540902,0.03415941,-0.03924938,0.0067807026,0.045057893,-0.026635995,-0.07698709,0.032159913,0.053191483,0.05704703,-0.021299265,-0.008298184,-0.03543195,-0.0070491335,0.04338257,-0.016497841,-0.073704265,-0.044688262,-0.040218312,-0.03207327,-0.0046671163,-0.023711322,0.0096596815,0.065637104,-0.02979161,0.033204455,0.026951917,-0.0056020273,-0.028967276,-0.07344016,0.009490252,-0.034891546,0.021181162,0.016997669,-0.01901137,3.6806174e-05,-0.05220573,0.03200216,-0.021272521,-0.030422227,-0.05363538,0.043928806,-0.08376253,-0.037302095,0.097358674,0.024045696,-0.017719422,0.081304744,0.047614243,0.06464407,-0.032756194,0.018565826,-0.044159252,0.040204857,-0.041234825,0.023949105,0.002779979,0.04253179,-0.015129703,0.022819744,-0.03602023,0.026503049,-0.03500936,0.021883395,-0.013415038,-0.025728086,-0.037960876,0.037986066,0.021162277,-0.31060043,0.031734128,-0.0022458911,0.042481646,-0.028866054,0.030208766,-0.0133145405,0.054347847,-0.073503956,0.062051143,0.005826847,0.049297802,0.030884407,-0.01688786,0.017160615,0.063027896,0.07313963,-0.09637417,0.051601037,-0.043145347,0.000817891,0.028763952,0.19526124,-0.041790325,0.0726707,-0.024687497,-0.0013156298,0.045472197,0.0010359284,0.015232671,-0.027874617,0.014591427,0.13244624,-0.039644428,0.020199,0.060292866,-0.05322153,0.03625645,0.017529424,-0.07401374,-0.036324993,0.025423175,-0.0046287975,0.0029855266,0.0834278,0.0056974366,-0.028152516,-0.091103025,-0.006525143,0.022312194,-0.03248805,-0.02484882,-0.049474973,0.010650054,0.08801606,9.901745e-05,-0.021977311,-0.03979849,-0.04118816,-0.019186275,-0.01652988,-0.068953894,-0.019286314,0.003947064,0.024725446]'),
_21
('Mouse', '[-0.040377103,-0.022667758,0.040733587,-0.045248877,0.004549785,0.01920968,0.09860386,0.06337809,-0.014576411,-0.016547957,0.0043267845,-0.08727463,0.001282113,0.034992572,0.0030495469,-0.005252943,-0.030733703,0.028543305,-0.05340802,0.02134803,0.009926888,-0.041723635,-0.014660007,-0.08119687,-0.006314594,0.0060803755,-0.047911707,-0.05091576,-0.06703744,-0.12893848,-0.028729504,-0.08311065,0.02901125,-0.032763172,-0.016858876,-0.027138188,-0.0064179595,0.051359415,-0.036937356,0.0038320909,0.042311396,-0.0014249359,-0.035213996,-0.03742079,-0.0014664575,-0.06288964,-0.008702811,-0.07035538,0.060513493,-0.022340205,0.040802304,-0.061406795,0.031208003,0.0147732375,-0.003349924,0.06889083,0.05477272,0.015846154,0.026901418,0.053733137,0.0089147,0.039884243,-0.189687,0.11407487,0.06078271,0.01646154,-0.010769416,-0.032409113,0.0042888965,0.046524018,-0.026228016,0.034576327,0.016356785,0.041987386,0.016909229,-0.048567224,0.0051092454,-0.027669614,0.027950207,0.032748174,-0.0155055905,-0.010912961,-0.023338877,-0.035056524,-0.027904602,-0.014183707,-0.019453976,-0.04282588,0.042652052,-0.021886067,-0.060644917,0.002340001,-0.011412922,-0.02175079,-0.0628676,-0.020284368,0.028365277,-0.005381609,-0.06597562,0.2276179,-0.07204836,0.019287534,0.041096047,-0.008528844,0.053176265,-0.018938553,-0.024173811,0.004013408,-0.039964236,0.03459345,0.010588582,-0.012078534,0.04525789,0.040328942,0.056859862,-0.041445985,0.034563567,-0.0031516568,0.0024751956,0.02141297,0.03361259,0.02350541,0.01680798,-0.0155210495,0.053421624,-0.053505804,0.012133244,0.12967996,0.003512417,-0.0025171235,0.046476725,-0.021781605,-0.05417786,0.020584816,0.020197248,0.02124402,0.015991636,0.022962242,-0.0012403561,-0.019248111,-0.06310508,-0.08227882,0.020538509,-0.109149516,-0.007844497,0.061679017,0.008426173,-0.0001732398,-0.049548004,0.050724845,0.004618454,0.03646706,-0.01484994,0.0039252373,-0.001403416,0.0664071,0.044730082,0.056839943,-0.034704044,-0.004730838,-0.023692578,-0.041346386,-0.04952889,0.056637034,0.015446278,-0.052159145,-0.023077182,0.055139318,-0.008341107,-0.023459954,0.033917475,0.0136266155,-0.04708014,-0.02063184,0.010280838,-0.02531588,-0.030564599,-0.025114458,-0.013762015,-0.010960947,0.09357507,-0.03643072,-0.042957693,0.05346348,0.04329152,-0.031103479,0.021322457,-0.01522813,0.0045661125,0.0537702,0.03209306,0.021443458,0.026066622,-0.089546315,-0.034763128,-0.055409517,-0.0222944,-0.025723536,0.017936995,-0.04824363,0.060549878,-0.037808303,-0.02620794,0.055600144,0.022436464,0.042776663,0.01612469,-0.02875058,0.051428806,0.017573178,-0.034467857,-0.0077900384,0.07513873,-0.019162938,-0.06555969,-0.014434028,0.047275715,0.02736343,0.080187805,0.0610768,0.037875254,-0.05696084,-0.05987416,-0.19478716,0.017523922,0.02172921,-0.03269391,0.021612154,-0.023794834,0.038002275,-0.006948219,0.07060778,0.035000026,0.08414426,-0.03226489,0.005960691,0.019508546,-0.07250312,0.07385267,0.06994085,-0.0026967837,0.0037788237,-0.02082316,-0.022966592,0.033302892,-0.02538656,-0.051392157,0.01707558,-0.008380637,0.2414746,0.124691986,0.015465072,-0.0077904454,0.020838035,0.030270401,-0.017751623,-0.094773516,0.053050213,0.08594688,0.021123288,-0.02162361,-0.029895138,0.0005249808,-0.06582099,0.01703007,-0.024236333,-0.09378091,-0.026403174,-0.025289156,-0.037038643,0.0076490627,-0.022255246,0.028706118,0.02795358,-0.034890853,0.00032028902,-0.019587833,-0.038501434,-0.01807254,-0.06457782,-0.0017888489,-0.0064566033,0.021368807,0.0021709246,-0.061586574,-0.010555151,-0.044502374,0.033785746,-0.007822122,0.007395981,-0.03746442,0.064690515,-0.0509958,-0.041122936,0.08854608,0.053750817,-0.021349406,0.05115994,0.017185207,0.024272623,0.029618526,-0.035643056,-0.047882646,0.042593274,-0.0027154651,0.039761305,0.060229745,0.027780939,-0.034311175,0.045842495,-0.01091128,0.053926248,-0.0791733,-0.01993803,-0.009639867,-0.042199083,-0.055512805,-0.011045383,0.0026950783,-0.31714323,0.03781929,0.03368966,0.03852715,-0.011875669,0.0084579475,-0.011901843,0.011003005,-0.108379245,0.005903558,0.045323938,0.042683903,-0.040204156,0.031824812,0.01460879,0.0362605,0.023287812,-0.013861633,0.040758185,-0.07728433,0.044756882,0.03642765,0.24435243,-0.036999114,0.032329634,0.028380118,-0.024428038,-0.016580353,0.042322036,-0.035527807,0.0089394795,-0.019262306,0.101632625,-0.04122436,0.03479015,0.07982272,-0.05526763,0.07851163,0.008479268,-0.008245814,-0.021768505,0.02535241,-0.031347126,-0.047938507,0.10146795,-0.034345087,-0.047936875,-0.050744783,0.0011701895,4.4137156e-05,-0.06095025,-0.0023069785,-0.03405786,0.013980694,0.018927611,-0.023111442,0.025687002,-0.026432892,-0.008920023,0.0053275074,0.031403854,-0.016360547,0.003918425,0.007261948,0.041972917]'),
_21
('Chair', '[0.007242612,-0.008890708,0.07087478,-0.017218666,0.010161964,0.02288103,0.0628255,0.11424202,0.0042939316,-8.577153e-05,0.011476879,-0.062698215,-0.008032744,0.055627514,0.031709522,0.008646851,-0.007677212,0.066087514,-0.03393286,0.04595943,0.026118021,-0.022798017,-0.018182075,-0.05310286,0.00035249838,0.023295226,-0.042976543,-0.05135346,-0.03338082,-0.14254245,-0.014448951,-0.082290724,0.044443995,-0.03974422,-0.005926467,-0.049466074,-0.023638904,0.027757877,0.022480648,0.053556327,0.047165435,-0.004361453,-0.050542057,-0.0437012,-0.02560832,-0.06319627,-0.0041195815,0.003607597,0.052995015,0.011868532,-0.023403196,-0.03835523,-0.011448239,0.022041226,0.029417036,0.050992206,0.0633451,-0.023109978,0.00216341,0.034917675,0.057824627,0.018065536,-0.24170217,0.11006612,0.03759417,0.036411434,-0.052734427,-0.08213202,0.026438877,0.023384342,-0.0010665334,0.02193495,0.04822074,0.057032634,0.032533765,-0.06519445,-0.011998926,-0.07312999,0.04362863,0.029194133,0.036719177,-0.014692358,-0.047481794,-0.0066692936,-0.0130425235,-0.033006106,-0.006729974,-0.055479433,0.002909906,0.009901007,-0.054927614,0.016737197,-0.0039022777,0.012947416,-0.095253274,-0.03701531,0.009167639,0.0016094614,-0.074405804,0.23805863,-0.07722793,0.053594265,0.05661687,0.013474817,0.012748461,-0.043693267,-0.0058534956,-0.03260329,-0.046950907,0.0037631558,-0.031769305,-0.017883668,-0.0041399263,-0.00987623,-0.030830177,0.019493125,0.015751151,0.02815844,-0.035440337,-0.045221068,0.03741029,0.034405444,0.04950322,0.0002810536,0.039881516,-0.09062843,0.06339841,0.13453153,0.045081846,0.064796284,0.06558472,-0.037522722,-0.0140108,-0.02632353,0.00747574,0.015750928,0.0083326,0.012081866,0.004607462,-0.03037953,-0.004366012,-0.11747248,-0.04063107,-0.056524236,-0.03673815,0.06279229,-0.0609879,0.015854241,-0.045741193,0.050263777,-0.0073641776,0.050540153,-0.04290963,0.014485639,-0.0139276795,0.022182146,-0.012923014,0.036970016,-0.0050614392,0.0010354925,-0.023141287,-0.051632244,-0.018497547,0.09570567,-0.007901496,-0.09501473,-0.017568301,0.03681976,0.013184938,-0.029150061,0.044263743,0.030326407,-0.062202446,0.03592422,0.14171353,0.061264616,-0.0113557875,0.0057085683,-0.0042014834,0.024679331,0.09886817,-0.022956898,-0.08608185,0.03893355,0.039992895,-0.02475844,0.005292053,-0.008077331,0.023394594,0.03322915,0.0014964573,0.036820974,-0.08104848,-0.040368747,-0.023672812,-0.04888999,-0.017661298,0.0004353547,0.046766445,-0.02462088,0.05855902,0.019459412,-0.092742875,0.07434688,0.00040293016,-0.008316873,-0.022810865,-0.007958628,0.0145595735,0.046529282,-0.035352007,0.017510511,0.018891828,-0.03154253,-0.016596705,0.011242443,0.03959193,0.033566765,0.028399244,0.0078011975,0.045376554,-0.07623077,-0.039943192,-0.17767033,0.04873167,-0.0020410172,-0.04009756,0.024814129,0.007918742,0.024190389,-0.00033496512,0.013061196,0.008428592,0.04138094,-0.0040136375,-0.010298606,0.018205566,-0.05673821,0.09389307,0.041287653,-0.04741975,-0.009544984,-0.01219063,-0.006107758,0.04731182,-0.054440457,-0.02459403,0.032760493,-0.016143644,0.20824662,0.0641648,0.016682435,-0.037340675,0.042529665,0.0018572406,-0.010167863,-0.14444397,0.06076707,0.027983412,0.013329789,-0.094144866,-0.053174745,-0.023026194,-0.024418438,0.038233172,0.013938331,-0.03727014,-0.027715338,-0.053909518,-0.058724325,-0.023147698,-0.05653502,0.024166629,0.042693656,-0.07007864,0.027310245,0.035349548,-0.009547592,0.0021897648,-0.039186116,0.01033775,-0.019588446,0.043451525,-0.060066592,-0.03307617,-0.0066904244,-0.03603856,0.04852917,-0.00236953,0.010736449,-0.008823226,0.048167307,-0.06029884,-0.02008656,0.04934105,-0.02165272,-0.0059321085,0.06101121,0.0050238813,0.036402144,-0.02407015,0.023990652,-0.017778596,0.0436243,-0.015234602,0.0013730796,0.032770347,0.04894707,-0.019903826,0.027210288,0.007320456,0.0031876478,-0.055667188,-0.0072730477,0.028816042,-0.036349706,-0.00014394987,0.041932836,0.011812606,-0.28528613,0.04374173,-0.02590061,0.036650803,-0.0054236376,0.044467915,-0.03377718,0.026663015,-0.057349887,-0.009933792,0.05871865,0.066987924,0.01848101,0.035349075,-0.017123345,0.09152398,0.03281407,-0.027747098,0.024043055,-0.07519967,-0.008642383,0.012063249,0.1965554,-0.04898195,0.068870105,0.023952631,-0.019946015,0.004611634,-0.011829971,0.004210717,0.007021141,-0.002664805,0.09861566,-0.07022641,0.02679062,0.08935795,-0.030601857,0.049988363,-0.00043722984,-0.07530143,-0.02624388,0.0027576822,-0.00384283,-0.0011950951,0.09351181,0.000937468,-0.04877977,-0.008898081,-0.0072512534,0.035405826,-0.037256964,0.017189763,-0.026388798,0.03487121,0.0046409904,-0.004795937,-0.012733615,-0.023830233,-0.0358013,-0.043804348,-0.029517788,-0.046758275,-0.06881492,0.024177445,0.0143103]'),
_21
('Tomato', '[-0.029869203,0.015828134,-0.024596874,0.020861035,0.03365765,0.005016581,0.060061164,0.055231918,0.006352899,0.004938967,-0.010154029,-0.079970695,0.07321542,0.07790107,0.033254772,-0.004294707,0.01585883,0.059918594,-0.037038,0.0012428203,0.051965587,-0.020879416,-0.016188672,-0.054822158,0.05654682,0.01551287,-0.038257234,-0.0013387762,-0.06285542,-0.15906854,-0.017457722,-0.031295694,0.039125703,-0.033283714,0.010947399,-0.040234644,-0.034372844,0.0104622785,-0.025485123,0.04994066,0.036814038,0.017452875,-0.023161633,-0.036298722,-0.07051053,-0.01720321,-0.050520383,-0.008748737,0.045904037,-0.034201797,0.00838936,-0.02913385,-0.026715593,-0.0019239038,0.030497734,0.05315972,0.0737804,-0.012085407,0.008660171,0.042524733,0.05538341,0.000746007,-0.20466295,0.06342115,0.06135094,0.031504415,-0.069241084,-0.031363465,0.02054631,0.06331636,-0.023490809,0.03283903,0.016335465,0.07762305,0.02926262,-0.031864528,0.007902017,-0.051381256,-3.054966e-05,0.0069825146,-0.0072099287,-0.057942085,-0.021548394,-0.020484764,0.0034414476,-0.0009200981,-0.025876729,-0.0011384323,0.030854544,0.013149443,-0.06754705,0.025895027,0.013232211,0.0026189121,-0.082489476,-0.016675644,-0.0011329504,-0.031126892,-0.07112445,0.24384846,-0.046597656,0.0059918556,0.05970376,-0.018256843,-0.006963375,-0.013897323,0.0015030024,-0.020435717,0.019298133,0.052937556,-0.017333444,-0.018564422,0.009297942,-0.054324653,0.03786996,-0.032721665,0.06951459,0.01771603,-0.028982867,0.0077923154,-0.00830094,0.029445156,0.029822096,-0.012998489,0.03462648,-0.060357843,-0.010533851,0.1293935,0.034346506,0.050578557,0.09663329,-0.01276127,-0.033567615,-0.0064450526,0.0058356086,0.0059343786,0.01880375,0.02080349,0.011490754,-0.051762104,-0.058268107,-0.10148158,-0.028299917,-0.12878123,-0.056659013,0.0792677,-0.06189865,0.07475942,-0.015977787,0.033134293,-0.028377857,0.070312105,-0.033728436,0.0008066307,0.0011054198,0.036089025,0.005808116,0.0150892725,0.015652863,0.023343807,-0.067047544,-0.021238264,-0.033493955,0.049286805,0.061130386,-0.1302799,-0.034686644,0.03194993,0.017306728,-0.022859355,0.07234756,0.06707331,-0.038075157,-0.036348555,0.029766655,0.025726654,-0.008922685,0.023629867,-0.0069144396,-0.0069140885,0.056218613,0.0060891095,-0.018740704,0.039786205,0.044703834,-0.05122165,-0.030560166,-0.019477822,0.025642106,0.047365725,-0.0292419,0.020383202,-0.018561209,0.0019795808,-0.07156357,-0.07546085,-0.033361394,0.014745907,0.043143313,-0.08493165,0.040821496,8.2503364e-05,-0.037970517,0.07551236,0.018706819,-0.008236447,0.012222742,-0.0072385306,0.03870738,0.009308826,-0.053195536,0.005780943,0.061434455,0.022424093,-0.095846556,-0.027069451,0.047961123,0.05197209,0.057374045,0.035580248,0.029196136,-0.10977645,-0.057589736,-0.1870228,0.043391757,0.035963323,-0.014210672,0.05607454,0.0082466435,0.019204104,-0.05721462,0.040878456,0.022721449,0.024591066,0.020865226,0.0049236715,0.015667483,-0.021398226,0.037637185,0.06469617,0.012518049,0.017760469,0.0019964725,-0.020859785,-0.040002,-0.033094212,-0.0699783,0.023698682,-0.07017367,0.24296242,0.080658525,0.009871246,-0.040088497,-0.0053918683,0.04648372,-0.02816283,-0.110829785,0.029916579,0.030329235,0.024077553,-0.049767897,-0.04330244,-0.023295995,-0.004359568,-0.03932452,-0.02428935,-0.09337115,0.034868468,-0.002945901,-0.020691164,0.018511932,0.014854298,0.04256989,0.023097772,0.001148896,0.057300646,0.013074834,-0.012571415,0.020001471,-0.10127031,0.032281198,-0.04176389,0.016812032,-0.019411203,-0.05776911,0.029127091,-0.067681596,0.067657456,0.0037067574,0.0054313703,-0.06507483,0.02452655,-0.023523247,-0.0115845855,0.07426925,0.0059831166,-0.032276228,0.041309595,0.029319493,0.031122738,-0.02010134,-0.03379396,-0.068257384,0.07548506,-0.00865319,0.020672757,0.018169515,0.02121715,-0.010468761,0.030261477,-0.039439406,0.03985935,-0.03133109,0.0016366037,-0.0125524895,-0.041070357,-0.011944829,0.04043416,-0.06700538,-0.28739145,0.05875665,0.009824386,0.023446443,-0.025512964,-0.0033332668,-0.002571084,0.041617453,-0.09641374,-0.0148532195,0.029931597,0.00049597985,0.056677457,0.006903832,-0.0062901466,0.05687495,0.03539329,0.0054870755,0.029720528,-0.02696151,0.050539803,0.033945065,0.21645951,-0.046155605,-0.00011607572,0.037222028,-0.00097053614,0.010392147,0.016402123,0.013145822,0.014141131,0.051504795,0.080597855,-0.043332655,0.010268469,0.023539314,-0.028266096,0.060939495,-0.007246181,-0.016179414,-0.07213172,-0.0051829983,-0.047173,-0.043231044,0.07690072,-0.035430543,-0.018886589,-0.071139365,0.00027390203,0.024421537,-0.05540805,0.0030416052,-0.03133615,0.020766012,0.007597287,-0.024713233,-0.018646253,-0.02164263,-0.04884827,-0.011035427,0.0315883,-0.045343455,-0.0052071656,0.046982065,0.03005724]'),
_21
('Desk', '[-0.017075958,-0.010888746,0.080291696,-0.025692422,0.023058051,0.011809025,0.052361254,0.06862456,0.023607824,-0.009210255,0.04033431,-0.053230878,0.08069261,0.046486624,0.009520946,0.0037151624,-0.027851786,0.022258898,-0.03552146,0.0049876287,0.016760446,-0.0354698,-0.041900143,-0.08992244,-0.0030455913,-0.0043795966,-0.062581964,-0.06256854,-0.04892184,-0.14111088,0.0026656375,-0.031744845,0.05466585,-0.018847726,0.019207526,-0.06257882,-0.007204764,0.02333366,-0.029454706,0.027162952,-0.014566991,-0.0097501725,-0.05109416,-0.049618334,-0.009138151,-0.049895912,-0.002367935,-0.045575418,0.04331254,0.0060089612,0.010464706,-0.06699024,0.011478289,0.04059331,0.0084988475,0.040767603,0.046229202,0.0055651255,0.034506306,0.071188055,0.050099786,0.0064023295,-0.22729196,0.11016682,0.063853145,0.002075671,-0.058538996,-0.04469632,0.025434878,0.054608773,-0.03046769,-0.0023969284,0.023868104,0.04704296,0.05093148,-0.07893697,-0.016868979,-0.023819225,0.04966335,0.012613918,0.0002760624,-0.0237792,-0.02210674,-0.0025413414,-0.051818397,-0.010000192,-0.0056564524,-0.024465935,0.034022514,-0.0039295424,-0.08148384,0.044355,-0.059270795,0.006314524,-0.07335388,-0.05289436,0.029089374,0.003093686,-0.053854994,0.24911241,-0.062527195,0.03473907,0.056096543,-0.034448277,0.008506664,-0.062420454,0.012665839,-0.008595196,-0.064310096,0.02994306,-0.034977753,0.016273487,0.0093974555,-0.00015720105,0.038714644,0.0036081353,0.053009037,-0.0008864092,-0.013851306,-0.039496463,0.014128448,0.017951578,0.009349462,0.01042504,0.051630985,-0.053956885,0.02876148,0.11510076,0.0455511,0.012667353,0.0806707,0.0070800376,0.025727438,0.041150693,0.007863412,0.031984337,0.013170205,-0.009395292,0.014573138,-0.03485805,-0.03764348,-0.07997719,-0.011784456,-0.09563226,-0.03400148,0.109441295,-0.04900478,0.02535317,-0.04422044,0.0062985034,-0.0076054796,0.03937887,0.030961435,0.017655462,-0.012246824,0.00020564783,0.021475356,0.049180325,-0.012257939,-0.02592291,-0.0014702714,-0.015490445,-0.05669335,0.05330947,0.010385874,-0.102429666,-0.030609999,0.0714415,0.011635493,0.0022937357,0.009192694,0.01323513,-0.046253715,0.042666234,0.09617933,0.038035154,-0.0074128667,-0.032752965,0.0076832944,0.02399374,0.06469999,-0.033205263,-0.060129013,0.04173046,0.06158138,-0.03689033,0.004568745,-0.023324467,0.031645365,0.07746148,0.0059857927,0.037316162,0.0029132718,-0.016107306,-0.05434655,-0.06491648,-0.023832045,-0.050689403,-0.010082951,-0.05112477,0.09912774,-0.025389507,-0.051846053,0.05495424,0.033441294,0.0037791673,0.009748631,-0.0019748393,0.04403737,0.009415996,-0.060215756,0.018110497,0.058251932,-0.006824225,-0.009257916,-0.041744713,0.015736148,0.03218059,0.060505457,0.012099181,0.034636773,-0.052649904,-0.079120345,-0.20813292,0.066237904,-0.020957587,0.0073129637,0.034559604,0.011299093,0.03411265,-0.0021747819,0.03185566,0.0070963744,0.07857288,-0.008124623,-0.017663067,0.0016398929,-0.039167996,0.061877865,0.06713014,0.018810991,-0.026776476,-0.046341814,-0.005355074,0.028902428,-0.06398502,-0.029270144,0.02508191,-0.02530654,0.21773459,0.0339529,0.015731804,-0.03964237,0.07042959,-0.02501626,-0.022183988,-0.14884305,0.065215595,0.10670705,-0.00037880713,-0.06864392,-0.028297037,-0.024357636,-0.050164282,0.01834488,-0.031103658,-0.084248856,-0.028994896,-0.015948653,-0.03755552,-0.015801996,-0.033609822,0.02573379,0.02479709,-0.03685521,-0.0046613724,0.034090023,-0.010260922,0.015709793,-0.062157243,0.01375377,-0.04164558,-0.004064993,-0.0070441877,-0.05030921,0.0043502874,-0.01210114,0.052284397,0.026279854,-0.008008602,0.012525424,0.04647556,-0.039444804,-0.0002497322,0.043502543,0.022106966,0.009966737,0.061893284,0.010174843,0.034406714,0.016847465,-0.04216487,-0.028892005,0.009899105,-0.025332458,0.027274324,0.037005823,0.017847693,0.015657736,0.06033117,-0.030242763,0.060493562,-0.06003715,-0.008263403,-0.010291895,-0.034526054,-0.052242614,0.028519461,0.00037531398,-0.29202363,0.051917017,-0.0124211,0.048688818,-0.03532362,-0.015612858,-0.053210825,0.06197344,-0.07399723,0.013094931,0.0069343266,0.016719852,-0.022996183,0.015213123,-0.0123770265,0.04051931,0.06230749,-0.00079691666,0.028561795,-0.04758113,0.03337342,0.050868753,0.2105322,-0.0056460854,0.047387015,0.018683372,0.015859153,-8.0802485e-05,0.017905135,0.01635564,0.020528011,-0.007790339,0.051299676,-0.04791672,0.030732168,0.055217195,-0.034426298,0.06178515,0.0012667197,-0.03904972,-0.049328256,0.048351344,-0.0860337,-0.015718967,0.09275064,-0.025560671,-0.019069614,-0.08066873,0.04960441,-0.023049746,-0.056898046,0.0032385543,-0.051040743,0.009549142,0.020795956,-0.018794646,0.015302576,-0.048582405,-0.013162642,-0.05900879,-0.00052222173,-0.053530484,0.013752464,0.015265108,0.039229322]'),
_21
('Banana', '[0.019635703,-0.016662825,0.0438706,-0.05679909,0.065090984,0.021733282,0.06932404,0.05716613,-0.028375698,0.033598874,0.03070026,-0.12938243,0.047556713,0.009217823,0.043147042,0.022466118,-0.004610096,0.018666554,-0.0574933,6.868109e-05,0.05209691,-0.014084585,-0.012451078,-0.035549372,0.04206527,0.037208725,-0.050204195,-0.035145547,-0.010901805,-0.15682638,-0.005470431,-0.021524418,0.015910674,-0.04949034,0.0051853815,0.014806365,-0.0056085135,0.03450337,-0.056007136,0.023609918,0.07185804,-0.014022289,-0.016194828,-0.108324386,-0.044947192,-0.046223115,-0.02189368,-0.019143095,0.06842713,-0.009386807,0.0113680465,-0.043105036,-0.017536012,0.03985226,-0.026393633,0.038680777,0.10853933,0.020019624,-0.0026814984,0.023394262,0.075863995,0.019038668,-0.19950384,0.055614036,0.028766343,0.010403027,-0.04593247,-0.015267849,0.010628882,0.066665724,-0.014128945,0.03466571,0.025084144,0.065656714,0.017702313,-0.032993343,0.05914002,-0.105294295,-0.005326594,0.04990947,-0.039132904,-0.02830107,-0.08071914,-0.028800204,-0.020271,-0.049152274,0.0043607694,-0.047078244,0.05794935,0.01023668,-0.025150688,0.00729757,0.05313274,0.007297015,-0.093589135,-0.014347521,0.031550843,-0.018207908,-0.033484485,0.23968731,-0.04008758,0.0060827625,-0.004287125,-0.04060174,0.035998467,-0.013882029,-0.015104646,-0.04700737,0.015394095,0.02893912,0.031648815,-0.002771979,0.03083158,-0.05707041,0.010538449,-0.053470287,0.06256131,0.011704445,-0.014541999,-0.01051473,-0.006733189,0.044093613,0.013339935,-0.06267326,0.0428632,-0.07038315,-0.009143276,0.09994883,0.004987607,0.026885895,0.08034262,-0.033635627,-0.022487551,-0.030024724,0.026934387,0.029255223,0.027208928,0.0069896323,-0.046474732,-0.058649674,-0.07008608,-0.06753458,-0.034869235,-0.120450824,-0.010866406,0.08480637,-0.05114118,0.06559932,-0.031219408,0.032882344,-0.017922925,0.033752162,-0.03199418,0.01667962,0.037241977,0.022630231,0.045894135,0.030753318,-0.02215518,0.017770028,-0.025049254,-0.045379672,-0.06098087,0.063464515,0.020640565,-0.10424734,-0.00786076,0.028407086,0.012444685,-0.010966217,0.025792638,0.031150766,-0.09807386,0.009220468,0.07690304,0.031107485,-0.02323454,0.01232304,0.027339907,-0.009314799,0.025466112,-0.0526805,0.011169639,0.026503928,0.053522177,-0.026159566,-0.02141847,0.0077685686,0.068012245,0.043427285,0.025749903,0.015305993,-0.05753994,0.036382552,-0.037798975,-0.06504522,-0.025704943,-0.034619145,0.009529093,-0.039157882,0.05972188,-0.029291982,-0.054928947,0.0015608502,0.019036693,0.0087293945,-0.0043398645,0.017392809,0.02264325,0.025433283,-0.04307134,-0.0022087728,0.07539596,-0.031026198,-0.08422478,0.015684372,-0.007135754,0.07095444,0.05106952,0.021192841,0.022940988,-0.09845196,-0.054315202,-0.2283184,0.00039206562,0.020285372,-0.0032002586,0.09146159,0.020653537,0.027857816,-0.03427893,0.042690206,-0.013986325,0.04072902,0.016655613,-0.015795486,0.09504197,-0.022981595,0.030391654,0.059060454,-0.0011297392,0.0129476525,0.024110911,0.0024470065,0.017639639,-0.0011270575,-0.06595389,0.016953548,-0.013562799,0.23597829,0.10829628,0.00782811,-0.038939714,-0.0005555627,-0.002915367,-0.015536974,-0.10943432,0.026033664,0.020181289,0.0003686194,-0.04886056,-0.02366949,-0.0001586763,-0.03300311,0.040830493,-0.024658168,-0.07623268,0.0075789504,-0.024747914,-0.011904173,0.00024992827,-0.035677873,0.0060291006,0.029552713,-0.020987893,-0.01081308,-0.00033254165,0.01623525,-0.035739012,-0.08761928,0.0008644093,-0.0059358636,0.017304605,0.006209267,-0.050949544,0.032538358,-0.032607634,0.01767997,0.016854625,0.0251009,-0.056566466,0.029434936,-0.027132805,-0.0037773196,0.08622786,-0.024845831,-0.0149036255,0.0677935,0.035698667,0.053244714,-0.023172028,-0.057150465,-0.042664234,0.016723031,-0.0110892,0.027086386,0.040617514,0.021721961,-0.008825345,0.09014068,-0.00031725666,0.037772376,-0.028894745,0.0071449205,-0.00014647323,-0.020653443,-0.054506272,0.037730232,-0.02952679,-0.27268472,0.06581913,-0.025963487,0.046704344,-0.023291914,-0.001648131,0.064198926,0.03256141,-0.07444727,0.03312911,0.029869812,0.0011079342,0.02101518,-0.018955339,0.018415285,0.04355975,0.02111472,-0.060182165,0.05878127,-0.028283918,0.029465748,0.003601499,0.2091422,-0.05559134,-0.00097313384,0.0067268955,-0.013934751,0.028899418,0.0306436,-0.018715024,0.027255507,0.034688573,0.111619085,-0.0074516083,-0.0008301801,0.052996,-0.018112244,0.0149507355,0.030463047,-0.018259967,-0.038920976,0.0023088527,-0.044930156,-0.04536979,0.07041295,-0.025604915,0.008208011,-0.07095862,0.019948348,-0.008449301,-0.016477905,-0.046026208,-0.0107074315,0.0250523,0.05894703,-0.050161943,-0.026808146,-0.038142174,-0.027797315,-0.069310926,0.022376642,-0.04382796,-0.019629879,0.019454641,0.026503637]');
_21
`)
_21
}
_21
_21
// [...]

Define the inner product search function with pgvector

In PGlite we can use pgvector just like we would in Postgres. Here we create a inner product search function, that takes in three parameters:

  • embedding - The embedding of our search term.
  • match_threshold - The threshold for the inner product.
  • limit - The number of results to return.
utils/db.js

_24
// [...]
_24
_24
export const search = async (db, embedding, match_threshold = 0.8, limit = 3) => {
_24
const res = await db.query(
_24
`
_24
select * from embeddings
_24
_24
-- The inner product is negative, so we negate match_threshold
_24
where embeddings.embedding <#> $1 < $2
_24
_24
-- Our embeddings are normalized to length 1, so cosine similarity
_24
-- and inner product will produce the same query results.
_24
-- Using inner product which can be computed faster.
_24
--
_24
-- For the different distance functions, see https://github.com/pgvector/pgvector
_24
order by embeddings.embedding <#> $1
_24
limit $3;
_24
`,
_24
[JSON.stringify(embedding), -Number(match_threshold), Number(limit)]
_24
)
_24
return res.rows
_24
}
_24
_24
// [...]

Create an embedding for the search term

To generate the embedding for the search term, we set up a web worker that creates our transformers pipeline and event listeners to communicate with the main thread.

worker.js

_45
import { pipeline } from '@huggingface/transformers'
_45
_45
// Use the Singleton pattern to enable lazy construction of the pipeline.
_45
class PipelineSingleton {
_45
static task = 'feature-extraction'
_45
static model = 'Supabase/gte-small'
_45
static instance = null
_45
_45
static async getInstance(progress_callback = null) {
_45
if (this.instance === null) {
_45
this.instance = pipeline(this.task, this.model, {
_45
progress_callback,
_45
dtype: 'fp32',
_45
device: !!navigator.gpu ? 'webgpu' : 'wasm',
_45
})
_45
}
_45
return this.instance
_45
}
_45
}
_45
_45
// Listen for messages from the main thread
_45
self.addEventListener('message', async (event) => {
_45
// Retrieve the classification pipeline. When called for the first time,
_45
// this will load the pipeline and save it for future use.
_45
let classifier = await PipelineSingleton.getInstance((x) => {
_45
// We also add a progress callback to the pipeline so that we can
_45
// track model loading.
_45
self.postMessage(x)
_45
})
_45
_45
// Actually perform the classification
_45
let output = await classifier(event.data.text, {
_45
pooling: 'mean',
_45
normalize: true,
_45
})
_45
_45
// Extract the embedding output
_45
const embedding = Array.from(output.data)
_45
_45
// Send the output back to the main thread
_45
self.postMessage({
_45
status: 'complete',
_45
embedding,
_45
})
_45
})

In our App.jsx we set up a reference worker variable as well as the event listeners:

App.jsx

_55
import { getDB, initSchema, countRows, seedDb, search } from './utils/db'
_55
import { useState, useEffect, useRef, useCallback } from 'react'
_55
_55
export default function App() {
_55
// Keep track of the classification result and the model loading status.
_55
const [input, setInput] = useState('')
_55
const [content, setContent] = useState([])
_55
const [result, setResult] = useState(null)
_55
const [ready, setReady] = useState(null)
_55
const initailizing = useRef(false)
_55
_55
// [...]
_55
_55
// We use the `useEffect` hook to set up the worker as soon as the `App` component is mounted.
_55
useEffect(() => {
_55
if (!worker.current) {
_55
// Create the worker if it does not yet exist.
_55
worker.current = new Worker(new URL('./worker.js', import.meta.url), {
_55
type: 'module',
_55
})
_55
}
_55
_55
// Create a callback function for messages from the worker thread.
_55
const onMessageReceived = async (e) => {
_55
switch (e.data.status) {
_55
case 'initiate':
_55
setReady(false)
_55
break
_55
case 'ready':
_55
setReady(true)
_55
break
_55
case 'complete':
_55
// Inner product search
_55
const searchResults = await search(db.current, e.data.embedding)
_55
console.log({ searchResults })
_55
setResult(searchResults.map((x) => x.content))
_55
break
_55
}
_55
}
_55
_55
// Attach the callback function as an event listener.
_55
worker.current.addEventListener('message', onMessageReceived)
_55
_55
// Define a cleanup function for when the component is unmounted.
_55
return () => worker.current.removeEventListener('message', onMessageReceived)
_55
})
_55
_55
const classify = useCallback((text) => {
_55
if (worker.current) {
_55
worker.current.postMessage({ text })
_55
}
_55
}, [])
_55
_55
// [...]
_55
}

The search is performed in the complete case above, where we provide the generated embedding and then perform the inner product search.

And that's it. You've learned about all the components necessary to build a fully local, in-browser semantic search experience. And the best thing is, it's free to use!

More Supabase Resources

Share this article

Build in a weekend, scale to millions