coli-saar / alto

Alto, the Algebraic Language Toolkit
Other
16 stars 2 forks source link

NullPointerException Graph grammar Can't evaluate #75

Closed vsotofrances closed 3 years ago

vsotofrances commented 3 years ago

When showing the language, the annexed grammar cannot display the evaluated graph . Alto says it cannot evaluate the term, although the term is correct and the string and the derivation as well. (it seems so)

What am I doing wrong or missing?

Thanks in advance Victor p.s. I am trying to parse a conduit made up of single pipes. Like a chain.

vic.irtg.txt

vsotofrances commented 3 years ago

Additionally the pasers seems to parse the sentence: first_pipe pipe pipe pipe final_pipe

but is not able to parse: (h_1 / PIPE :ARG0 (h_2 / PIPE :ARG0 (h_3 / PIPE :ARG0 (h_4/ END_PIPE))))

alexanderkoller commented 3 years ago

Hi,

thank you for reaching out!

I tried parsing your sentence. The sentence itself gives me a chart with an empty language given your grammar (i.e. there is no start symbol in the RTG shown in the window with title "Parse chart ..."). But I do get a non-empty language if I change the sentence to first_pipe Pipe Pipe pipe_final, using the words on the string interpretation of your grammar.

For this sentence, I can confirm that the term on the graph interpretation evaluates to null. It already happens at the leaves of the term: (u<root> / PIPE :ARG0 w<port>) evaluates to null. You can tell if you mouse over the node in the term; the tooltip will show you the value of the tree below that node.

The s-graph looks fine to me, I don't see at first glance what the problem would be. @jgroschwitz @namednil Can you spot a problem?

vsotofrances commented 3 years ago

Thanks a lot for your quick response. (I enclose the same file but with low case letter to avoid the Pipe or pipe)

My goal is not NLP (natural language) but to parse hypergraphs representing engineering systems (and this can get really complex). Having a parser with a grammar for such systems would be very useful ( just focus on the important part). I am engineer not computer scientist so sorry if I miss something.

So let's start by simple systems...imagine I want to parse a tree-shaped duct-network made up of pipes, elbows, T-joints, the grilles and possibly a fan. I started by trying to compose connected pipes. Therefore my origin is going to be a graph not an alphanumeric string. After some reading (Jonas Groschwitz thesis and papers, etc..) I have started to play with Alto.

I expected that my grammar would parse something like: (h_1 / PIPE :ARG0 (h_2 / PIPE :ARG0 (h_3 / PIPE :ARG0 (h_4/ END_PIPE)))) But it seems, it does not work. Parsing the graph (above) shows no language.

Parsing the string: first_pipe pipe pipe pipe final_pipe seems to work but no graph evaluation and when I move the mouse over the any term in the tree appears java.lang.NullPointerException.

...and yes....at the leaves (u / PIPE :ARG0 w) evaluates to null ( that is why I think gives the NullPointerException).

Captura de pantalla 2021-06-28 195414

vic.irtg.txt

vsotofrances commented 3 years ago

OK I have found the problem. It was my fault. I have to write "(u / PIPE :ARG0 (w))" instead of "(u / PIPE :ARG0 w)" It is a subtlety but very important conceptually.

As a surplus, I enclose another grammar which accomplishes something similiar but in a different way (simpler)

Sorry for the inconvenience and thanks a lot.

vic-node.irtg.txt Victor p.d. I take this opportunity to congratulate you for Alto. I thinkit is very interesting.

vic-correct.irtg.txt

alexanderkoller commented 3 years ago

Hi,

ah, good catch!

Thank you for the kind words, and let us know if we can be of further help.

Best, Alexander.