soccminer

Source Code-Comments Miner tool that mines raw source code for natural language with comprehensive contextual information and other source code attributes. It offers four different mining pipelines that can be fed to AI pipelines.

https://github.com/m3soulu/soccminer

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Source Code-Comments Miner tool that mines raw source code for natural language with comprehensive contextual information and other source code attributes. It offers four different mining pipelines that can be fed to AI pipelines.

Basic Info
  • Host: GitHub
  • Owner: M3SOulu
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 5.6 MB
Statistics
  • Stars: 7
  • Watchers: 5
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Created over 4 years ago · Last pushed about 3 years ago
Metadata Files
Readme License Citation

README.md

Source Code Comments Miner

SoCC-Miner

SoCC-Miner (Source Code-Comments Miner), a novel tool that extracts natural language, contextual source code fragments, source code construct level attributes from raw source code and offers different data pipelines that can be easily used in different use cases in Software Engineering (Source code Summarization, Program Comprehension, Automatic Comment scoping and generation). It is novel as in it can mine and extract entity level natural language text and attributes. For example in Java project: package level, class level, interface level, method level, static block level source code comments and multiple associated attributes can be mined. At present, it supports only Java projects. It offers four different pipelines:

  • CommentsMetaAttribute (Contains basic comment info)
  • ComprehensiveCommentsAttribute (Contains extensive comment context info)
  • JavaMetaAttribute (Contains project entity attributes)
  • JavaMiner (Combines ComprehensiveCommentsAttribute and JavaMetaAttribute)

More details are available at https://m3soulu.github.io/soccminer/main.html

Installation

Not mandatory but it is recommended to create a virtualenv. $ virtualenv -p python3 <venv_name> $ source <venv_name>/bin/activate Clone the repository $ git clone https://github.com/M3SOulu/soccminer $ cd soccminer Install the dependencies. - srcML installation - Install the appropriate srcML client corresponding to your OS (Linux/Windows). https://www.srcml.org/#download

  • Installing soccminer will install the required dependencies and then the soccminer package. $ pip3 install soccminer

Usage from commandline

Usage: ```` $ python3 bin/main.py -i /usr/local/projectrepositoryforanalysis/ -lvl all -o /usr/outputlocationtostoremineddata/ -cs 5

```` Options: - i - (--input) Defines the input to the tool. (Mandatory argument) Can be 'local_dir' containing project repositories as sub-directories or 'Git Repo URL'.

  • l - (--language) The programming language of the project, for now only java project is handled by SoCCMiner. By default, it is set to 'java'.

  • lvl - (--level) Defines the mining/project entity loading level. By default, it is set to 'comment'. Can be,

    • 'comment' to mine/load basic comment info,
    • 'comprehensive_comment' to mine/load comprehensive comment attributes,
    • 'project' to mine/load project attributes),
    • 'all' (for project and comprehensive attributes)
    • NOTE: While loading entities with direct_load input argument set to True, SoCCMiner expects the same mining level with which the project was mined.
  • dl - (--direct_load) If True, loads project entities from the mined entities directory containing the soccminer serialized json files. If False, mines source code projects for comments, source code entities and their attributes according to the mining level input and then loads projects entities into respective pipelines. By default, it is set to False.

  • log - (--logging) Defines the logging level. Can be one of nolog(NOLOG), info(INFO), debug(DEBUG). By default, it is 'nolog'. For other options, the log file will be created in the current working directory.

  • o - (--output) Defines the output directory where the mined entities will be stored. By default, it is current working directory.

  • m - (--mode) Defines SoCC-Miner execution mode, can be 'single' to mine single project directory (i.e., all files and directories within input directory will be treated as a single project), or can be 'multiple' to mine multiple project directories in which all sub-directories within the input directory will be treated as separate project directories. NOTE: For GitHub repository URLs, SoCC-Miner defaults to 'single' mode. SoCC-Miner expects an input directory that contains only project directory/ies as sub-directory/ies in 'multiple' mode.

  • cs - (--context_span) Controls the length of the context span (in number of lines, values can be positive, for example, 1 or 5 or 10, etc.,) to be fetched for both preceding and succeeding source code context of a comment.

Usage from API

Refer scripts : 1. soccminercomments.py (for Comments Meta Attributes), 2. soccminercommentsattr.py (for Comprehensive Comments Attributes), 3. soccminerprojattr.py (for Project Attributes) and 4. soccminerprojcommentsattr.py (for both comprehensive comments and project attributes).

Before execution, do not forget to change the input directories for mining and loading.

NOTE: In demo scripts, loading immediately follows mining in reality it need not be the same. One can mine the repos in one location, zip and transfer to another location, then minedentities are unzipped and the folder location is given as input to the loadingproject call, then the loaded objects serve as pipelines for AI applications. $ python3 soccminer_comments.py Similarly other scripts (pipelines) can be executed.

Owner

  • Name: Empirical Software Engineering in Software, Systems and Services Research Group
  • Login: M3SOulu
  • Kind: organization
  • Location: Oulu, Finland

The M3S research group at the University of Oulu, Finland

GitHub Events

Total
Last Year

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 50
  • Total Committers: 2
  • Avg Commits per committer: 25.0
  • Development Distribution Score (DDS): 0.06
Top Committers
Name Email Commits
ruyog m****0@g****m 47
mmantyla m****a@g****m 3

Dependencies

requirements.txt pypi
  • certifi >=2021.10.8
  • charset-normalizer >=2.0.7
  • idna >=3.3
  • lxml >=4.6.4
  • numpy >=1.19.5
  • python-dateutil >=2.8.2
  • pytz >=2021.3
  • requests >=2.26.0
  • six >=1.16.0
  • ujson >=4.2.0
  • urllib3 >=1.26.7
setup.py pypi
  • certifi *
  • charset-normalizer *
  • idna *
  • lxml *
  • numpy *
  • python-dateutil *
  • pytz *
  • requests *
  • six *
  • ujson *
  • urllib3 *