Giter VIP home page Giter VIP logo

copy-sentiment-analysis's Introduction

Copy Sentiment Analysis

javscript-action status Known Vulnerabilities

This GitHub Action runs Sentiment Analysis over the built text of your GitHub project. It uses Google's analyzeSentiment API, evaluating the overall emotion score (from positive to negative) of a page. The Action provides an overview of the scores of all the pages from your project (more on interpreting the scores).

๐Ÿš€ Usage

Usage example

This is a workflow example of using the Action on plain .html files from the public folder (by default).

name: Sentiment analysis on public

on: push

jobs:
  analysis:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2 #Be sure you checkout the files beforehand
    - name: Run sentiment analysis on HTML files
      uses: bogdaaamn/[email protected]
      with: 
        gcp_key: ${{ secrets.GCP_KEY }} #Google Cloud Platform API key. Read the README for instructions 

Although, if you project needs to be built beforehand, be sure you place the Action after the building step. Here is an example for React.

name: Sentiment analysis on React

on: push

jobs:
  analysis:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2 #Be sure you checkout the files beforehand
    - name: Build and test #Build the HTML files beforehand.
      run: |
        npm ci
        npm run build
        npm test
    - name: Run sentiment analysis on HTML files
      uses: bogdaaamn/[email protected]
      with: 
        gcp_key: ${{ secrets.GCP_KEY }} #Google Cloud Platform API key. Read the README for instructions
        files: "build/**/*.html" #Glob patterns from files to be analayzed. Read the README for instructions

๐Ÿน Inputs

gcp_key: Get your GCP API Key

The examples above use required input gcp_key. Because the Actions uses the Google API you need generate a key on your own as it follows:

Read more about Creating API Keys.

GCP Visual Instructions

โš ๏ธ Be very sure you don't share the key or paste it in plain code! It is enough to add it to the GitHub Project's Secrets as it follows:

  • On your project's page click on the Settings button;
  • Navigate to Secrets panel;
  • Click on New secret;
  • Name it GCP_KEY and paste the key there.

๐Ÿš€ Now you can use the key in your project's Actions as ${{ secrets.GCP_KEY }}. Read more about GitHub Secrets.

GitHub Visual Instructions

files: Understanding glob

The files input is the glob pattern of paths for the files that the Action should analyze. By default it is set to public/**/*.html, meaning that will check for all the files with .html extension in all the directories in the public directory.

Read more, and understand glob patterns and their limitations on @actions/glob.

๐Ÿ”ง Known issues and limitations

This an early release of the Action. The roadmap of known issues and features will be updated here.

  • Parse and merge more content tags: โš ๏ธ For now, this Action takes into account only <p> HTML tags. As more use cases will be tested, more tags will be included, along with the possibility of customization.
  • Custom score threshold: The overview table printed as a result of the Action highlights with color the very negative and very positive documents. At the moment, the threshold of the emotion score is predefined at ยฑ0.5. The next release will allow the user to define the threshold so they can get a custom color-coded table.
  • Split the base directory of the path: At this moment, the overview table prints only the name of the file, creating confusion between files with the same name in different directories. In the next release, the table will print the relative path of the file.

copy-sentiment-analysis's People

Contributors

bogdaaamn avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

likeitsme

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.