Giter Club home page Giter Club logo

wrd's Introduction

WRD implementaion for Japanese texts

This repository is a WRD(Word Rotator's Distance) implemenation for Japanese texts. WRD is an improved algorithm of WMD(Word Mover's Distance) and achieves great performances in measuring textual similarities. See the details in the paper.

Requirements

Install Python modules

Download pre-trained vectors for Word2vec

From this site, download pre-trained vectors trained on Japanese Wikipedia and set it in vecs directory. jawiki.word_vectors.200d.txt.bz2 is recommended.

If you want, your original pre-trained vectors could be used.

Usage

Just run the below command. --mecab_dict_path is an optional argument.

$ python main.py --mecab_dict_path /usr/local/lib/mecab/dic/mecab-ipadic-neologd/

The result is shown as below, if you succeed. The value of the final line is WRD of the two sentences. The smaller WRD, the more similar. The larger WRD, the less similar.

大坂なおみ 逆転で2年ぶり2度目の全米OP優勝。3度目のグランドスラム制覇
大坂なおみが2年ぶり2回目のV 4大大会3勝目 全米テニス
0.31
大坂なおみ 逆転で2年ぶり2度目の全米OP優勝。3度目のグランドスラム制覇
大相撲秋場所 八角理事長「横綱不在 申し訳ない」
0.57

If you'd like to change the sentences to compare, edit the main.py directly.

wrd's People

Contributors

kenta1984 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.