diproche / webinterface

1 stars 0 forks source link

Kweirauch/fix vocab bug #101

Closed Korosensei42 closed 5 years ago

Korosensei42 commented 5 years ago

This should fix #95.

Previous behaviour:

Inputs like Die Sonne., i.e. illegal words before interpunctuation did not create an issue.

Exprected behaviour:

Such inputs should create an Issue.

How I solved it: Before even searching for any illegal words I replace every interpunctuation with a whitespace. This is done by text = text.replace(/[.,\/#!$%\^&\*;:{}=\-_~()]/g, "");`, currently in line 24 in detectWrongSyntax.ts.

Additional stuff: Formulated some of the documentation differently, since it wasn't on point for me.

@TimothyGillespie I already played around with some inputs. Could you test some, too? Just in case I overlooked something. By the way: The regex above has the advantage, that now even expressions like $Sonne$ correctly throw issues now. This means, we are restricting propositional variables to only be allowed words, too. However, the indexing does not take in account interpunctuation. That is an issue that I should solve in another PR later, though.

Korosensei42 commented 5 years ago

@TimothyGillespie I adressed your feedback.

This doesn't seem to work quiet yet. Your console.log seems to find the right start positions, as far was I can tell, but it seems no issue will be created for them.

Could you tell me on which inputs it does not work as expected? I didn't stumble upon any additional problems.

TimothyGillespie commented 5 years ago

For any input it seems.

For example "Die Sonne." But also "Die Sonne" without punctuation.

My working browser is firefox on a windows machine. I will test again soon if I can reproduce it.

Korosensei42 commented 5 years ago

That is weird. For me Issues get created and displayed, even though I am on Firefox as well.

TimothyGillespie commented 5 years ago

This change fixes the issue for me.

When throwing an error a function won't give a return. This caused to give no Issue when back. So when no error list has been found in the diproche return it will now just pretend there is no error given by diproche and the function can return as usual.

I didn't get this issue beforehand either and I wonder why this hasn't been the same for you, but this should work for the both of us now.