Giter Site home page Giter Site logo

simsim's Introduction

simsim

Build Status PyPI - Python Version PyPI

SIMple SIMilarity is a tool by which you can check the similarity of two sources written in Python. The tool is created for checking small pieces of source code that students submit as solutions for the task. It's a way to catch plagiarism. ;-)

Installing

Install and update using pip:

pip install simsim

It has no dependencies and supports Python 3.4 and newer.

Example

  1. You can use it as a python library. Here is an example:
import simsim

CODE_A = """
a = 3

def foo(bar):
   return bar
"""

CODE_B = """
b = 3

def foo2(bar):
   return bar
"""

result = simsim.compare(CODE_A, CODE_B)
print('Ratio:', result['ratio'])
# prints Ratio: 1.0
  1. Or from command line:
$ simsim examples/tiny1.py examples/tiny2.py
Similarity: 1.00

examples/tiny1.py:__main__
--------------------------
examples/tiny2.py:__main__: 0.99
examples/tiny2.py:__main__.Point.__init__: 0.23
examples/tiny2.py:__main__.Point: 0.23
examples/tiny2.py:__main__.Point.export: 0.17
examples/tiny2.py:__main__.foo: 0.13

examples/tiny1.py:__main__.Point
--------------------------------
examples/tiny2.py:__main__.Point: 1.00
examples/tiny2.py:__main__.Point.__init__: 0.38
examples/tiny2.py:__main__.foo: 0.25
examples/tiny2.py:__main__: 0.23
examples/tiny2.py:__main__.Point.export: 0.22

examples/tiny1.py:__main__.Point.__init__
-----------------------------------------
examples/tiny2.py:__main__.Point.__init__: 1.00
examples/tiny2.py:__main__.Point.export: 0.67
examples/tiny2.py:__main__.foo: 0.53
examples/tiny2.py:__main__.Point: 0.38
examples/tiny2.py:__main__: 0.23

examples/tiny1.py:__main__.Point.export
---------------------------------------
examples/tiny2.py:__main__.Point.export: 1.00
examples/tiny2.py:__main__.Point.__init__: 0.67
examples/tiny2.py:__main__.foo: 0.64
examples/tiny2.py:__main__.Point: 0.22
examples/tiny2.py:__main__: 0.17

examples/tiny1.py:__main__.foo
------------------------------
examples/tiny2.py:__main__.foo: 1.00
examples/tiny2.py:__main__.Point.export: 0.64
examples/tiny2.py:__main__.Point.__init__: 0.53
examples/tiny2.py:__main__.Point: 0.25
examples/tiny2.py:__main__: 0.13

(it shows similarity between different scopes in the files)

simsim's People

Contributors

dependabot[bot] avatar kidig 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.