tercul-backend/linguistics/adapter_govader.go
Damir Mukimov 4957117cb6 Initial commit: Tercul Go project with comprehensive architecture
- Core Go application with GraphQL API using gqlgen
- Comprehensive data models for literary works, authors, translations
- Repository pattern with caching layer
- Authentication and authorization system
- Linguistics analysis capabilities with multiple adapters
- Vector search integration with Weaviate
- Docker containerization support
- Python data migration and analysis scripts
- Clean architecture with proper separation of concerns
- Production-ready configuration and middleware
- Proper .gitignore excluding vendor/, database files, and build artifacts
2025-08-13 07:42:32 +02:00

25 lines
723 B
Go

package linguistics
import (
"github.com/jonreiter/govader"
)
// GoVADERSentimentProvider implements SentimentProvider using VADER
type GoVADERSentimentProvider struct {
analyzer *govader.SentimentIntensityAnalyzer
}
// NewGoVADERSentimentProvider constructs a VADER-based sentiment provider
func NewGoVADERSentimentProvider() (*GoVADERSentimentProvider, error) {
analyzer := govader.NewSentimentIntensityAnalyzer()
return &GoVADERSentimentProvider{analyzer: analyzer}, nil
}
// Score returns the compound VADER polarity score in [-1, 1]
func (p *GoVADERSentimentProvider) Score(text string, _ string) (float64, error) {
scores := p.analyzer.PolarityScores(text)
return scores.Compound, nil
}