strus  0.17
vectorStorageClientInterface.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
9 #ifndef _STRUS_VECTOR_STORGE_CLIENT_INTERFACE_HPP_INCLUDED
10 #define _STRUS_VECTOR_STORGE_CLIENT_INTERFACE_HPP_INCLUDED
11 #include "strus/wordVector.hpp"
13 #include <vector>
14 #include <string>
15 
16 namespace strus {
17 
19 class VectorStorageTransactionInterface;
21 class ValueIteratorInterface;
22 
25 {
26 public:
29 
33  virtual void prepareSearch( const std::string& type)=0;
34 
41  virtual std::vector<VectorQueryResult> findSimilar( const std::string& type, const WordVector& vec, int maxNofResults, double minSimilarity, bool realVecWeights) const=0;
42 
47 
50  virtual std::vector<std::string> types() const=0;
51 
55 
59  virtual std::vector<std::string> featureTypes( const std::string& featureValue) const=0;
60 
64  virtual int nofVectors( const std::string& type) const=0;
65 
70  virtual WordVector featureVector( const std::string& type, const std::string& featureValue) const=0;
71 
76  virtual double vectorSimilarity( const WordVector& v1, const WordVector& v2) const=0;
77 
79  virtual WordVector normalize( const WordVector& vec) const=0;
80 
83  virtual std::string config() const=0;
84 
89  virtual void close()=0;
90 };
91 
92 }//namespace
93 #endif
94 
95 
Vector type used for word embedding vector calculations.
Interface to a repository for vectors representing word embeddings.
Definition: vectorStorageClientInterface.hpp:24
virtual std::vector< std::string > featureTypes(const std::string &featureValue) const =0
Get the list of types assigned to a specific featureValue.
virtual WordVector featureVector(const std::string &type, const std::string &featureValue) const =0
Get the vector assigned to a feature value.
Result of a vector similarity search.
Interface for building a repository of vectors with classifiers to map them to discrete features...
Definition: vectorStorageTransactionInterface.hpp:19
virtual void prepareSearch(const std::string &type)=0
Prepare datastructures for calling findSimilar( const WordVector&, int,double,bool)const'.
virtual WordVector normalize(const WordVector &vec) const =0
Calculate the normalized vector representation of the argument vector.
virtual std::string config() const =0
Get the configuration of this storage.
Structure that represents a set of strings as iterator.
Definition: valueIteratorInterface.hpp:21
virtual ValueIteratorInterface * createFeatureValueIterator() const =0
Create an iterator on the feature values inserted.
virtual VectorStorageTransactionInterface * createTransaction()=0
Create an insert/update transaction object.
virtual std::vector< std::string > types() const =0
Get the list of types defined.
virtual void close()=0
Close client connection and eventually do some cleanup.
virtual ~VectorStorageClientInterface()
Destructor.
Definition: vectorStorageClientInterface.hpp:28
std::vector< float > WordVector
Definition: wordVector.hpp:16
virtual double vectorSimilarity(const WordVector &v1, const WordVector &v2) const =0
Calculate a value between 0.0 and 1.0 representing the similarity of two vectors. ...
virtual std::vector< VectorQueryResult > findSimilar(const std::string &type, const WordVector &vec, int maxNofResults, double minSimilarity, bool realVecWeights) const =0
Find all features that are within maximum simiarity distance.
virtual int nofVectors(const std::string &type) const =0
Get the number of vectors defined for the features of a type.