Code Monkey home page Code Monkey logo

corpus_similarity's Introduction

corpus_similarity

Measure the similarity between two corpora (text datasets). The measures work best when each corpus is at least 10k words.

from corpus_similarity import Similarity
cs = Similarity(language = "eng")

result = cs.calculate(corpus1, corpus2)

The package contains all preprocessing and training. Only the language needs to be specified. A list of supported languages is provided below.

Input

The Similarity.calculate method requires two input corpora. These can be a list of strings or a filename (supports .txt and .gz files).

Output

The output is a scalar measure of how similar the two corpora are. The values fall between 0 (very different) and 1 (very similar). The values are consistent within languages, but not across languages. For example, Swedish has higher relative similarity than Estonian.

Installation

pip install corpus_similarity

pip install git+https://github.com/jonathandunn/corpus_similarity.git

Languages

Pacific Languages

haw, Hawaiian (Polynesian)

mri, te reo (Polynesian)

smo, Samoan (Polynesian)

ton, Tongan (Polynesian)

ceb, Cebuano (Austronesian)

mlg, Malagasy (Austronesian)

msa, Malay (Austronesian)

tgl, Tagalog (Austronesian)

Other Languages

vie, Vietnamese

ind, Indonesian

tgl, Tagalog

tam, Tamil

tel, Telugu

bul, Bulgarian

ces, Czech

lav, Latvian

pol, Polish

rus, Russian

slv, Slovenian

ukr, Ukrainian

dan, Danish

deu, German

eng, English

nld, Dutch

nor, Norwegian

swe, Swedish

ell, Greek

fas, Farsi

hin, Hindi

urd, Urdu

cat, Catalan

fra, French

glg, Galician

ita, Italian

por, Portuguese

ron, Romanian

spa, Spanish

jpn, Japanese

kor, Korean

ara, Arabic

heb, Hebrew

zho, Chinese

tha, Thai

tur, Turkish

est, Estonian

fin, Finnish

hun, Hungarian

corpus_similarity's People

Contributors

jonathandunn avatar pingpangqiu45 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.