mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 00:31:35 +00:00
- 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
25 lines
723 B
Go
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
|
|
}
|
|
|
|
|