Initial implementation for OCRmyPDF#15712
Conversation
|
I like the data oriented approach very much. Please use '///' markdown javadoc |
|
can you add some more info the PR, like how and where to install ocrmypdf so it works? |
Yeah, for sure, all of this stuff will be added. This PR is only the start of the project, we just want to test the feature and make sure it's working. |
| public TaskExecutor getTaskExecutor() { | ||
| return taskExecutor; |
There was a problem hiding this comment.
Inject downstream from JabRefGUI via constructors. See AIService for example.
jabref/jabgui/src/main/java/org/jabref/gui/JabRefGUI.java
Lines 231 to 236 in 355e201
There was a problem hiding this comment.
In the "View" you use; @Inject TaskExecutor taskExecutor, then when you create a view model, pass it in the constructor
There was a problem hiding this comment.
Would it not be better to do it the OCRService way as an analogue?
There was a problem hiding this comment.
You know, I was thinking, should we make an OCRService or not?
I have an idea to create an engine only when it’s needed. So the action will look (in the future) to the selected OCR engine and then different class will be created.
But IDK. The reason I propose this idea is to be more decentralized and also to not having a new injected dependency in many UI components. Because with AiService I had to put it in a lot of places, because some specific component C depends on B, and B depends on A. But then B and A are instantiated in many places, so in the end AiService was in a lot of constructors
There was a problem hiding this comment.
Makes sense. In my mind, I was trying to see the symmetry between OCR and existing AI (the taskexecutor, dialogservice, prefs passed via constructors) but I think what you propose is better and more loosely coupled.
Looping @calixtus in as well as this might be a decision costly to change if we ever have to move towards a uniform model.
| // We have to put Entry Editor Previous before, because otherwise the decrease font size is found first | ||
| ENTRY_EDITOR_PREVIOUS_PANEL_2("Entry editor, previous panel 2", Localization.lang("Entry editor, previous panel 2"), "shortcut+MINUS", KeyBindingCategory.VIEW), | ||
| DELETE_ENTRY("Delete entry", Localization.lang("Delete entry"), "DELETE", KeyBindingCategory.BIBTEX), | ||
| PERFORM_OCR("Perform OCR", Localization.lang("Perform OCR"), "", KeyBindingCategory.FILE), |
There was a problem hiding this comment.
I think this should have an appropriate shortcut. Pinging @Siedlerchr for suggestions.
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
InAnYan
left a comment
There was a problem hiding this comment.
I think you only need to run openrewrite, fix changelog conflict and address subhramit's coments. Overall, I think the PR is ready to go!
|
Sorry I was out of home today and yesterday and didn't have my laptop. |
* Initial implementation for OCRmyPDF * Addressed the review comments * Used pre-existing StreamGobbler for BufferedReader * Reomved unused variables * Reformated the code to meet JabRef's code guidelines * Added GUI to perform OCR * Added localized messages * Addressed the review comments * Reverted unintended change * Addressed the review comments * Solved checkstyle failing check * Added linking the new OCRed file to the used entry * Addressed the review commits * Added localized string to JabRef_en.preperties * Added check for OCRMYPDF availability * Added a comment for readability * Reduced the time of checking the avaialabilty of OCRmyPDF * Added --skip-text to handle partial searchable pdfs * Update jabgui/src/main/java/org/jabref/gui/linkedfile/OcrLinkedFileAction.java Co-authored-by: Ruslan <ruslanpopov1512@gmail.com> * Apply suggestion from @InAnYan Co-authored-by: Ruslan <ruslanpopov1512@gmail.com> * Extracted the wait time in a single variable * Apply suggestion from @InAnYan * Added the PDF file type for the new OCRed file * Added some missing strings to JabRef_en.propeties * Fix comment formatting for LinkedFile constructor * Addressed some openrewrite comments * Added a changelog entry * Link OCRed file to entries * Improve OCRed file linking * Remove unintended file * Address review comments * Fix comment formatting in LinkedFile constructor * Fix comment formatting in LinkedFile constructor * Address review comment * fix(ocr): fix failure message --------- Co-authored-by: Ruslan <ruslanpopov1512@gmail.com>
* upstream/main: Add github-actions output format to jabkit check (#15789) Fixes of some nullaway warnings (#15792) Citations: Double click on entry should add and focus it (#15624) fix(ai): hide LLM varians if AI is disabled (#15812) Initial implementation for OCRmyPDF (#15712) fix(null): fix nullable warnings in CSLAdapter (#15803) Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15808) Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15809) New translations jabref_en.properties (Italian) (#15807) New Crowdin updates (#15796) Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15802) Chore(deps): Bump org.openrewrite.recipe:rewrite-recipe-bom (#15800) Chore(deps): Bump org.openrewrite.rewrite from 7.32.2 to 7.33.0 (#15801) Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15795) Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15794) Chore(deps): Bump jablib/src/main/resources/csl-styles (#15793) fix: remove tabs and unused AI exports (#15791)
Related issues and pull requests
Initial implementation for #13267
PR Description
Initial implementation for OCR integration in JabRef, which uses OCRmyPDF as the only engine, and has a very simple implementation to just test the feature integration.
Steps to test
jablib/src/test/resources/pdfs/scanned-image-only.pdffile to itSelecting text
Searching text
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)