私はサッカーの試合のためのパーサーを考え出しています。ここでは「自然言語」という言葉を非常にゆるやかに使用していますので、私はこの分野についてほとんど何も知らないので、私に同行してください。ここでsports-play-by-playデータを解析するためのNatural言語パーサー
私は で働いているもののいくつかの例である(フォーマット:TIME | DOWN & DISTは| OFF_TEAM | DESCRIPTION):今のよう
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.|
、私はそのハンドルダムパーサを書きましたすべての簡単なもの(playID、四半期、時間、ダウン&距離、攻撃チーム)とこのデータを取得し、上記のフォーマットにそれをsanitizesいくつかのスクリプトと一緒に。 1つの行が "再生"オブジェクトに変換されてデータベースに格納されます。
ここでのタフな部分(少なくとも私にとって)は、プレイの説明を解析しています。ここで私は、その文字列から抽出したいと思いますいくつかの情報は次のとおりです。
例文字列:
"Mark Sanchez pass to the left to Shonn Greene for 7 yards to the NYJ44. Tackled by Mike Jenkins."
結果:私は私の最初のパーサーのために持っていたロジックはこのような何かを行ってきました
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']
:
# 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
説明はかなり毛むくじゃらされています(複数fumbles &のペナルティによる復旧など)、いくつかのNLPモジュールを利用できるかどうか疑問に思っていました。おそらく、パーサーのようなダム/スタティック・ステート・マシンで数日間過ごすつもりですが、NLP技術を使用してアプローチする方法についての提案があれば、それらについて聞きたいと思います。
SO文法のハイライターがすべての人間の名前を強調しているのは興味深いことです。 – Jon