C# 클래스 GoodAI.ToyWorld.Language.Vocabulary

Words and word vectors.
파일 보기 프로젝트 열기: GoodAI/BrainSimulator 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
VectorType WordVectorType

공개 메소드들

메소드 설명
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 ( LabeledVector 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.

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 ( StreamReader vocabularyReader ) : void

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.

비공개 메소드들

메소드 설명
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 ( StreamReader vocabularyReader ) : void

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 ( StreamReader vocabularyReader ) : void

Reads labeled vectors from a text file.

ReadLineFields ( StreamReader vocabularyReader ) : string[]

Reads a line and splits it on whitespace into fields.

메소드 상세

Add() 공개 메소드

Adds a labeled vector to the vocabulary, assigning a default (random) value to the vector.
public Add ( string label ) : void
label string The label
리턴 void

Add() 공개 메소드

Adds a labeled vector to the vocabulary.
public Add ( string label, float vector ) : void
label string The label
vector float The vector
리턴 void

FindNearestNeighbors() 공개 메소드

Finds the vectors most similar to the input vector. If the input is the zero vector, an empty list is returned.
public FindNearestNeighbors ( LabeledVector vector, int neighborhoodSize ) : LabeledVector>>.List
vector LabeledVector The input vector
neighborhoodSize int The number of neighbors to retrieve
리턴 LabeledVector>>.List

FindNearestNeighbors() 공개 메소드

Finds the vectors most similar to the input vector. If the input is the zero vector, an empty list is returned.
public FindNearestNeighbors ( float vector, int neighborhoodSize ) : LabeledVector>>.List
vector float The input vector
neighborhoodSize int The number of neighbors to retrieve
리턴 LabeledVector>>.List

IsZero() 공개 정적인 메소드

Returns true if the argument is the zero vector.
public static IsZero ( float vector ) : bool
vector float The input vector
리턴 bool

Read() 공개 메소드

Loads the vocabulary from text using a StreamReader
public Read ( StreamReader vocabularyReader ) : void
vocabularyReader System.IO.StreamReader The reader
리턴 void

ReadTextFile() 공개 메소드

Loads the vocabulary from a file in text format (e.g., word2vec)
public ReadTextFile ( string path ) : void
path string The path to the vocabulary text file
리턴 void

VectorFromLabel() 공개 메소드

Retrieves the vector that corresponds to a label.
public VectorFromLabel ( string label ) : float[]
label string The label to look up
리턴 float[]

Vocabulary() 공개 메소드

Constructs the Vocabulary.
public Vocabulary ( int vectorDimensions, WordVectorType vectorType = WordVectorType.Random ) : System
vectorDimensions int The number of word vector dimensions
vectorType WordVectorType The vector type used
리턴 System

프로퍼티 상세

VectorType 공개적으로 프로퍼티

The vector type used (see WordVectorType)
public WordVectorType VectorType
리턴 WordVectorType