All Projects → alexsosn → Word2Vec-iOS

alexsosn / Word2Vec-iOS

Licence: Apache-2.0 license
Word2Vec iOS port

Programming Languages

objective c
16641 projects - #2 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to Word2Vec-iOS

Shallowlearn
An experiment about re-implementing supervised learning models based on shallow neural network approaches (e.g. fastText) with some additional exclusive features and nice API. Written in Python and fully compatible with Scikit-learn.
Stars: ✭ 196 (+752.17%)
Mutual labels:  word2vec
Koan
A word2vec negative sampling implementation with correct CBOW update.
Stars: ✭ 232 (+908.7%)
Mutual labels:  word2vec
Simple-Sentence-Similarity
Exploring the simple sentence similarity measurements using word embeddings
Stars: ✭ 99 (+330.43%)
Mutual labels:  word2vec
Word2vec
Python interface to Google word2vec
Stars: ✭ 2,370 (+10204.35%)
Mutual labels:  word2vec
Practical 1
Oxford Deep NLP 2017 course - Practical 1: word2vec
Stars: ✭ 220 (+856.52%)
Mutual labels:  word2vec
Aravec
AraVec is a pre-trained distributed word representation (word embedding) open source project which aims to provide the Arabic NLP research community with free to use and powerful word embedding models.
Stars: ✭ 239 (+939.13%)
Mutual labels:  word2vec
Nlp learning
结合python一起学习自然语言处理 (nlp): 语言模型、HMM、PCFG、Word2vec、完形填空式阅读理解任务、朴素贝叶斯分类器、TFIDF、PCA、SVD
Stars: ✭ 188 (+717.39%)
Mutual labels:  word2vec
Vaaku2Vec
Language Modeling and Text Classification in Malayalam Language using ULMFiT
Stars: ✭ 68 (+195.65%)
Mutual labels:  word2vec
Cw2vec
cw2vec: Learning Chinese Word Embeddings with Stroke n-gram Information
Stars: ✭ 224 (+873.91%)
Mutual labels:  word2vec
russe
RUSSE: Russian Semantic Evaluation.
Stars: ✭ 11 (-52.17%)
Mutual labels:  word2vec
Sensegram
Making sense embedding out of word embeddings using graph-based word sense induction
Stars: ✭ 209 (+808.7%)
Mutual labels:  word2vec
Stocksensation
基于情感字典和机器学习的股市舆情情感分类可视化Web
Stars: ✭ 215 (+834.78%)
Mutual labels:  word2vec
Movietaster Open
A practical movie recommend project based on Item2vec.
Stars: ✭ 253 (+1000%)
Mutual labels:  word2vec
Chameleon recsys
Source code of CHAMELEON - A Deep Learning Meta-Architecture for News Recommender Systems
Stars: ✭ 202 (+778.26%)
Mutual labels:  word2vec
grad-cam-text
Implementation of Grad-CAM for text.
Stars: ✭ 37 (+60.87%)
Mutual labels:  word2vec
Germanwordembeddings
Toolkit to obtain and preprocess german corpora, train models using word2vec (gensim) and evaluate them with generated testsets
Stars: ✭ 189 (+721.74%)
Mutual labels:  word2vec
Book deeplearning in pytorch source
Stars: ✭ 236 (+926.09%)
Mutual labels:  word2vec
Word2VecAndTsne
Scripts demo-ing how to train a Word2Vec model and reduce its vector space
Stars: ✭ 45 (+95.65%)
Mutual labels:  word2vec
word-embeddings-from-scratch
Creating word embeddings from scratch and visualize them on TensorBoard. Using trained embeddings in Keras.
Stars: ✭ 22 (-4.35%)
Mutual labels:  word2vec
Cukatify
Cukatify is a music social media project
Stars: ✭ 21 (-8.7%)
Mutual labels:  word2vec

Word2Vec-iOS

Word2Vec Swift wrapper.

Original Word2Vec implementation is here. Nice alghorithm description is available on deeplearning4j documentation page.

Basic usage

Train the model

let inputURL = NSBundle.mainBundle().URLForResource("text8", withExtension: nil)

let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
let documentsDirectory = paths[0]
let outputURL = NSURL(fileURLWithPath: documentsDirectory).URLByAppendingPathComponent("out.bin")

let model = Word2VecModel()
model.trainFile = inputURL
model.outputFile = outputURL
model.train()

You can find some text corpuses and pretrained models (*.bin) in Word2Vec-iOS/res folder.

Use model to find connected words:

let result = model.distance("cat", numberOfClosest: 10) // Look for 10 words semantically similar to "cat".
print(result)

Outputs words and similarity measure:

Optional(["bird": 0.760521, "cow": 0.766533, "dog": 0.831517, "rat": 0.748557, "blonde": 0.763721, "pig": 0.751001, "goat": 0.798104, "hamster": 0.768635, "bee": 0.774112, "llama": 0.747295])

Blonde and cat, really? hmmm...

let result = model.distance("wedding", numberOfClosest: 10)
print(result)

Optional(["banquet": 0.723855, "dinner": 0.711831, "funeral": 0.772873, "madonna": 0.688461, "bride": 0.721245, "diana": 0.685946, "bedroom": 0.691792, "reunion": 0.673289, "aunt": 0.703193, "maid": 0.66286])

Find analogy:

let result = model.analogy("man woman king", numberOfClosest: 1) // (man - woman) == (king - ???)
print(result)

Optional(["daughter": 0.613628, "queen": 0.707821, "empress": 0.62057, "prince": 0.611979, "elizabeth": 0.60867])

Man to woman is the same as king to queen.

Another example:

let result = model.analogy("pet toy", numberOfClosest: 1) // (pet - toy) = (???)
print(result)

Optional(["partake": 0.481817, "eat": 0.502222, "allah": 0.457967, "preach": 0.49685, "marry": 0.449955])

Pet is a toy which eats. (Or the toy you can eat?)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].