Skip to content

richorama/NWord2Vec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NWord2Vec

Build status

C# library for working with Word2Vec models.

Installation

PM> Install-Package NWord2Vec

View on Nuget

Usage

First build your model with the word2vec command line tools.

You can then load the model into the Model class:

// load the model from a file
var model = Model.Load("model.txt");

// Find the simliarity between words
model.Distance("whale", "boat"); // 2.718597934021814

model.Nearest("whale").Take(10);

/*
// returns
[
	{
		Word : "first",
		Distance : 2.0338702394548
	},
	{
		Word : "most",
		Distance : 2.06254369516037
	},
	...
]
*/


// Add and subtract vectors

var king = model.GetByWord("king");
var man = model.GetByWord("man");
var woman = model.GetByWord("woman");

var vector = king.Subtract(man).Add(woman);

model.NearestSingle(vector); // queen

// alternatively you can add or subtract directly

var vector = king + man;

License

MIT

About

💬 C# library for working with Word2Vec models

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages