Property | Type | Description | |
---|---|---|---|
VectorType | WordVectorType |
Method | Description | |
---|---|---|
Add ( string label ) : void |
Adds a labeled vector to the vocabulary, assigning a default (random) value to the vector.
|
|
Add ( string label, float vector ) : void |
Adds a labeled vector to the vocabulary.
|
|
FindNearestNeighbors ( |
Finds the vectors most similar to the input vector. If the input is the zero vector, an empty list is returned.
|
|
FindNearestNeighbors ( float vector, int neighborhoodSize ) : LabeledVector>>.List |
Finds the vectors most similar to the input vector. If the input is the zero vector, an empty list is returned.
|
|
IsZero ( float vector ) : bool |
Returns true if the argument is the zero vector.
|
|
Read ( |
Loads the vocabulary from text using a StreamReader
|
|
ReadTextFile ( string path ) : void |
Loads the vocabulary from a file in text format (e.g., word2vec)
|
|
VectorFromLabel ( string label ) : float[] |
Retrieves the vector that corresponds to a label.
|
|
Vocabulary ( int vectorDimensions, WordVectorType vectorType = WordVectorType.Random ) : System |
Constructs the Vocabulary.
|
Method | Description | |
---|---|---|
GetOOVVector ( string label ) : float[] |
Returns a new vector for an out-of-vocabulary word.
|
|
MakeNewVector ( ) : float[] |
Creates a new vector.
|
|
MakeOneOfNVector ( ) : float[] |
Creates a new one-of-N vector.
|
|
MakeRandomVector ( ) : float[] |
Creates a random vector uniformly distributed over the vector space. Components are in [0, 1[.
|
|
ReadFileHeader ( |
Reads the first part of a text file. The header consists of a single line with one or two fields: [number_of_vectors] number_of_dimensions The word2vec text format uses both fields.
|
|
ReadLabeledVectors ( |
Reads labeled vectors from a text file.
|
|
ReadLineFields ( |
Reads a line and splits it on whitespace into fields.
|
public Add ( string label, float vector ) : void | ||
label | string | The label |
vector | float | The vector |
return | void |
public FindNearestNeighbors ( |
||
vector | The input vector | |
neighborhoodSize | int | The number of neighbors to retrieve |
return | LabeledVector>>.List |
public FindNearestNeighbors ( float vector, int neighborhoodSize ) : LabeledVector>>.List |
||
vector | float | The input vector |
neighborhoodSize | int | The number of neighbors to retrieve |
return | LabeledVector>>.List |
public static IsZero ( float vector ) : bool | ||
vector | float | The input vector |
return | bool |
public Read ( |
||
vocabularyReader | The reader | |
return | void |
public ReadTextFile ( string path ) : void | ||
path | string | The path to the vocabulary text file |
return | void |
public VectorFromLabel ( string label ) : float[] | ||
label | string | The label to look up |
return | float[] |
public Vocabulary ( int vectorDimensions, WordVectorType vectorType = WordVectorType.Random ) : System | ||
vectorDimensions | int | The number of word vector dimensions |
vectorType | WordVectorType | The vector type used |
return | System |