Skip to main content

sourCy

https://img.shields.io/pypi/v/sourcy.svg https://img.shields.io/travis/SasCezar/sourcy.svg Documentation Status

A library for NLP like preprocessing for source code in different programming languages. The architecture follows the one of spaCy.

Features

  • Grammar based parsing

  • Multilanguage Support

Usage

To use sourCy in a project:

import sourcy

code = """
        # This function computes the factor of the argument passed
        def print_factors(x):
            print("The factors of",x,"are:")

            for i in range(1, x + 1):
                if x % i == 0:
                print(i)

        num = 320

        print_factors(num)
        """

# Creates a pipeline to process source code
scp = sourcy.load("python")

# Process the code and create a document with the tokens and the annotation
doc = scp(code)

for token in doc:
    print(token.token, token.annotation, token.block)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2020-08-11)

  • First release on PyPI.

Metadata

Release files for sourcy 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sourcy 0.2.2
File Size Uploaded
sourcy-0.2.2.tar.gz 91.3 kB Details

Release files / sourcy-0.2.2.tar.gz

Download URL sourcy-0.2.2.tar.gz
Size 91.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3e19082ca5c4740cd52c189f3e310c18b48da37f36581815038949c808f5e704
BLAKE2b-256 checksum
How to use checksums
8161e63381b188e8e2a51fd05e79687075748cb96ab6f8b87db8abd415a06506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.2.2 This release

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page