Skip to content

cristal-orion/Semantico

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฅ Hot & Cold - Gioco Semantico ๐ŸงŠ

Un gioco stile Semantle dove devi indovinare la parola del giorno usando la similaritร  semantica.

๐Ÿ“ Struttura Progetto

Hotncold/
โ”œโ”€โ”€ backend/              # Server FastAPI
โ”‚   โ”œโ”€โ”€ main.py          # API endpoints
โ”‚   โ”œโ”€โ”€ requirements.txt # Dipendenze Python
โ”‚   โ””โ”€โ”€ README.md        # Documentazione backend
โ”‚
โ”œโ”€โ”€ flutter_app/         # App Flutter
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”œโ”€โ”€ main.dart
โ”‚   โ”‚   โ”œโ”€โ”€ models/      # Modelli dati
โ”‚   โ”‚   โ”œโ”€โ”€ providers/   # State management
โ”‚   โ”‚   โ”œโ”€โ”€ screens/     # Schermate UI
โ”‚   โ”‚   โ”œโ”€โ”€ services/    # API service
โ”‚   โ”‚   โ””โ”€โ”€ widgets/     # Componenti UI
โ”‚   โ””โ”€โ”€ pubspec.yaml
โ”‚
โ”œโ”€โ”€ fasttext_it.model    # Modello FastText (generato)
โ”œโ”€โ”€ cc.it.300.vec.gz     # Dati FastText originali
โ””โ”€โ”€ hot_and_cold_fasttext.py  # Versione terminale originale

๐Ÿš€ Quick Start

1. Setup Backend

# Vai nella cartella backend
cd backend

# Crea ambiente virtuale (opzionale ma consigliato)
python -m venv venv
.\venv\Scripts\Activate.ps1

# Installa dipendenze
pip install -r requirements.txt

# Avvia il server
python main.py

Il server sarร  disponibile su: http://localhost:8000

2. Setup Flutter App

# Vai nella cartella flutter_app
cd flutter_app

# Installa dipendenze
flutter pub get

# Avvia l'app (scegli device)
flutter run

๐Ÿ”ง Configurazione

Backend

Il backend cerca il modello FastText in ../fasttext_it.model.

Se non hai ancora il modello:

  1. Esegui lo script originale una volta: python hot_and_cold_fasttext.py
  2. Questo scaricherร  e processerร  il modello FastText

Flutter App

Modifica l'URL del backend in lib/services/api_service.dart:

// Per localhost (emulatore/desktop)
static const String baseUrl = 'http://localhost:8000';

// Per emulatore Android
static const String baseUrl = 'http://10.0.2.2:8000';

// Per device fisico (usa IP del tuo PC)
static const String baseUrl = 'http://192.168.1.XXX:8000';

๐ŸŽฎ Come Si Gioca

  1. Ogni giorno c'รจ una parola segreta diversa

  2. Provi a indovinarla inserendo parole italiane

  3. Per ogni tentativo ricevi:

    • Rank: posizione nella classifica di similaritร  (#1 = parola corretta)
    • Temperatura: ๐Ÿ”ฅ = caldissimo, ๐ŸงŠ = freddissimo
    • Similaritร : valore numerico 0-1
  4. Piรน il rank รจ basso, piรน sei vicino!

    • ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ = Top 10
    • ๐Ÿ”ฅ๐Ÿ”ฅ = Top 50
    • ๐Ÿ”ฅ = Top 100
    • ๐ŸŒก๏ธ = Top 500
    • โ„๏ธ = Top 1000
    • ๐ŸงŠ = Oltre 1000

๐Ÿ› ๏ธ API Endpoints

GET /stats

Statistiche del server

GET /daily-word-info

Info parola del giorno (senza rivelarla)

POST /guess

{
  "word": "casa",
  "date": "2025-11-17"
}

GET /hint/{date}

Ottieni suggerimenti (per debug)

GET /health

Health check

๐Ÿ“ฑ Testing

Test Backend

# Test manuale
curl http://localhost:8000/health

# Prova un tentativo
curl -X POST http://localhost:8000/guess `
  -H "Content-Type: application/json" `
  -d '{"word":"casa"}'

Test Flutter

# Test su Chrome
flutter run -d chrome

# Test su emulatore Android
flutter run -d emulator

# Test su Windows
flutter run -d windows

๐Ÿ› Troubleshooting

Il backend non si avvia

  • Verifica che il modello fasttext_it.model esista
  • Controlla che tutte le dipendenze siano installate
  • Controlla la porta 8000 non sia occupata

L'app non si connette al backend

  • Verifica che il backend sia avviato
  • Controlla l'URL in api_service.dart
  • Per device fisico, usa l'IP del PC nella stessa rete

Il modello รจ troppo grande

  • Il modello completo รจ ~1.2GB
  • รˆ ottimizzato a 200k parole per performance
  • Salva in cache binaria per caricamenti veloci

๐Ÿš€ Deploy Produzione

Backend

Usa Gunicorn per produzione:

pip install gunicorn
gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000

Oppure deploy su:

  • Heroku: con Procfile
  • DigitalOcean App Platform
  • AWS EC2
  • Google Cloud Run

Flutter App

Build per produzione:

# Android
flutter build apk --release

# iOS
flutter build ios --release

# Web
flutter build web --release

๐Ÿ“ Note

  • La parola giornaliera รจ deterministica basata sulla data
  • I tentativi sono salvati in locale (SharedPreferences)
  • Il ranking viene calcolato e cachato per performance
  • Il modello FastText usa word embeddings italiani reali

๐Ÿ”ฎ Prossimi Miglioramenti

  • Sistema di statistiche utente
  • Condivisione risultati (tipo Wordle)
  • Modalitร  allenamento con parole passate
  • Classifiche globali
  • Suggerimenti progressivi
  • Dark mode
  • Animazioni migliorate
  • PWA per web

๐Ÿ“„ Licenza

Progetto personale - Usa come preferisci!

๐Ÿ™ Credits

About

Like semantle but in italian ๐ŸคŒ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors