models icon indicating copy to clipboard operation
models copied to clipboard

is possible to only show words with tags. #SyntaxNet#

Open ColinUNC opened this issue 10 years ago • 4 comments

syntaxnet

pass one sentence per line of text into the script at syntaxnet/demo.sh. The script will break the text into words, run the POS tagger, run the parser. The output will have a lot of information.

I tried to comment-out the following lines (and args) of the models/syntaxnet/syntaxnet/demo.sh.

| \ $PARSER_EVAL \ --input=stdin-conll \ --output=stdout-conll \ --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

but still returns a lot of information like this:

I syntaxnet/embedding_feature_extractor.cc:36] Embedding names: other;prefix2;prefix3;suffix2;suffix3;words I syntaxnet/embedding_feature_extractor.cc:37] Embedding dims: 8;16;16;16;16;64 I syntaxnet/term_frequency_map.cc:101] Loaded 64036 terms from syntaxnet/models/parsey_mcparseface/word-map. INFO:tensorflow:Processed 1 documents INFO:tensorflow:Total processed documents: 1 INFO:tensorflow:num correct tokens: 0 INFO:tensorflow:total tokens: 6 INFO:tensorflow:Seconds elapsed in evaluation: 0.13, eval metric: 0.00% INFO:tensorflow:Processed 1 documents

Is possible to ONLY show the words with part-of-speech tags ? for example: Did (VBD) you (PRP) see (VB) that (DT) man (NN)?

ColinUNC avatar May 25 '16 00:05 ColinUNC

If you remove the --alsologtostderr flag, you should eliminate most of the log messages generated. Then running just the first $PARSER_EVAL should generate the CONLL-formatted tagged data, which you could then pipe into your own formatting script. You could also add additional output formats to the C++ code. Unfortunately, we don't support any other formats out of the box.

djweiss avatar May 25 '16 13:05 djweiss

@djweiss

Thanks for your answer. I've removed a few flags and args, the current code like this.

`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=$INPUT_FORMAT
--output=stdout-conll
--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 `

I am not sure how to pipe into own formatting script. Can you give me a example of piping into own formatting script (or add additional output formats to python code)?

ColinUNC avatar May 25 '16 17:05 ColinUNC

Here was a tip on how to add output formats https://github.com/tensorflow/models/issues/111

giorgio79 avatar May 26 '16 18:05 giorgio79

Trigger last updated

trinity77 avatar Sep 10 '16 05:09 trinity77