Skip to content

soheilabadifard/Kotlin-comments-sentiment-analysis

Repository files navigation

Kotlin-comments-sentiment-analysis

License: MIT Build Version Downloads

Table of Contents

This Fancy IntelliJ Platform Plugin is going to be your implementation of the brilliant ideas that you have.

This specific section is a source for the plugin.xml file which will be extracted by the Gradle during the build process.

To keep everything working, do not remove <!-- ... --> sections.


Overview

This IntelliJ IDEA plugin performs sentiment analysis on comments within Kotlin files using the RoBERTa model. It can be accessed via an Tools menu action with name of Analyze KT File's Sentiment, providing statistics per file for the analyzed sentiments.


Features


Installation

  • Download the plugin from this repository.
  • In IntelliJ IDEA, go to Settings/Preferences > Plugins > ⚙️ > Install plugin from disk....
  • Select the downloaded plugin file.
  • Restart IntelliJ IDEA to activate the plugin.

Requirements

  • Make sure that the RoBERTa-SequenceClassification model is downloaded and placed in the root folder of the project that the plugin will operate on beforehand. If the model is not found, the plugin will download it automatically. The size of the model is 0.5 GB.
  • The plugin will only work on Kotlin Projects and analyze the files with the .kt extension.
  • In order to run the plugin 3 Important files also need to be present in the root folder of the project:
    • base_vocabulary.json - map of numbers ([0,255]) to symbols (UniCode Characters). Only those symbols will be known by the algorithm. e.g., given s as input it iterates over the bytes of the String s and replaces each given byte with the mapped symbol. This way we assure what characters are passed.
    • merges.txt - describes the merge rules of words. The algorithm splits the given word into two subwords, afterward it decides the best split according to the rank of the sub words. The higher those words are, the higher the rank.
    • vocabulary.json - Is a file that holds all the words(sub-words) and their token according to training.
    • The plugin will automatically place them in the root folder of the project if they are not found. However, if in case the plugin is not able to place them, you can place them manually from here or here.

Usage

  • After installing the plugin, and before opening a project, make sure that the requirements are met.
  • Open a Kotlin project in IntelliJ IDEA.
  • Go to Tools > Analyze KT File's Sentiment .
  • A side panel on the right side will be ready with the statistics of the analyzed sentiments for each Kotlin file.

Please note:

  • The results will be shown after all the background activities such as indexing are finished.

Testing

In order to test the plugin, you can use the test project provided in the repository. To do so, follow the steps below:

  • Download zip file in the following directory test project and unzip it.
  • If you have not already downloaded the RoBERTa-SequenceClassification model, download it and place it in the root folder of the test project. Or you can let the plugin download it automatically.
  • Then open the project in IntelliJ IDEA.
  • Let the project index and build.
  • Go to Tools > Analyze KT File's Sentiment .
  • A side panel on the right side will be ready with the statistics of the analyzed sentiments for each Kotlin file.

Contributing

Contributions to the plugin are welcome. Please submit pull requests to the repository for any enhancements.


License

This project is licensed under the MIT License - see the LICENSE file for details.


Plugin based on the IntelliJ Platform Plugin Template.

About

Plugin repository to perform sentiment analysis on comments in Kotlin files

Topics

Resources

License

Stars

Watchers

Forks