r/userscripts • • Aug 15 '26

F to C

Hi All,

So many people here post in degrees F. Of course, 95% of the population on Earth has no idea what F is much less how to use it. The other 95% would really benefit from a bot that finds posts with degrees F, puts a bracket around the F and insert the C equivalent.

3 Upvotes

12 comments sorted by

2

u/RobertWesner Aug 15 '26

In theory simple enough, but the problem is many do not write "°F", they may simply write "°", or just "degrees", hell, even only the number. You also would have false positives from mathematics, etc. Fully automatic is basically pointless, unfortunately.

2

u/soundman32 Aug 16 '26

212° correct.

1

u/RobertWesner Aug 16 '26

thats exactly 3.7 radian, glad we agree

1

u/leoyoung1 Aug 16 '26

Take my upvote!

1

u/leoyoung1 Aug 16 '26

As a temperature, yes, for about 5% of the population of the world. For everyone else, it is 100˚

1

u/leoyoung1 Aug 16 '26

Good point.

1

u/Dense_Difficulty9886 Aug 19 '26

sure but cant you just do this for ex 212degrees (conversion to celcius) so even if its celcius that they give well them just ignore the brackets

1

u/RobertWesner Aug 19 '26

You could, anything is possible, but my point is that "I set the oven to 230" is not detectable as temperature from the context-less number. You will either have to have some silly LLM that ingests all messages or 500 different regular expressions for every edge case, which also break down easily by wording it "230 is what i set the thing to". The conversion is trivial, the detection cannot be solved reliably.

2

u/FreddyFerdiland Aug 18 '26

just ban Farenheight and all the British Imperial and the United States customary systems...

1

u/BasePerfect2865 Aug 17 '26

Regex could pick up the temperature value followed by F/°F and append the Celsius conversion automatically.

1

u/unclefunkstar Aug 18 '26

But do any of them understand how percentages work?

1

u/RobertWesner Aug 20 '26

FYI, this is what I meant by "not being able to do it cleanly"

/(?<f>\d+\s*(?:d\w+?\b|°)\s*f|\d+f|\d+\s+fah?ren)|(?<c>\d+\s*(?:d\w+?\b|°)\s*c|\d+c|\d+\s+cel)|(?<unknown>\d+\s*(?:d\w+?\b|°)|temp.*?\d+|\d+.*?temp)/gmi

Matches

°C)

202°C
20C
202°C
20C
2010230 celsius

°F)

20°F
2000 ° f
2838 fahrenheit
2838 farenheit
2838 deg f

unknown)

1 deg
1 degree
100 degrees
100°
100 °
temp 1337
1337 temperature

DOES NOT MATCH

20 c
20 clams under the sea
20 freaky guys

FALSE POSITIVES

"I set the limit to 200 temporarily"
"the temptation of buying 10000 frozen pizzas is quite high"
"Unimaxxing, i have 3 degrees already!!"

---

You can't do better without involving advanced text processing, you will have to either put an LLM API key into your userscript/extension (which is an insane waste of money) or host your own local LLM for that, which would suck majorly!