[developers] Structured output from ACE

Woodley Packard sweaglesw at sweaglesw.org
Thu Jun 23 22:32:23 CEST 2016


Hi Mike (and any other developers who are interested),

I’ve just checked into SVN a change allowing ACE to optionally write structured output to the console output stream.  The output is formatted as (a list of) s-expressions, and is identical to the data sent to [incr tsdb()] when driven by that tool.  I could imagine at some point having this configurable across s-expressions, xml, and json, but that would take a some additional work.  Can you take a look and see if this will allow you to do what you wanted to do?  You can get labeled trees and derivations at the same time.  Since there is more data being formatted, there is some overhead relative to the basic ACE output format, but it’s not all that much.  I can’t quite recall if you are set up to compile ACE from source; if you need a binary let me know.  Below are examples.

Regards,
--Woodley

$ ./ace -g erg-1214.dat --tsdb-stdout --report-labels
The dog slept under the couch.
(:ninputs . 7) (:p-input . "(1, 0, 1, <0:3>, 1, \"The\", 0, \"null\", \"DT\" 1.0) (2, 1, 2, <4:7>, 1, \"dog\", 0, \"null\", \"NN\" 1.0) (3, 2, 3, <8:13>, 1, \"slept\", 0, \"null\", \"VBD\" 1.0) (4, 3, 4, <14:19>, 1, \"under\", 0, \"null\", \"IN\" 1.0) (5, 4, 5, <20:23>, 1, \"the\", 0, \"null\", \"DT\" 1.0) (6, 5, 6, <24:29>, 1, \"couch\", 0, \"null\", \"NN\" 1.0) (7, 6, 7, <29:30>, 1, \".\", 0, \"null\", \".\" 1.0)") (:copies . 329) (:unifications . 31623) (:ntokens . 15) (:p-tokens . "(68, 1, 2, <4:7>, 1, \"dog\", 0, \"null\") (70, 2, 3, <8:13>, 1, \"slept\", 0, \"null\") (72, 3, 4, <14:19>, 1, \"under\", 0, \"null\") (74, 4, 5, <20:23>, 1, \"the\", 0, \"null\") (76, 5, 6, <24:30>, 1, \"couch.\", 0, \"null\") (77, 1, 2, <4:7>, 1, \"dog\", 0, \"null\") (78, 2, 3, <8:13>, 1, \"slept\", 0, \"null\") (79, 5, 6, <24:30>, 1, \"couch.\", 0, \"null\") (80, 0, 1, <0:3>, 1, \"the\", 0, \"null\") (81, 1, 2, <4:7>, 1, \"dog\", 0, \"null\") (82, 2, 3, <8:13>, 1, \"slept\", 0, \"null\") (83, 3, 4, <14:19>, 1, \"under\", 0, \"null\") (84, 4, 5, <20:23>, 1, \"the\", 0, \"null\") (85, 5, 6, <24:30>, 1, \"couch.\", 0, \"null\") (86, 0, 1, <0:3>, 1, \"the\", 0, \"null\")") (:results . (((:result-id . 0) (:derivation ." (1483 sb-hd_mc_c 4.982306 0 6 (1476 sp-hd_n_c 0.997967 0 2 (112 the_1 -0.486623 0 1 (\"the\" 80 \"token [ +FORM \\\"the\\\" +FROM \\\"0\\\" +TO \\\"3\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"DT\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL + +CASE capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"0\\\" ] ] +PRED predsort +CARG \\\"The\\\" +TICK bool ]\")) (1475 n_sg_ilr 1.169754 1 2 (87 dog_n1 0.031966 1 2 (\"dog\" 68 \"token [ +FORM \\\"dog\\\" +FROM \\\"4\\\" +TO \\\"7\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NN\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"4\\\" ] ] +PRED predsort +CARG \\\"dog\\\" +TICK bool ]\")))) (1482 hd-aj_int-unsl_c 2.816290 2 6 (1477 v_pst_olr 0.265498 2 3 (91 sleep_v1 0.000000 2 3 (\"slept\" 70 \"token [ +FORM \\\"slept\\\" +FROM \\\"8\\\" +TO \\\"13\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"VBD\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"8\\\" ] ] +PRED predsort +CARG \\\"slept\\\" +TICK bool ]\"))) (1481 hd-cmp_u_c 1.957996 3 6 (95 under 0.449725 3 4 (\"under\" 72 \"token [ +FORM \\\"under\\\" +FROM \\\"14\\\" +TO \\\"19\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"IN\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"14\\\" ] ] +PRED predsort +CARG \\\"under\\\" +TICK bool ]\")) (1480 sp-hd_n_c 1.129365 4 6 (96 the_1 -0.684339 4 5 (\"the\" 74 \"token [ +FORM \\\"the\\\" +FROM \\\"20\\\" +TO \\\"23\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"DT\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"20\\\" ] ] +PRED predsort +CARG \\\"the\\\" +TICK bool ]\")) (1479 w_period_plr 1.734601 5 6 (1478 n_sg_ilr 1.025308 5 6 (97 couch_n1 0.000000 5 6 (\"couch.\" 76 \"token [ +FORM \\\"couch.\\\" +FROM \\\"24\\\" +TO \\\"30\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NN\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"24\\\" ] ] +PRED predsort +CARG \\\"couch\\\" +TICK bool ]\"))))))))") (:mrs ."[ LTOP: h0 INDEX: e2 [ e SF: prop TENSE: past MOOD: indicative PROG: - PERF: - ] RELS: < [ _the_q<0:3> LBL: h4 ARG0: x3 [ x PERS: 3 NUM: sg IND: + ] RSTR: h5 BODY: h6 ]  [ _dog_n_1<4:7> LBL: h7 ARG0: x3 ]  [ _sleep_v_1<8:13> LBL: h1 ARG0: e2 ARG1: x3 ]  [ _under_p<14:19> LBL: h1 ARG0: e8 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: e2 ARG2: x9 [ x PERS: 3 NUM: sg IND: + ] ]  [ _the_q<20:23> LBL: h10 ARG0: x9 RSTR: h11 BODY: h12 ]  [ _couch_n_1<24:30> LBL: h13 ARG0: x9 ] > HCONS: < h0 qeq h1 h5 qeq h7 h11 qeq h13 > ]") (:tree ." (\"S\" (\"N\" (\"DET\" (\"the\")) (\"N\" (\"N\" (\"dog\")))) (\"VP\" (\"VP\" (\"V\" (\"slept\"))) (\"PP\" (\"P\" (\"under\")) (\"N\" (\"DET\" (\"the\")) (\"N\" (\"N\" (\"N\" (\"couch.\"))))))))") (:flags ((:ascore . 4.982306) (:probability . 1.000000)))))) (:readings . 1) (:pedges . 47) (:aedges . 70) 

The the the the the.
(:ninputs . 6) (:p-input . "(1, 0, 1, <0:3>, 1, \"The\", 0, \"null\", \"DT\" 1.0) (2, 1, 2, <4:7>, 1, \"the\", 0, \"null\", \"DT\" 1.0) (3, 2, 3, <8:11>, 1, \"the\", 0, \"null\", \"DT\" 1.0) (4, 3, 4, <12:15>, 1, \"the\", 0, \"null\", \"DT\" 1.0) (5, 4, 5, <16:19>, 1, \"the\", 0, \"null\", \"DT\" 1.0) (6, 5, 6, <19:20>, 1, \".\", 0, \"null\", \".\" 1.0)") (:copies . 486) (:unifications . 33407) (:ntokens . 10) (:p-tokens . "(59, 1, 2, <4:7>, 1, \"the\", 0, \"null\") (61, 2, 3, <8:11>, 1, \"the\", 0, \"null\") (63, 3, 4, <12:15>, 1, \"the\", 0, \"null\") (65, 4, 5, <16:20>, 1, \"the.\", 0, \"null\") (66, 0, 1, <0:3>, 1, \"the\", 0, \"null\") (67, 1, 2, <4:7>, 1, \"the\", 0, \"null\") (68, 2, 3, <8:11>, 1, \"the\", 0, \"null\") (69, 3, 4, <12:15>, 1, \"the\", 0, \"null\") (70, 4, 5, <16:20>, 1, \"the.\", 0, \"null\") (71, 0, 1, <0:3>, 1, \"the\", 0, \"null\")") (:results . ()) (:readings . 0) (:pedges . 9) (:aedges . 0) 

Cats sleep.
(:ninputs . 3) (:p-input . "(1, 0, 1, <0:4>, 1, \"Cats\", 0, \"null\", \"NNP\" 1.0) (2, 1, 2, <5:10>, 1, \"sleep\", 0, \"null\", \"NN\" 1.0) (3, 2, 3, <10:11>, 1, \".\", 0, \"null\", \".\" 1.0)") (:copies . 636) (:unifications . 34411) (:ntokens . 6) (:p-tokens . "(32, 1, 2, <5:11>, 1, \"sleep.\", 0, \"null\") (33, 0, 1, <0:4>, 1, \"Cats\", 0, \"null\") (34, 1, 2, <5:11>, 1, \"sleep.\", 0, \"null\") (35, 0, 1, <0:4>, 1, \"cats\", 0, \"null\") (36, 1, 2, <5:11>, 1, \"sleep.\", 0, \"null\") (37, 0, 1, <0:4>, 1, \"cats\", 0, \"null\")") (:results . (((:result-id . 0) (:derivation ." (503 sb-hd_mc_c -0.514102 0 2 (500 hdn_bnp_c 0.143203 0 1 (499 n_pl_olr 1.086701 0 1 (51 cat_n1 0.000000 0 1 (\"cats\" 35 \"token [ +FORM \\\"cats\\\" +FROM \\\"0\\\" +TO \\\"4\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NNP\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL + +CASE capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"0\\\" ] ] +PRED predsort +CARG \\\"Cats\\\" +TICK bool ]\")))) (502 w_period_plr -0.607411 1 2 (501 v_n3s-bse_ilr -0.509282 1 2 (40 sleep_v1 0.000000 1 2 (\"sleep.\" 32 \"token [ +FORM \\\"sleep.\\\" +FROM \\\"5\\\" +TO \\\"11\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NN\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"5\\\" ] ] +PRED predsort +CARG \\\"sleep\\\" +TICK bool ]\")))))") (:mrs ."[ LTOP: h0 INDEX: e2 [ e SF: prop TENSE: pres MOOD: indicative PROG: - PERF: - ] RELS: < [ udef_q<0:4> LBL: h4 ARG0: x3 [ x PERS: 3 NUM: pl IND: + ] RSTR: h5 BODY: h6 ]  [ _cat_n_1<0:4> LBL: h7 ARG0: x3 ]  [ _sleep_v_1<5:11> LBL: h1 ARG0: e2 ARG1: x3 ] > HCONS: < h0 qeq h1 h5 qeq h7 > ]") (:tree ." (\"S\" (\"NP\" (\"N\" (\"N\" (\"cats\")))) (\"VP\" (\"VP\" (\"V\" (\"sleep.\")))))") (:flags ((:ascore . -0.514102) (:probability . 0.634599))))((:result-id . 1) (:derivation ." (512 np_frg_c -1.454906 0 2 (511 hdn_bnp_c -2.203505 0 2 (510 np-hdn_cpd_c -1.143408 0 2 (507 hdn_bnp-pn_c -0.843588 0 1 (43 generic_proper_ne 0.000000 0 1 (\"Cats\" 33 \"token [ +FORM \\\"Cats\\\" +FROM \\\"0\\\" +TO \\\"4\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NNP\\\" +PRB \\\"1.0\\\" ] ] +CLASS proper_ne +TRAIT token_trait [ +UW + +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"0\\\" ] ] +PRED predsort +CARG \\\"Cats\\\" +TICK bool ]\"))) (509 w_period_plr 0.181744 1 2 (508 n_ms-cnt_ilr 0.339257 1 2 (38 sleep_n1 0.160746 1 2 (\"sleep.\" 32 \"token [ +FORM \\\"sleep.\\\" +FROM \\\"5\\\" +TO \\\"11\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NN\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"5\\\" ] ] +PRED predsort +CARG \\\"sleep\\\" +TICK bool ]\")))))))") (:mrs ."[ LTOP: h0 INDEX: e2 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] RELS: < [ unknown<0:11> LBL: h1 ARG0: e2 ARG: x4 [ x PERS: 3 NUM: sg ] ]  [ udef_q<0:11> LBL: h5 ARG0: x4 RSTR: h6 BODY: h7 ]  [ compound<0:11> LBL: h8 ARG0: e9 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: x4 ARG2: x10 [ x IND: + ] ]  [ proper_q<0:4> LBL: h11 ARG0: x10 RSTR: h12 BODY: h13 ]  [ named<0:4> LBL: h14 CARG: \"Cats\" ARG0: x10 ]  [ _sleep_n_1<5:11> LBL: h8 ARG0: x4 ] > HCONS: < h0 qeq h1 h6 qeq h8 h12 qeq h14 > ]") (:tree ." (\"XP\" (\"NP\" (\"N\" (\"NP\" (\"N\" (\"Cats\"))) (\"N\" (\"N\" (\"N\" (\"sleep.\")))))))") (:flags ((:ascore . -1.454906) (:probability . 0.247693))))((:result-id . 2) (:derivation ." (517 np_nb-frg_c -2.321758 0 2 (516 np-hdn_cpd_c -1.512554 0 2 (513 hdn_bnp-pn_c -1.463172 0 1 (43 generic_proper_ne 0.000000 0 1 (\"Cats\" 33 \"token [ +FORM \\\"Cats\\\" +FROM \\\"0\\\" +TO \\\"4\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NNP\\\" +PRB \\\"1.0\\\" ] ] +CLASS proper_ne +TRAIT token_trait [ +UW + +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"0\\\" ] ] +PRED predsort +CARG \\\"Cats\\\" +TICK bool ]\"))) (515 w_period_plr 0.294446 1 2 (514 n_ms-cnt_ilr 0.292274 1 2 (38 sleep_n1 0.160746 1 2 (\"sleep.\" 32 \"token [ +FORM \\\"sleep.\\\" +FROM \\\"5\\\" +TO \\\"11\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NN\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"5\\\" ] ] +PRED predsort +CARG \\\"sleep\\\" +TICK bool ]\"))))))") (:mrs ."[ LTOP: h0 INDEX: e2 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] RELS: < [ unknown<0:11> LBL: h1 ARG0: e2 ARG: x4 [ x PERS: 3 NUM: sg ] ]  [ udef_q<0:11> LBL: h5 ARG0: x4 RSTR: h6 BODY: h7 ]  [ compound<0:11> LBL: h8 ARG0: e9 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: x4 ARG2: x10 [ x IND: + ] ]  [ proper_q<0:4> LBL: h11 ARG0: x10 RSTR: h12 BODY: h13 ]  [ named<0:4> LBL: h14 CARG: \"Cats\" ARG0: x10 ]  [ _sleep_n_1<5:11> LBL: h8 ARG0: x4 ] > HCONS: < h0 qeq h1 h6 qeq h8 h12 qeq h14 > ]") (:tree ." (\"XP\" (\"N\" (\"NP\" (\"N\" (\"Cats\"))) (\"N\" (\"N\" (\"N\" (\"sleep.\"))))))") (:flags ((:ascore . -2.321758) (:probability . 0.104099))))((:result-id . 3) (:derivation ." (506 sb-hd_mc_c -4.356359 0 2 (505 hdn_bnp_c -3.699054 0 1 (504 n_pl_olr -2.755556 0 1 (44 generic_proper_ne 0.000000 0 1 (\"Cats\" 33 \"token [ +FORM \\\"Cats\\\" +FROM \\\"0\\\" +TO \\\"4\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NNP\\\" +PRB \\\"1.0\\\" ] ] +CLASS proper_ne +TRAIT token_trait [ +UW + +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"0\\\" ] ] +PRED predsort +CARG \\\"Cats\\\" +TICK bool ]\")))) (502 w_period_plr -0.607411 1 2 (501 v_n3s-bse_ilr -0.509282 1 2 (40 sleep_v1 0.000000 1 2 (\"sleep.\" 32 \"token [ +FORM \\\"sleep.\\\" +FROM \\\"5\\\" +TO \\\"11\\\" +ID *diff-list* [ LIST *list* LAST *list* ] +TNT null_tnt [ +TAGS *null* +PRBS *null* +MAIN tnt_main [ +TAG \\\"NN\\\" +PRB \\\"1.0\\\" ] ] +CLASS alphabetic [ +INITIAL - +CASE non_capitalized+lower ] +TRAIT token_trait [ +UW - +IT italics +LB bracket_null +RB bracket_null +HD token_head [ +LL ctype [ -CTYPE- string ] +TG string +TI \\\"5\\\" ] ] +PRED predsort +CARG \\\"sleep\\\" +TICK bool ]\")))))") (:mrs ."[ LTOP: h0 INDEX: e2 [ e SF: prop TENSE: pres MOOD: indicative PROG: - PERF: - ] RELS: < [ udef_q<0:4> LBL: h4 ARG0: x3 [ x PERS: 3 NUM: pl IND: + ] RSTR: h5 BODY: h6 ]  [ named<0:4> LBL: h7 CARG: \"Cats\" ARG0: x3 ]  [ _sleep_v_1<5:11> LBL: h1 ARG0: e2 ARG1: x3 ] > HCONS: < h0 qeq h1 h5 qeq h7 > ]") (:tree ." (\"S\" (\"NP\" (\"N\" (\"N\" (\"Cats\")))) (\"VP\" (\"VP\" (\"V\" (\"sleep.\")))))") (:flags ((:ascore . -4.356359) (:probability . 0.013609)))))) (:readings . 4) (:pedges . 31) (:aedges . 35)

NOTE: parsed 2 / 3 sentences, avg 1286k, time 0.05567s
$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.delph-in.net/archives/developers/attachments/20160623/4e905152/attachment-0001.html>


More information about the developers mailing list