own-pt / delphin-rdf

RDF specifications for DELPH-IN semantic representations and a Pydelphin plugin for RDF generation.
MIT License
2 stars 3 forks source link

verbosity #17

Closed arademaker closed 3 years ago

arademaker commented 3 years ago
% delphin profile-to-mrs-rdf -v -p http://ibm.com/sick/a/ -o ~/hpsg/sick/sentences-a.ttl ~/hpsg/sick/sentences-ap

does not give me any output...

arademaker commented 3 years ago

I got some outputs after some time:

WARNING:delphin.cli.profile_to_mrs_rdf:Item 816 not well formed.

What is that? Can we be more informative? Does it mean the item 816 will be ignored? Does it mean the RDF will miss some part of it? What part of the code produces this error? The Pydelphin conversion from MRS to DMRS or our conversion from DMRS to RDF?

arademaker commented 3 years ago

I am trying the command above with the profiles in https://www.dropbox.com/s/pbs1qgb8ih2uywl/profiles.zip?dl=0.

arademaker commented 3 years ago

adding -vv more verbosity ...

% time delphin profile-to-rdf -vv -f ntriples --to dmrs -p http://ibm.com/sick/a/ -o sentences-a.nt sentences-ap
INFO:delphin.cli.profile_to_rdf:Getting parsers for representation: dmrs
INFO:delphin.cli.profile_to_rdf:Converting 9840 items from sentences-ap
WARNING:delphin.cli.profile_to_rdf:Item 814 not well formed
/Users/ar/venv/lib/python3.8/site-packages/delphin/dmrs/_operations.py:140: DMRSWarning: broken handle constraint: <HCons object (h16 qeq h24) at 4498079888>
  warnings.warn(
WARNING:delphin.cli.profile_to_rdf:Item 815 not well formed
/Users/ar/venv/lib/python3.8/site-packages/delphin/dmrs/_operations.py:140: DMRSWarning: broken handle constraint: <HCons object (h16 qeq h24) at 4498195056>
...
  warnings.warn(
WARNING:delphin.cli.profile_to_rdf:Item 6090 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 6091 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 6092 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 7271 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 7405 not well formed
/Users/ar/venv/lib/python3.8/site-packages/delphin/dmrs/_operations.py:140: DMRSWarning: broken handle constraint: <HCons object (h23 qeq h24) at 4878380144>

The open parenthesis warn( is not closed? Many XXXX not well formed messages are related to the same _operations.py:140: DMRWarning: broken handle constriant:...

It seems that something is not right about how the messages are being saved and reported.

arademaker commented 3 years ago

In a different profile, I got

% delphin profile-to-rdf -vv -f ntriples --to dmrs -p http://ibm.com/wn30/ -o sample-dmrs.nt sample/
INFO:delphin.cli.profile_to_rdf:Getting parsers for representation: dmrs
INFO:delphin.cli.profile_to_rdf:Converting 2000 items from sample/
WARNING:delphin.cli.profile_to_rdf:Item 46 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 97 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 98 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 135 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 139 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 278 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 365 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 458 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 514 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 547 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 557 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 563 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 564 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 573 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 663 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 752 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 773 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 795 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 819 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 825 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 849 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 979 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1013 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1018 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1019 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1051 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1169 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1201 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1230 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1254 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1263 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1292 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1391 not well formed
/Users/ar/venv/lib/python3.8/site-packages/delphin/dmrs/_operations.py:140: DMRSWarning: broken handle constraint: <HCons object (h32 qeq h38) at 4469721344>
  warnings.warn(
WARNING:delphin.cli.profile_to_rdf:Item 1419 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1430 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1465 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1496 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1540 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1555 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1577 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1604 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1610 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1725 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1787 not well formed
WARNING:delphin.cli.profile_to_rdf:Item 1793 not well formed
INFO:delphin.cli.profile_to_rdf:Serializing results to sample-dmrs.nt
INFO:delphin.cli.profile_to_rdf:DONE

Many well formed but only one expose the /Users/ar/venv/lib/python3.8/site-packages/delphin/dmrs/_operations.py...

yfaria commented 3 years ago

About the "not well formed" warning, we are using the notion that is in PyDelphin here. It doesn't stop the conversion to RDF most times; the problem is that the DMRS equivalent of a MRS doesn't exist when it doesn't satisfy the intrinsic value property, and this is probably the case. We could make the violation of this property explicit to end this confusion; it can be of inplausible scopes as well.

About the warn(, I don't know directly what is happening as it looks like a logger internal message, but I'll check.

yfaria commented 3 years ago

About the time of execution of the code, it's slow to start processing the items because it executes a tsql query in the profile to the MRSs, the ids and the texts. Thinking on the problem of #19, if we decide to represent the profile informations in the RDF, the query won't be necessary anymore and may speed up the process; if we don't we can still make it more efficient by "making the query ourselves" on the tsdb object.

arademaker commented 3 years ago

@yfaria did you see https://github.com/delph-in/pydelphin/issues/328?

arademaker commented 3 years ago

I don't think we need to pay too much attention to performance right now, but I was talking about verbosity. The problem is not the time it takes to generate the RDF, the problem is that the user does not have any output during some period of time. What we can do is add more messages to make clear the steps being execute. Loading the RDF, transforming the representations, serialization of the Graph, etc.

arademaker commented 3 years ago
% delphin profile-to-rdf -vv -f turtle --to dmrs -p http://ibm.com/sick/a/ -o sentences-a-dmrs.ttl sentences-ap
INFO:delphin.cli.profile_to_rdf:Getting parsers for representation: dmrs
INFO:delphin.cli.profile_to_rdf:Converting 9840 items from sentences-ap
(waiting)

For a -vv flag I would expect to see a progress bar or something showing me the step-by-step transformation for each sentence.

arademaker commented 3 years ago

Now -v gives nothing

% delphin profile-to-rdf -v -f turtle --to dmrs -p http://ibm.com/sick/b/ -o sample-b-dmrs.ttl sample-bp
yfaria commented 3 years ago

After #20, the -vv flag now is more clear. It informs the profile that is being loaded to conversion (the tsql query) and an indicator that each result is being converted. Now we have

% delphin profile-to-rdf -vv -f turtle --to dmrs -p http://ibm.com/sick/a/ -o sentences-a-dmrs.ttl ./sentences-ap
INFO:delphin.cli.profile_to_rdf:Getting parsers for representation: dmrs
INFO:delphin.cli.profile_to_rdf:Converting 41140 analysis of 9840 sentences from ./sentences-ap/
INFO:delphin.cli.profile_to_rdf:Loading the profile
INFO:delphin.cli.profile_to_rdf:Converting the result 0 of sentence 1
INFO:delphin.cli.profile_to_rdf:Converting the result 1 of sentence 1
INFO:delphin.cli.profile_to_rdf:Converting the result 2 of sentence 1
INFO:delphin.cli.profile_to_rdf:Converting the result 3 of sentence 1
INFO:delphin.cli.profile_to_rdf:Converting the result 4 of sentence 1
INFO:delphin.cli.profile_to_rdf:Converting the result 0 of sentence 2
INFO:delphin.cli.profile_to_rdf:Converting the result 1 of sentence 2
INFO:delphin.cli.profile_to_rdf:Converting the result 2 of sentence 2
INFO:delphin.cli.profile_to_rdf:Converting the result 3 of sentence 2
INFO:delphin.cli.profile_to_rdf:Converting the result 4 of sentence 2
INFO:delphin.cli.profile_to_rdf:Converting the result 0 of sentence 3
INFO:delphin.cli.profile_to_rdf:Converting the result 1 of sentence 3
...
arademaker commented 3 years ago

Yes, this is better, but we still need more control over the verbosity levels. For -v we can avoid the print for each result but keep the information about the loading and serialization.

arademaker commented 3 years ago

I executed:

% delphin profile-to-rdf -v -f turtle --to dmrs -p http://ibm.com/sick/a/ -o sample-a-dmrs.ttl sample-ap
WARNING:delphin.cli.profile_to_rdf:Converting 475 analysis of 100 sentences from sample-ap
WARNING:delphin.cli.profile_to_rdf:Loading the profile
WARNING:delphin.cli.profile_to_rdf:Converting the profile
WARNING:delphin.cli.profile_to_rdf:Serializing results to sample-a-dmrs.ttl
WARNING:delphin.cli.profile_to_rdf:DONE

But all messages above should be INFO, not WARNING, right?

yfaria commented 3 years ago

It was with warning because of the default nature of the logger, which only outputs messages with logging levels greater or equal to 30, which is the warning level. The default levels are displayed here. Considering that this information is less important than a warning, in #26 a new level called SURFINFO was created with level between the level of INFO and INFO; the logger was to output until this level with -v. Running the code here, I have

$ delphin profile-to-rdf -v --to mrs -o testing-verbosity.ttl -f ttl ../erg/trunk/tsdb/gold/mrs
SURFINFO:delphin.cli.profile_to_rdf:Getting parsers for representation: mrs
SURFINFO:delphin.cli.profile_to_rdf:No conversion necessary
SURFINFO:delphin.cli.profile_to_rdf:Converting 107 analysis of 107 sentences from ../erg/trunk/tsdb/gold/mrs
SURFINFO:delphin.cli.profile_to_rdf:Loading the profile
SURFINFO:delphin.cli.profile_to_rdf:Converting the profile
WARNING:delphin.cli.profile_to_rdf:Result 0 of sentence 951 is not well formed
SURFINFO:delphin.cli.profile_to_rdf:Serializing results to testing-verbosity.ttl
SURFINFO:delphin.cli.profile_to_rdf:DONE
arademaker commented 3 years ago

I will take that as closed for now, ok?

arademaker commented 3 years ago

Need to document decisions.