-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Anomaly with Title case and Sentence case #9112 #9142
Conversation
Thanks for your detailed explanation and for your interest fixing this. Please have a look the review dog output https://github.com/JabRef/jabref/pull/9142/files select the files tab) and the failing unit tests. |
Will validate the failed test case and also the coding standard related issues also @Siedlerchr . |
All existing references to the previous method defining Title case capitalization has been replaced with the newly introduced method.All Test cases are passing as expected. |
|
||
// Articles | ||
smallerWords.addAll(Arrays.asList("a", "an", "the")); | ||
// Prepositions | ||
smallerWords.addAll(Arrays.asList("above", "about", "across", "against", "along", "among", "around", "at", "before", "behind", "below", "beneath", "beside", "between", "beyond", "by", "down", "during", "except", "for", "from", "in", "inside", "into", "like", "near", "of", "off", "on", "onto", "since", "to", "toward", "through", "under", "until", "up", "upon", "with", "within", "without")); | ||
// Conjunctions | ||
smallerWords.addAll(Arrays.asList("and", "but", "for", "nor", "or", "so", "yet")); | ||
|
||
conjunctions.addAll(Arrays.asList("and", "but", "for", "nor", "or", "so", "yet")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a duplicate of smallerWords, so what's the reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Smaller Words mentioned here is used in the method "isSmaller" which is used to check if the mentioned word is article,proposition or conjunction. As part of the issue #9112 the conjunction used in the title should not be capitalised.To acheive the same the new field "Conjunction" was introduced explicitly to check whether the word taken into consideration is a conjunction or not, which could not be acheived by "smaller Words" as they contain other values also like articles and propositions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks for the explanation. Overlooked that all values are added to smaller words.
Suggestion for improvement:
Move conjunctions initializing before, and then you can reuse it in smallerWords.addAll(conjunctions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on that now will update the code accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed the conjunctions was initialized before and was used to set to the field smaller word.
CHANGELOG.md
Outdated
@@ -49,7 +49,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve | |||
- We fixed issues with save actions not correctly loaded when opening the library. [#9122](https://github.com/JabRef/jabref/pull/9122) | |||
- We fixed an issue where title case didn't capitalize words after en-dash characters. [#9068](https://github.com/JabRef/jabref/pull/9068) | |||
- We fixed an issue where JabRef would not exit when a connection to a LibreOffice document was established previously and the document is still open. [#9075](https://github.com/JabRef/jabref/issues/9075) | |||
|
|||
We fixed an issue where title case was capitalizing Conjunctions after en-dash characters and the Capitalization fix made as part of #9012 has been restricted only to Title case. #9112 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually in this special case you don't need a changelog entry, as the current version of JabRef is still unreleased and the error was introduced after the last release.
For nearly all other cases, a changelog entry is necesary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure will remove the new line.Should I modify the existing changelog entry made as part of the #9102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I think that's a good idea. Ref this issue/pr then as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified the same line and included this PR details to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks very good to me. Just one comment about the comments...
And could you please add a simple test that the issue described is solved?
// Conjunctions | ||
conjunctions.addAll(Arrays.asList("and", "but", "for", "nor", "or", "so", "yet")); | ||
// Articles | ||
smallerWords.addAll(Arrays.asList("a", "an", "the")); | ||
// Prepositions | ||
smallerWords.addAll(Arrays.asList("above", "about", "across", "against", "along", "among", "around", "at", "before", "behind", "below", "beneath", "beside", "between", "beyond", "by", "down", "during", "except", "for", "from", "in", "inside", "into", "like", "near", "of", "off", "on", "onto", "since", "to", "toward", "through", "under", "until", "up", "upon", "with", "within", "without")); | ||
// Conjunctions | ||
smallerWords.addAll(Arrays.asList("and", "but", "for", "nor", "or", "so", "yet")); | ||
|
||
smallerWords.addAll(conjunctions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In both comments it says 'Conjunctions'. Maybe change the comment add write one line, what difference it makes to conjuctions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting something like Conjunctions used as part of Title case capitalisation to specifically check if word is conjunction or not and Conjunctions used as part of all case capitalisation to check if it is a small word or not respectively will be fine right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Would just be fine just to avoid misunderstanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And don't forget the test case. Then we can merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure will add the test cases also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test cases and modified the corresponding comments.
Thanks for your work on this issue. I hope you liked working on JabRef and we are looking forward for more. ;-) |
* 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)
Fixes #9102
Fixes #9112
What: I implemented a change to the Word.java file so that the code that capitalize any part of a title that follows one of the characters from the en-dash list, like "-", "~" or "〰" on the Title Case method is limited only to the Title Case and not other Scenarios ( like Sentence Case). The changes made as part of #9102 made changes to the common method used by all types of Cases but the issue fix primarly aimed at the Title case and not other cases. Created a seperated method to handle only Title Case .
For example, the title "wetting-and-drying cycle and others effects becomes "Wetting-And-Drying Cycle and Others Effects" instead of the previous result ""Wetting-and-Drying Cycle and Others Effects".
For example, the title "wetting-and-drying cycle and others effects" becomes "Wetting-And-Drying cycle and others effects" instead of the previous result "Wetting-and-drying cycle and others effects".
Why: Following the issue #9112 discussion, there was a need to solve such a problem.The changes made as part of #9102 has caused an issue to Sentence cases where the corresponding changes was not expected and was working as expected previously. Another issue where conjunctions (and,or ..) where also getting capitalised also has been handled and will not be capitalised when the case is changed to Title Case.
Context: This change was incentivized by the University that I'm a part of at the moment. On its course, I ended up studying Test-Driven Development (TDD)s and Open Source Contibution, where this project (JabRef) was one of the options to work on using the TDD method. Therefore, i chose this issue to work on.
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)