models icon indicating copy to clipboard operation
models copied to clipboard

syntaxnet output

Open prakhar21 opened this issue 10 years ago • 11 comments

I am trying to output the parsed result into file with 'english-text' format by making changes in context.pbtxt and demo.sh. Below are the input and output strings where input is taken from one.txt and stored in two.txt

Input: why wasnt this activated 2 weeks ago Output: why_WRB_1 wasnt_VB this_DT_5 activated_VBN_5 2_CD_5 weeks_NNS_6 ago_RB_1

What does _1/_5/_6... signify ?

prakhar21 avatar Jun 23 '16 06:06 prakhar21

try using conll-sentence output, it's a little more informative and easier to parse.

That produces the following table:

1   why _   ADV WRB _   2   advmod  _   _
2   wasnt   _   VERB    VB  _   0   ROOT    _   _
3   this    _   DET DT  _   6   det _   _
4   activated   _   VERB    VBN _   6   amod    _   _
5   2   _   NUM CD  _   6   num _   _
6   weeks   _   NOUN    NNS _   7   npadvmod    _   _
7   ago _   ADV RB  _   2   advmod  _   _

The 6th column describes the parent of each word - so "wasnt" is the head, "why" and "ago" are its dependents, "weeks" is "ago"'s dependent, and the rest are weeks' dependents. O

IN the format above, the number corresponds to the parent of each word in zero-based indexing - except the head "wasnt" which has no parent.

vijayyak avatar Jun 23 '16 14:06 vijayyak

By the way @prakhar21, how did you get that output format? That's exactly what I'm looking for, but I don't know which value I should pass to --output in order to get it.

rafaveguim avatar Jun 24 '16 01:06 rafaveguim

@rafaveguim Just modified context.pbxt and demo.sh.

demo.sh INPUT_FORMAT=USERS-INPUT --output=USERS-OUTPUT {parser-output}

context.pbtxt input { name: 'USERS-INPUT' record_format: 'english-text' Part { file_pattern: 'text.txt' } } input { name: 'USERS-OUTPUT' record_format: 'english-text' Part { file_pattern: 'PARSED-TAGGED.txt' } }

prakhar21 avatar Jun 24 '16 04:06 prakhar21

@prakhar21 Hi, I want to know a way in which I can pass a whole text file as input and get the text file as output from syantexnet. I did the modifications suggested by you in the context.pbtxt file and demo.sh

the path : tensorflow/models/syntaxnet/syntaxnet/ demo.sh

`PARSER_EVAL=bazel-bin/syntaxnet/parser_eval
MODEL_DIR=syntaxnet/models/parsey_mcparseface
[[ "$1" == "--conll" ]] && INPUT_FORMAT=USERS-INPUT || INPUT_FORMAT=stdin
`

and context.pbtxt I have added what you suggested at the end, keeping the rest of the contents of this file the same.

`input {
  name: 'USERS-INPUT'
  record_format: 'english-text'
  Part {
     file_pattern: 'text.txt'
  }
}
input {
   name: 'USERS-OUTPUT'
   record_format: 'english-text'
   Part {
     file_pattern: 'PARSED-TAGGED.txt'
   }
 }`

By doing this I am not able to parse the input. Please check the attached screenshot.

syntaxnet_error

suraj-vantigodi avatar Jul 20 '16 10:07 suraj-vantigodi

Try using the full path.

Regards.

MinionAttack avatar Jul 20 '16 10:07 MinionAttack

@vijayyak Could you please let me know how to interpret the entire output that you have previously commented. What do each of the columns mean?

ManojB18 avatar Nov 10 '16 07:11 ManojB18

@ManojB18 Ok so let's say we're storing an example dependency parse tree as:

1   why _   ADV WRB _   2   advmod  _   _
2   wasnt   _   VERB    VB  _   0   ROOT    _   _
3   this    _   DET DT  _   6   det _   _
4   activated   _   VERB    VBN _   6   amod    _   _
5   2   _   NUM CD  _   6   num _   _
6   weeks   _   NOUN    NNS _   7   npadvmod    _   _
7   ago _   ADV RB  _   2   advmod  _   _

The first column indexes the word in the sentence (1 through length of sentence). pretty straightforward The second column is the actual word The 3rd, 6th, 9th, and 10th columns here are empty, so in theory they could hold additional information about the word The 4th column describes the part of speech of the word, and the 5th column uses the Penn Treebank tag abbreviation for this part of speech tag (e.g. WRB is short for Wh-adverb) The 7th column is the index of the parent node in the dependency tree, with an index of 0 meaning that word is the head word of the sentence. So "ago" is a dependent of "wasnt", because its parent index is 2. The 8th column is a phrasal syntactic category, which describes the role of the word at a higher level.

vijayyak avatar Nov 10 '16 18:11 vijayyak

@vijayyak I would like to know what information is stored in 3,6,9,10 columns so that i could make use of it if present.

ManojB18 avatar Nov 14 '16 16:11 ManojB18

@ManojB18 See http://ilk.uvt.nl/conll/#dataformat for details. This file format is known as (10-column) CONLL format.

vijayyak avatar Nov 14 '16 17:11 vijayyak

@vijayyak Thanks!!!

ManojB18 avatar Nov 14 '16 17:11 ManojB18

Hey guys! I'm a little lost. I found the documentation about the format and everything, but I cannot get PMP to output the LEMMAs or XPOSTAGs. I see you have the same outputs, as me. Is it even possible to get PMP to output columns 3,6,9,10?

BTW here is an up-to-date link to the official CONLL data format http://universaldependencies.org/format.html

rickrag avatar Sep 28 '17 18:09 rickrag