Skip to main content

A library for Natural Language Processing style preprocessing for source code in different languages

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sourcy-0.2.2.dev0.tar.gz (90.9 kB view details)

Uploaded Source

File details

Details for the file sourcy-0.2.2.dev0.tar.gz.

File metadata

  • Download URL: sourcy-0.2.2.dev0.tar.gz
  • Upload date:
  • Size: 90.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sourcy-0.2.2.dev0.tar.gz
Algorithm Hash digest
SHA256 3a115b8b7df1c3d566ad6955c6c4b9f0f60e031f6c8ded5a6a13f3debb15bab7
MD5 39e756d84ba49497f826a7af88964077
BLAKE2b-256 ca256781cd1cb280889a369e0911d6a2f756699023b4ce4f34d305852101ade4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page