Bug 125600 - Calc spellcheck does not recognize correct spelling of KWh
Summary: Calc spellcheck does not recognize correct spelling of KWh
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.2.3.2 release
Hardware: All Windows (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Spell-Checking
  Show dependency treegraph
 
Reported: 2019-05-31 01:03 UTC by Tracy
Modified: 2022-12-24 01:43 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tracy 2019-05-31 01:03:24 UTC
Description:
OS: Win 10 Home
OS Build: 17134.765
LibreOffice: Version: 6.2.3.2 (x64)
Build ID: aecc05fe267cc68dde00352a451aa867b3b546ac

I am producing an energy use calculator in LibreOffice Calc. The sheet makes frequent use of standard acronyms such as KWh (kilowatt-hour). Every time this acronym is used, Calc changes it to Kwh. (Both KWh and Kwh get a red underline indicating a misspelling.) I tried to manually fix this several times by entering the correct format directly in the input line. But Calc kept reverting. Until I inadvertently typed Ctrl+Z. When I noticed this, I hit Enter and the text stayed as I had typed it. However, KWh still had it's red line. I then ran spell check and found that while it is identifying KWh as a misspelled word, it also suggesting KWh as the correct spelling. I clicked Correct All and the same problem remained. I tried this three times without success. I then tried adding KWh to the dictionary. The first two times this did not work. On the third attempt it... sort of worked. KWh still has the red line indicating a misspelled word. However, running spell check no longer finds any problems. Next, I saved the sheet in ODF and reopened it. Now all the identified misspellings are gone.

Steps to Reproduce:
1. Type "KWh". Red line appears under "KWh"
2. Ran spell check. Acronym still identified as misspelling.
3. Clicked suggested correction "KWh".
4. Clicked "Correct All"
5. Closed Spell Check.
6. Reopened Spell Check and added KWh to the dictionary.
7. Saved document as a new doc and in the ODF fie format. (Original was based on .csv)
8. Reopened the new doc and the red lines were gone.
9. Reran spell check. No identified misspellings.

Actual Results:
Spell check could not identify correct spelling of KWh even though it was included in Spell Check's own suggestion box. Only saving the sheet as a new doc resolved the problem.

Expected Results:
Spell Check should correctly identify misspelling and auto correct only when there is a correct spelling entry in it's database. In addition, auto correct should not be persistent. When I tell Spell Check to undo it's correction, it should do as it's told.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.2.3.2 (x64)
Build ID: aecc05fe267cc68dde00352a451aa867b3b546ac
CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: CL

While filling out this bug report, I have opened and closed LibreOffice and the relevant docs several times. Now I can no longer reproduce the error.
I am not sure if it is worth submitting this report or not.
Comment 1 m_a_riosv 2019-05-31 08:35:40 UTC
I think the right it's kWh
(https://en.wikipedia.org/wiki/Kilowatt_hour)
Comment 2 Stéphane Guillou (stragu) 2019-05-31 14:02:45 UTC
In LibreOffice, there is by default an automatic correction of words starting with two capitals, because it is a common mistake.
If you want to deactivate that, you can untick Tools > AutoCorrect Options... > Options > Correct TWo INitial CApitals
However, it might be a better idea to keep it on and add "KWh" to the "Words With TWo INitial CApitals" list in the "Exceptions" tab.

As for the issues with spellcheck, I can confirm:

* "KWh" is suggested as correction for "KWh"
* Using "Correct" or "Correct all" with this suggestion does not remove the wiggly line: still detected as an error by spellcheck
* Adding the word to the dictionary does not remove the wiggly line, even though running the spellcheck does not detect them as misspelt words. However, turning "Automatic Spell Checking" off and back on in the Tools dropdown will remove the wiggly lines.

Marking as NEW for the three unexpected behaviours listed here.

Using:

Version: 6.2.4.2
Build ID: 1:6.2.4-0ubuntu0.18.04.1~lo1
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-AU (en_AU.UTF-8); UI-Language: en-GB
Calc: threaded
Comment 3 [REDACTED] 2020-10-07 21:12:53 UTC
The correct spelling according to the International System of Units(SI) is "kWh" - lowercase "k(ilo),h(our)" and uppercase "W(att)" 

References:
SI Brochure https://www.bipm.org/utils/common/pdf/si-brochure/SI-Brochure-9-EN.pdf 

Section 2.3.4 Derived units, page 137 ff., Table 4 ("W" for Watt)
Section 3 Decimal multiples and sub-multiples of SI units, page 143, Table 7 "SI prefixes ("k" for kilo=10^3)
Section 4, Non-SI units that are accepted for use with the SI, page 145, Table 8 "Non SI units accepted for use with the SI Units ("h" for hour).
Comment 4 QA Administrators 2022-10-08 03:49:27 UTC Comment hidden (obsolete)
Comment 5 Richard Urwin 2022-12-24 01:43:49 UTC
Tested on 7.3.7.2 (x64) Windows 10 build

The behaviour seems to have changed.

kWh is now an accepted word. There is no red underline and it is not reported in a manual spellcheck

However, MWh (megawatt hours) still triggers the two-capital auto-correct. Having disabled that, it is marked as an incorrect spelling with the recommended correction being MW h, with a space.

It is difficult to imagine how this could be fixed without implementing an entire units parser. MWh is an unusual unit, whereas kWh is very common since it is the unit used to charge consumers for electricity. It makes sense if kWh is in the dictionary but not MWh.

As a side issue, Calc accepts both Kph and Mph, which I would argue is incorrect; the units are kph and mph. An initial capital will result from auto-capitalization of the beginning of a sentence. This may introduce a typo into the document. Whether this is desired may depend on genre and context. A cell called "mph per second" should not be capitalized. Whereas if it is an English sentence outside strict science writing, such as "Mph is a unit of speed" then capitalization might look more natural.

In summary, it's a complex problem where a full solution would involve a lot of code and some user-visible options. This isn't the right place to discuss that. If the commonly used units are included, and this one is, then I would suggest that the bug is marked as fixed.