Sto provando a inventare un parser per le partite di calcio. Uso il termine "linguaggio naturale" qui in modo molto approssimativo, quindi ti prego di avere pazienza con me poiché so poco o niente su questo campo.Analizzatore di lingua naturale per analizzare i dati play-by-play sportivi
Ecco alcuni esempi di ciò che sto lavorando con (Formato: TEMPO | GIÙ & DIST | OFF_TEAM | DESCRIZIONE):
04:39|4th and [email protected]|Dal|Mat McBriar punts for 32 yards to NYJ14. Jeremy Kerley - no return. FUMBLE, recovered by NYJ.|
04:31|1st and [email protected]|NYJ|Shonn Greene rush up the middle for 5 yards to the NYJ21. Tackled by Keith Brooking.|
03:53|2nd and [email protected]|NYJ|Mark Sanchez rush to the right for 3 yards to the NYJ24. Tackled by Anthony Spencer. FUMBLE, recovered by NYJ (Matthew Mulligan).|
03:20|1st and [email protected]|NYJ|Shonn Greene rush to the left for 4 yards to the NYJ37. Tackled by Jason Hatcher.|
02:43|2nd and [email protected]|NYJ|Mark Sanchez pass to the left to Shonn Greene for 7 yards to the NYJ44. Tackled by Mike Jenkins.|
02:02|1st and [email protected]|NYJ|Shonn Greene rush to the right for 1 yard to the NYJ45. Tackled by Anthony Spencer.|
01:23|2nd and [email protected]|NYJ|Mark Sanchez pass to the left to LaDainian Tomlinson for 5 yards to the 50. Tackled by Sean Lee.|
A partire da ora, ho scritto un parser muto che maniglie tutte le cose facili (playID, quarter, time, down & distance, team offensivo) insieme ad alcuni script che vanno e ottengono questi dati e lo sanificano nel formato visto sopra. Una singola riga viene trasformata in un oggetto "Play" da memorizzare in un database.
La parte difficile qui (almeno per me) è l'analisi della descrizione del gioco. Ecco alcune informazioni che vorrei estrarre da quella stringa:
stringa Esempio:
"Mark Sanchez pass to the left to Shonn Greene for 7 yards to the NYJ44. Tackled by Mike Jenkins."
Risultato:
turnover = False
interception = False
fumble = False
to_on_downs = False
passing = True
rushing = False
direction = 'left'
loss = False
penalty = False
scored = False
TD = False
PA = False
FG = False
TPC = False
SFTY = False
punt = False
kickoff = False
ret_yardage = 0
yardage_diff = 7
playmakers = ['Mark Sanchez', 'Shonn Greene', 'Mike Jenkins']
La logica che ho avuto per il mio parser iniziale andato qualcosa di simile :
# pass, rush or kick
# gain or loss of yards
# scoring play
# Who scored? off or def?
# TD, PA, FG, TPC, SFTY?
# first down gained
# punt?
# kick?
# return yards?
# penalty?
# def or off?
# turnover?
# INT, fumble, to on downs?
# off play makers
# def play makers
Le descrizioni possono ottenere abbastanza pelose (multiple armeggia & recuperi con sanzioni, ecc.) E mi chiedevo se potevo sfruttare alcuni moduli NLP là fuori. Probabilmente ho intenzione di passare qualche giorno su un computer statico muto/statico come un parser, ma se qualcuno ha suggerimenti su come affrontarlo usando le tecniche di PNL mi piacerebbe sentirli.
Dato l'argomento della domanda, trovo interessante il fatto che l'evidenziatore della sintassi di SO evidenzi tutti i nomi umani ... – Jon