如何只输出解析树

How to just output the parse tree

当运行 syntaxnet 有很多输出到控制台。我想知道如何才能获取依赖项数据。现在这是我的输出:

I syntaxnet/term_frequency_map.cc:101] Loaded 37 terms from work/models/label-map.
I syntaxnet/term_frequency_map.cc:101] Loaded 37 terms from work/models/label-map.
I syntaxnet/embedding_feature_extractor.cc:35] Features: stack(3).word stack(2).word stack(1).word stack.word input.word input(1).word input(2).word input(3).word;input.digit input.hyphen;stack.suffix(length=2) input.suffix(length=2) input(1).suffix(length=2);stack.prefix(length=2) input.prefix(length=2) input(1).prefix(length=2)
I syntaxnet/embedding_feature_extractor.cc:36] Embedding names: words;other;suffix;prefix
I syntaxnet/embedding_feature_extractor.cc:37] Embedding dims: 64;4;8;8
I syntaxnet/embedding_feature_extractor.cc:35] Features: input.word input(1).word input(2).word input(3).word stack.word stack(1).word stack(2).word stack(3).word stack.child(1).word stack.child(1).sibling(-1).word stack.child(-1).word stack.child(-1).sibling(1).word stack(1).child(1).word stack(1).child(1).sibling(-1).word stack(1).child(-1).word stack(1).child(-1).sibling(1).word stack.child(2).word stack.child(-2).word stack(1).child(2).word stack(1).child(-2).word;input.tag input(1).tag input(2).tag input(3).tag stack.tag stack(1).tag stack(2).tag stack(3).tag stack.child(1).tag stack.child(1).sibling(-1).tag stack.child(-1).tag stack.child(-1).sibling(1).tag stack(1).child(1).tag stack(1).child(1).sibling(-1).tag stack(1).child(-1).tag stack(1).child(-1).sibling(1).tag stack.child(2).tag stack.child(-2).tag stack(1).child(2).tag stack(1).child(-2).tag;stack.child(1).label stack.child(1).sibling(-1).label stack.child(-1).label stack.child(-1).sibling(1).label stack(1).child(1).label stack(1).child(1).sibling(-1).label stack(1).child(-1).label stack(1).child(-1).sibling(1).label stack.child(2).label stack.child(-2).label stack(1).child(2).label stack(1).child(-2).label
I syntaxnet/embedding_feature_extractor.cc:36] Embedding names: words;tags;labels
I syntaxnet/embedding_feature_extractor.cc:37] Embedding dims: 64;32;32
I syntaxnet/term_frequency_map.cc:101] Loaded 29448 terms from work/models/word-map.
I syntaxnet/term_frequency_map.cc:101] Loaded 29448 terms from work/models/word-map.
I syntaxnet/term_frequency_map.cc:101] Loaded 17 terms from work/models/tag-map.
I syntaxnet/term_frequency_map.cc:101] Loaded 17 terms from work/models/tag-map.
INFO:tensorflow:Building training network with parameters: feature_sizes: [20 20 12] domain_sizes: [29451    20    40]
INFO:tensorflow:Building training network with parameters: feature_sizes: [8 2 3 3] domain_sizes: [29451     5  3539  5064]
I syntaxnet/embedding_feature_extractor.cc:35] Features: stack(3).word stack(2).word stack(1).word stack.word input.word input(1).word input(2).word input(3).word;input.digit input.hyphen;stack.suffix(length=2) input.suffix(length=2) input(1).suffix(length=2);stack.prefix(length=2) input.prefix(length=2) input(1).prefix(length=2)
I syntaxnet/embedding_feature_extractor.cc:36] Embedding names: words;other;suffix;prefix
I syntaxnet/embedding_feature_extractor.cc:37] Embedding dims: 64;4;8;8
I syntaxnet/term_frequency_map.cc:101] Loaded 29448 terms from work/models/word-map.
I syntaxnet/term_frequency_map.cc:101] Loaded 17 terms from work/models/tag-map.
I syntaxnet/term_frequency_map.cc:101] Loaded 37 terms from work/models/label-map.
I syntaxnet/reader_ops.cc:141] Starting epoch 1
I syntaxnet/reader_ops.cc:141] Starting epoch 2
INFO:tensorflow:Processed 1 documents
INFO:tensorflow:Total processed documents: 1
INFO:tensorflow:num correct tokens: 0
INFO:tensorflow:total tokens: 5
INFO:tensorflow:Seconds elapsed in evaluation: 0.05, eval metric: 0.00%
I syntaxnet/term_frequency_map.cc:101] Loaded 37 terms from work/models/label-map.
I syntaxnet/embedding_feature_extractor.cc:35] Features: input.word input(1).word input(2).word input(3).word stack.word stack(1).word stack(2).word stack(3).word stack.child(1).word stack.child(1).sibling(-1).word stack.child(-1).word stack.child(-1).sibling(1).word stack(1).child(1).word stack(1).child(1).sibling(-1).word stack(1).child(-1).word stack(1).child(-1).sibling(1).word stack.child(2).word stack.child(-2).word stack(1).child(2).word stack(1).child(-2).word;input.tag input(1).tag input(2).tag input(3).tag stack.tag stack(1).tag stack(2).tag stack(3).tag stack.child(1).tag stack.child(1).sibling(-1).tag stack.child(-1).tag stack.child(-1).sibling(1).tag stack(1).child(1).tag stack(1).child(1).sibling(-1).tag stack(1).child(-1).tag stack(1).child(-1).sibling(1).tag stack.child(2).tag stack.child(-2).tag stack(1).child(2).tag stack(1).child(-2).tag;stack.child(1).label stack.child(1).sibling(-1).label stack.child(-1).label stack.child(-1).sibling(1).label stack(1).child(1).label stack(1).child(1).sibling(-1).label stack(1).child(-1).label stack(1).child(-1).sibling(1).label stack.child(2).label stack.child(-2).label stack(1).child(2).label stack(1).child(-2).label
I syntaxnet/embedding_feature_extractor.cc:36] Embedding names: words;tags;labels
I syntaxnet/embedding_feature_extractor.cc:37] Embedding dims: 64;32;32
I syntaxnet/term_frequency_map.cc:101] Loaded 29448 terms from work/models/word-map.
I syntaxnet/term_frequency_map.cc:101] Loaded 17 terms from work/models/tag-map.
INFO:tensorflow:Processed 1 documents
INFO:tensorflow:Total processed documents: 1
INFO:tensorflow:num correct tokens: 1
INFO:tensorflow:total tokens: 5
INFO:tensorflow:Seconds elapsed in evaluation: 0.05, eval metric: 20.00%
1       Jeg     _       PRON    PRON    _       3       nsubj   _       _
2       vil     _       AUX     AUX     _       3       aux     _       _
3       bestille        _       VERB    VERB    _       0       ROOT    _       _
4       en      _       DET     DET     _       5       det     _       _
5       flybillett      _       ADJ     ADJ     _       3       dobj    _       _

我想要做的是调用 python 脚本,而不将所有这些输出到控制台,而只是 CONLL 数据。

您可以简单地将标准错误重定向到 /dev/null:

root@67e2e1378a9b:~/models/syntaxnet# echo "I'm testing." | syntaxnet/demo.sh 2> /dev/null
Input: I 'm testing .
Parse:
testing VBG ROOT
 +-- I PRP nsubj
 +-- 'm VBP aux
 +-- . . punct