Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capitalization and hyphen: Anomaly with "Title case" and "Sentence case" #9112

Closed
2 tasks done
mlep opened this issue Sep 1, 2022 · 10 comments · Fixed by #9142
Closed
2 tasks done

Capitalization and hyphen: Anomaly with "Title case" and "Sentence case" #9112

mlep opened this issue Sep 1, 2022 · 10 comments · Fixed by #9142
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty.

Comments

@mlep
Copy link
Contributor

mlep commented Sep 1, 2022

JabRef version

Latest development branch build (please note build date below)

Operating system

GNU / Linux

Details on version and operating system

JabRef 5.8--2022-08-31--88d9d83 Linux 5.10.0-17-amd64 amd64 Java 18.0.2.1 JavaFX 18.0.2+2

Checked with the latest development build

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

Capitalization of words associated with a hyphen do not work well.

Anomaly with "Sentence case":

  1. In the entry editor, enter the title wetting-and-drying cycle and others effects
  2. With a right click, select Change case -> Sentence case
    --> The title becomes Wetting-And-Drying cycle and others effects while it should be Wetting-and-drying cycle and others effects

Anomaly with "Title case":

  1. In the entry editor, enter the title wetting-and-drying cycle and others effects
  2. With a right click, select Change case -> Title case
    --> The title becomes Wetting-And-Drying Cycle and Others Effects while it should be Wetting-and-Drying Cycle and Others Effects

Appendix

...

Log File
Paste an excerpt of your log file here
@Siedlerchr
Copy link
Member

So follow up from #9102
and #9068

We need to distinguish between sentence case and title case?

@mlep
Copy link
Contributor Author

mlep commented Sep 1, 2022

  • For "Sentence case", only the first letter of the whole string should be capitalized (expect for parts enclosed in {} which should not be altered)
  • For "Title case", words like "and" ("for", "of", etc.) should not be capitalized even if they come after an hyphen

@mlep
Copy link
Contributor Author

mlep commented Sep 1, 2022

@MorettiGS: in case you want to improve capitalization

@Siedlerchr Siedlerchr added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Sep 2, 2022
@sreenath-tm
Copy link
Contributor

I'm interested in contributing to this issue, so before I start working it, would you mind sparing your time explaining what the fix will be like and pointing me to some resources to get started.

@mlep
Copy link
Contributor Author

mlep commented Sep 5, 2022

Hello @sreenath-tm. Thank you for your interest into JabRef. You should look first at https://github.com/JabRef/jabref/blob/main/docs/contributing.md
Can you reproduce the issue?

@sreenath-tm
Copy link
Contributor

sreenath-tm commented Sep 5, 2022

Hi I have validated the same for both the Title case and Sentence Case for the given input and the respective outputs for both of them are added below
Title case : "Wetting-and-drying Cycle and Others Effects"
Sentence Case : Wetting-and-drying cycle and others effects

As per this result only the Title case needs a tweaking to capitalise the "Drying" part and no changes need to be done to the Sentence casing which is working as expected. Do you agree ?

To add on to that this is not only for the Title but for all the text fields present which has the above mentioned "Change Case" field.

@mlep
Copy link
Contributor Author

mlep commented Sep 5, 2022

Which version of JabRef have you been using for test?
With the current development version (https://builds.jabref.org/main/), I still get "Wetting-And-Drying cycle and others effects" after applying "Sentence case". This could be a side-effect of #9102

I have not checked for the other types of field. But I guess the routines are applied in the same way to all fields. So, it would make sense the result does not depend on field type.

@sreenath-tm
Copy link
Contributor

sreenath-tm commented Sep 5, 2022

Sorry I was trying with the 5.7 version.
Validated the issue with the latest version and as mentioned above both Title and Sentence cases have an issue. As it is non-existent in the previous I also strongly believe this has been introduced by #9102.
Validated the same for other fields also and as you said this issue applies for it as they share the same routines.

Just to reconfirm how the ideal case conversion should look like please confirm if below mentioned examples are correct

Title case : "Wetting-and-Drying Cycle and Others Effects"
Sentence Case : Wetting-and-drying cycle and others effects

I am looking into the issue will raise the PR once I am ready with the fix.

@mlep
Copy link
Contributor Author

mlep commented Sep 5, 2022

Just to reconfirm how the ideal case conversion should look like please confirm if below mentioned examples are correct

Title case : Wetting-and-Drying Cycle and Others Effects
Sentence Case : Wetting-and-drying cycle and others effects

Indeed, this is how they should look!

sreenath-tm added a commit to sreenath-tm/jabref that referenced this issue Sep 6, 2022
Siedlerchr added a commit to LIM0000/jabref that referenced this issue Sep 10, 2022
* upstream/main:
  Anomaly with Title case and Sentence case JabRef#9112 (JabRef#9142)
  Fixed save order config (JabRef#9148)
  Update devdocs about fetchers (JabRef#9146)
  Set 'Update refused' dialog title (JabRef#9143)
  Bump jackson-datatype-jsr310 from 2.13.3 to 2.13.4 (JabRef#9136)
  Bump jackson-dataformat-yaml from 2.13.3 to 2.13.4 (JabRef#9138)
  Observable Preferences N (PushToApplicationPreferences, ExternalApplicationPreferences) (JabRef#9135)
  Resimplify Action interface (JabRef#9133)
  Fix issue with empty fallback directory (JabRef#9134)
  Fix indexing (JabRef#9132)
  SLR data is now editable (JabRef#9131)
@mlep
Copy link
Contributor Author

mlep commented Sep 12, 2022

Thank you @sreenath-tm for solving this issue. Thanks to your contribution, it works as expected now.

Playing around, I have found another anomaly:
The menu "Change case -> Capitalize" converts
wetting-and-drying cycle and others effects
into
Wetting-and-drying Cycle And Others Effects
instead of
Wetting-And-Drying Cycle And Others Effects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants