Annotating a Corpus (Syntaxnet)

六眼飞鱼酱① 提交于 2019-11-30 21:04:41
Harsh Patni

Add these declaration lines to "context.pbtxt" at the end of the file. Here "inp" and "out" are the text files present in the root directory of syntexnet.

   input {
   name: 'inp_file'
   record_format: 'english-text'
     Part {
     file_pattern: 'inp'
     }
   }
   input {
   name: 'out_file'
   record_format: 'english-text'
     Part {
     file_pattern: 'out'
     }
   }

Add sentences to the "inp" file for which you want tagging to be done and specify them in shell the next time you run syntaxnet using --input and --output tags.

Just to help you a bit more I am pasting an example shell command.

bazel-bin/syntaxnet/parser_eval \
--input inp_file \
--output stdout-conll \
--model syntaxnet/models/parsey_mcparseface/tagger-params \
--task_context syntaxnet/models/parsey_mcparseface/context.pbtxt \
--hidden_layer_sizes 64 \
--arg_prefix brain_tagger \
--graph_builder structured \
--slim_model \
--batch_size 1024 | bazel-bin/syntaxnet/parser_eval \
--input stdout-conll  \
--output out_file \
--hidden_layer_sizes 512,512 \
--arg_prefix brain_parser \
--graph_builder structured \
--task_context syntaxnet/models/parsey_mcparseface/context.pbtxt \
--model_path syntaxnet/models/parsey_mcparseface/parser-params \
--slim_model --batch_size 1024

In the above script the output(POS tagging) of the first shell command is used as an input for the second shell command, where the two shell commands are seperated by "|"

just a quick help if you want to save the output of demo in a .txt file:

try echo "open file X with application Y" | ./demo.sh > output.txt it gives you sentence tree to the current directory.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!