tercul-backend/linguistics/adapters.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

30 lines
724 B
Go

package linguistics
import (
"errors"
"strings"
)
// --- LanguageDetector Adapters ---
// NullLanguageDetector provides a no-op detector that always fails detection
type NullLanguageDetector struct{}
func (n NullLanguageDetector) DetectLanguage(text string) (string, bool) {
return "", false
}
// --- SentimentProvider Adapters ---
// RuleBasedSentimentProvider wraps the internal estimateSentimentOptimized as a provider
type RuleBasedSentimentProvider struct{}
func (r RuleBasedSentimentProvider) Score(text string, language string) (float64, error) {
if strings.TrimSpace(text) == "" {
return 0, errors.New("empty text")
}
return estimateSentimentOptimized(text, language), nil
}