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
30 lines
724 B
Go
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
|
|
}
|
|
|
|
|