Differences in parsing between echo and directories of files
I am seeing differences in the parse tree between a sentence sent into syntaxnet/demo.sh using echo and when demo.sh is modified to read in files from a directory. When demo.sh is left with it's default values and I pass it the sentence 'Once again Mr. Costner has dragged out a movie for far longer than necessary.' at the command line using echo, here is the result:
Input: Once again Mr. Costner has dragged out a movie for far longer than necessary. And this is the sentence right after the first one .
--------command line parse--------------- Parse: dragged VBN ROOT +-- again RB advmod | +-- Once RB advmod +-- Costner NNP nsubj | +-- Mr. NNP nn +-- has VBZ aux +-- out RP prt +-- movie NN dobj | +-- a DT det +-- for IN prep | +-- longer RBR pcomp | +-- far RB advmod | +-- than IN prep | +-- necessary. $ pobj +-- And CC cc +-- sentence NN conj | +-- this DT nsubj | +-- is VBZ cop | +-- the DT det | +-- after IN prep | +-- right RB advmod | +-- one NN pobj | +-- the DT det | +-- first JJ amod +-- . . punct
But when I modify the demo.sh file as follows with test_data set as english-text, test_data_out set as conll-sentence, and test_data_parsed set as conll-sentence (full input text at the bottom of this issue) I get the following parse of the same sentence:
-----------modified demo.sh--------------- PARSER_EVAL=bazel-bin/syntaxnet/parser_eval MODEL_DIR=syntaxnet/models/parsey_mcparseface [[ "$1" == "--conll" ]] && INPUT_FORMAT=stdin-conll || INPUT_FORMAT=stdin
$PARSER_EVAL
--input=test_data
--output=test_data_out
--hidden_layer_sizes=64
--arg_prefix=brain_tagger
--graph_builder=structured
--task_context=$MODEL_DIR/context.pbtxt
--model_path=$MODEL_DIR/tagger-params
--slim_model
--batch_size=1024
--alsologtostderr
|
$PARSER_EVAL
--input=test_data_out
--output=test_data_parsed
--hidden_layer_sizes=512,512
--arg_prefix=brain_parser
--graph_builder=structured
--task_context=$MODEL_DIR/context.pbtxt
--model_path=$MODEL_DIR/parser-params
--slim_model
--batch_size=1024
--alsologtostderr
|
bazel-bin/syntaxnet/conll2tree
--task_context=$MODEL_DIR/context.pbtxt
--alsologtostderr
--------------output with modified demo.sh------------------- 1 Once_RB _ _ 0 ROOT _ _ 2 again_RB _ _ 1 dep _ _ 3 Mr.NNP _ _ 1 dep _ _ 4 Costner_NNP _ _ 1 dep _ _ 5 has_VBZ _ _ 1 dep _ _ 6 dragged_VBN _ _ 1 dep _ _ 7 out_RP _ _ 1 dep _ _ 8 a_DT _ _ 1 dep _ _ 9 movie_NN _ _ 1 dep _ _ 10 for_IN _ _ 1 dep _ _ 11 far_RB _ _ 1 dep _ _ 12 longer_RBR _ _ 1 dep _ _ 13 than_IN _ _ 1 dep _ _ 14 necessary_JJ _ _ 1 dep _ _ 15 . _ _ 1 dep _ _ 16 . _ _ 1 punct _ _
Every sentence in my output file makes the first word in the sentence the ROOT. Here are the inputs that I've added to context.pbtxt:
-------------inputs from context.pbtxt---------------- input { name: 'test_data' record_format: 'english-text' Part { file_pattern: 'TestData/0_2.txt' } } input { name: 'test_data_out' record_format: 'conll-sentence' Part { file_pattern: 'TestDataOut/test_data_out.txt' } } input { name: 'test_data_parsed' record_format: 'conll-sentence' Part { file_pattern: 'TestDataOut/test_data_parsed.txt' } }
@uscskelly, I can't find the comment where you mentioned me, so I'm responding to you here. My demo.sh and inputs in context.pbtxt are above. Once all of the above is in place, I simply run syntaxnet/demo.sh from models/syntaxnet at the command line. Issue #144
I figured this out. I don't know what I was doing wrong, but now I'm getting the right output and ROOT is in all the right places.