cwcomment: Comment extractor¶
cwcomment extracts comments from play-by-play event files.
It has no DiamondWare equivalent. The tool can be used alongside
cwevent to retain information which appears
in com records rather than in play records.
cwcomment outputs up to 10 fields. All fields are included
by default; the fields generated can be selected with the -f
command-line option. The other common command-line options are
described in the command-line options table.
Field number |
Description |
Header |
|---|---|---|
0 |
Game ID |
|
1 |
Event number |
|
2 |
Comment text |
|
3 |
ID of person ejected |
|
4 |
Role of person ejected |
|
5 |
ID of ejecting umpire |
|
6 |
Reason for ejection |
|
7 |
Inning of umpire change |
|
8 |
Position assumed by umpire |
|
9 |
ID of umpire assuming position |
|
Association with events¶
Comments which occur before the first play of a game have an
EVENT_ID of 0. Other comments are associated with the play which
precedes them and normally have the same EVENT_ID as that play in
cwevent output. A comment attached to an NP (no play)
record receives the number of the most recent event, because the
NP record does not itself increment the event number.
Grouping of comments¶
A consecutive series of ordinary comments attached at the same point
in the game is combined into one output record. Their text is joined
with spaces in COMMENT_TX.
Ejection and umpire-change comments are each emitted as separate records. They are not combined with adjacent comments. This preserves a one-to-one relationship between each structured comment and its parsed fields.
Structured comments¶
Retrosheet represents ejections and umpire changes using specially
formatted comment text. cwcomment recognizes these records
when COMMENT_TX begins with the corresponding prefix.
An ejection comment has the form:
ej,person_id,person_role,umpire_id,reason
Its components are reported in EJECT_PERSON_ID,
EJECT_PERSON_ROLE_CD, EJECT_UMPIRE_ID, and
EJECT_REASON_TX.
An umpire-change comment has the form:
umpchange,inning,position,person_id
Its components are reported in UMPCHANGE_INN_CT,
UMPCHANGE_POS_CD, and UMPCHANGE_PERSON_ID.
The structured fields which do not apply to a comment are blank.
COMMENT_TX retains the complete comment text, including the
structured prefix and comma-separated components.
