piskvorky / gensim

Topic Modelling for Humans
https://radimrehurek.com/gensim
GNU Lesser General Public License v2.1
15.55k stars 4.37k forks source link

Trans-gram #1629

Open menshikh-iv opened 6 years ago

menshikh-iv commented 6 years ago

Feature request for cross-lingual embedding

Maillist thread: https://groups.google.com/forum/#!topic/gensim/zksGwKHnIUA Paper: http://aclweb.org/anthology/D15-1131 Abstract: Trans-gram, a simple and computationally-efficient method to simultaneously learn and align wordembeddings for a variety of languages, using only monolingual data and a smaller set of sentence-aligned data. We use our new method to compute aligned wordembeddings for twenty-one languages using English as a pivot language. We show that some linguistic features are aligned across languages for which we do not have aligned data, even though those properties do not exist in the pivot language. We also achieve state of the art results on standard cross-lingual text classification and word translation tasks.

sammous commented 6 years ago

It's indeed an easy way to implement a word2vec model keeping similarities no matter the language and is a good introduction to cross lingual models. The way I easily did it is too update the code where the fast_sentence_sg is done (beforehand updated to be able to process aligned sentences) (here). If the model has access to the aligned corpus (by updating directly the class Word2Vec, then we just need to add a new loop for the aligned sentence so the vectors of the translated words in the specific windows are updated with the word in the previous window for a single language.

The link for the paper is wrong : http://aclweb.org/anthology/D15-1131

menshikh-iv commented 6 years ago

@sammous thanks, link updated