Expand description
Embedders: text to vectors, for a provider that can recall by meaning as well as by words. None is used unless the settings name one.
StaticVectors: a table of word vectors read from a file (the word2vec text format that fastText and GloVe use, and that a model2vec model can be exported to). A text’s vector is the mean of its words’ vectors. No model runs and nothing leaves the machine.Command: a program the user names that runs a local model. It reads a JSON array of texts on standard input and writes a JSON array of vectors, one per text, on standard output.
Vectors from different models are never compared: each embedder names
its model, and a provider keeps that name beside
every vector it stores.
Structs§
- Command
- A local model behind a program:
argv[0]with the rest as arguments, run once per call. It gets a JSON array of strings on standard input and must print a JSON array of number arrays, one per string, alldimensionlong, and exit 0 within the timeout. - Lazy
- An embedder made on first use, so a large vector file is read when memory is first asked for, off the daemon’s event loop, and not when the settings are read. A failure to make it is kept and returned by every call.
- Static
Vectors - Word vectors from a file.
Traits§
- Embedder
- Turns texts into vectors of one dimension.
Functions§
- cosine
- Cosine similarity, or 0 when either vector is all zeros.