/vader-go-intl

An extension for vader-go providing lexicons for other languages and a CLI command to generate your own lexicons using the Google Translate API

Primary LanguageGoMIT LicenseMIT

vader-go-intl

vader-go-intl is an extension to the VADER sentiment analysis in Go, offering utilities to compose multiple lexicons and to generate international lexicons using translations.

Features

  1. Compose Multiple Lexicons: Combine multiple lexicons for sentiment analysis into a single, unified lexicon.
  2. Vader Lexicon Internationalization: Generate lexicons for different languages using Google Translate.

Installation

Library

go get github.com/maaxleq/vader-go-intl

Command

go install github.com/maaxleq/vader-go-intl/cmd/vadergointl@latest

Usage

vadergointl Command

This command-line utility translates and generates Go code for VADER lexicons in multiple languages.

Command:

vadergointl -langs=fr,es,nl -reqs=10 -out=.

Options:

  • -langs: Comma-separated list of language codes to generate lexicons for (e.g., fr, es, nl, ...).
  • -reqs: Number of concurrent requests to run at once for translations. Default is 10.
  • -out: Path where the translated lexicons folder will be created. Default is the current directory.

compose Package

The compose package allows you to combine multiple lexicons for sentiment analysis.

Example:

import (
	"github.com/maaxleq/vader-go-intl/compose"
	"github.com/grassmudhorses/vader-go/lexicon"
)

// Create two custom lexicons
lexicon1 := ...
lexicon2 := ...

// Combine lexicons into a single lexicon
combined := compose.ComposeLexicons(lexicon1, lexicon2)

// Use the combined lexicon for sentiment analysis
sentiment := combined.Sentiment("your text here")

License

This project is licensed under the MIT license.