wmd4j is a Java library for computing Word Mover's Distance (WMD) between two text documents. It provides the same functionality as Word2Vec.wmdistance in Gensim.
wmd4j depends on deeplearning4j WordVectors interface for word vector manipulation and uses an optimized version of JFastEMD (Earth Mover's Distance transportation problem) underneath, which is about 1.8x faster.
This is a forked and updated version of crtomirmajer/wmd4j.
WordVectors vectors = WordVectorSerializer.loadStaticModel(new File(word2vecPath));
WordMovers wordMovers = WordMovers.builder().wordVectors(vectors).build();
wordMovers.distance("obama speaks to the media in illinois", "the president greets the press in chicago");
wmd4j is validated against Gensim's wmdistance results on custom word2vec model.