top | item 33822363

(no title)

bugfix-66 | 3 years ago

Look at Section 8 and Section 9 here:

http://tug.ctan.org/info/tex-nutshell/tex-nutshell.pdf

How is ChatGPT's answer wrong? The regex is matching square brackets instead of the correct OPTIONAL curly braces. Unseparated arguments aren't handled. The regex for the id is also wrong. The leading slash is correct, but other than that, the whole fucking thing is wrong!

And of course it can't handle macro calls within the macro arguments (nesting).

It's just an absolute clusterfuck, from top to bottom. The chatbot gave its user a useless piece of garbage, and Hacker News doesn't know enough to throw it away. Instead, we parade it around like some great success!

Fooled by a language model.

discuss

order

aussieshibe|3 years ago

Did you mean to reply to someone else perhaps?

The comment you replied to was a one line joke about being bad at regex. I didn't directly or implicitly make any claim about the quality of the output of the chatbot. It's unclear to me how my comment could be reasonably interpreted as "parading it around".

On a tangent:

> Fooled by a language model

I suspect a reasonable person would understand this to be insulting on some level, so I assume you must have seen some other meaning/value in including it such that the "insultingness" is outweighed by the point you're making. I'm not seeing that point though, could you clarify?

6yyyyyy|3 years ago

Based on this and the other post where it delivered lies about Typescript generics, ChatGPT will—with total confidence—tell you things that look correct but are horrendously wrong for anyone who understands the subject matter. Just like the "science news" section of any mainstream media.

puffoflogic|3 years ago

Thankfully all the other sections of mainstream media are much more accurate!

egberts1|3 years ago

Mainstream needs journalists that can code. headduck

rkagerer|3 years ago

As an aside, this is why I hate regex. The expressions are too convoluted for a human to readily parse and understand. Unless there's a good reason, I prefer to stick to imperative parsing code (and have developed personal tooling to help with that).

Part of elegant development is abstracting at the right places to make your code communicate what it's doing to the next person working on it (which could include future you).

kmoser|3 years ago

Too convoluted for a human to readily parse and understand? The same could be said for pretty much any code. As with anything else, the more practice you have reading and writing regexes, the easier they become.

If you ask me, the real boogeyman is lack of programmers' comments that explain what the regex is doing. In other words, the fault lies not with the tools, but PEBKAC.

jw1224|3 years ago

I can’t see any mention of square brackets in section 9 (macros). Also, my end goal was to specifically target the contents of the first parameter, which I know which will wrapped in curly braces.

Regardless, even if my prompt didn’t meet the LaTeX spec exactly, the regex I got back (after just 2 natural-language revisions) saved me a lot of time and hassle, and helped me get the job done in the way I needed it to.

There’s little point judging it to be a “total clusterfuck” without knowing what I’m even trying to achieve in the first place :)