-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the README docs, and move those about the API into method annotations in the OcrController so they can be exposed via auto-generated API docs with NelmioApiDocBundle. Bug: https://phabricator.wikimedia.org/T285513
- Loading branch information
Showing
13 changed files
with
694 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
public/bundles/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,14 @@ | ||
Wikisource Google OCR tool | ||
========================== | ||
Wikimedia OCR | ||
============= | ||
|
||
![CI](https://github.com/wikimedia/wikimedia-ocr/workflows/CI/badge.svg) | ||
|
||
Main documentation: https://wikisource.org/wiki/Wikisource:Google_OCR | ||
|
||
This is a simple wrapper service around the Google Cloud Vision API, | ||
enabling Wikisources to submit images for Optical Character Recognition | ||
and retrieve the resultant text. | ||
|
||
This works with more languages than the alternative service at https://tools.wmflabs.org/phetools | ||
(used by e.g. https://wikisource.org/wiki/MediaWiki:OCR.js and similar scripts | ||
on other Wikisources). | ||
|
||
Requests can only be for images hosted on Commons. | ||
|
||
## Usage | ||
|
||
Send up to two parameters to `api.php`: | ||
|
||
https://example.org/api.php?langs[]=[LANG_CODE_1]&langs[]=[LANG_CODE_2]&image=[IMAGE_URL] | ||
|
||
And get back a JSON response with either 'text' or 'error' top-level items set: | ||
|
||
{ | ||
'text': 'Lorem ipsum...', | ||
'error': { | ||
'code': '', | ||
'message': '' | ||
} | ||
} | ||
A web service and UI for providing OCR text from images hosted on MediaWiki wikis. | ||
Can be integrated into the [ProofreadPage extension](https://www.mediawiki.org/wiki/Extension:ProofreadPage) | ||
via the [Wikisource extension](https://www.mediawiki.org/wiki/Extension:Wikisource). | ||
|
||
### Languages | ||
Documentation: | ||
* For system administrators: https://wikitech.wikimedia.org/wiki/Nova_Resource:Wikisource/Wikimedia_OCR | ||
* For Wikisource users: https://www.mediawiki.org/wiki/Help:Extension:Wikisource/Wikimedia_OCR | ||
* Of the API: https://ocr.wmcloud.org/api/doc | ||
* For contributors: [CONTRIBUTING.md](https://github.com/wikimedia/wikimedia-ocr/blob/main/CONTRIBUTING.md) | ||
|
||
|
||
Note that you should only set the `lang` parameter for languages that require it. | ||
The [documentation](https://cloud.google.com/vision/reference/rest/v1/images/annotate#imagecontext) informs us of the following: | ||
|
||
> In most cases, an empty value yields the best results since it enables automatic language detection. | ||
> For languages based on the Latin alphabet, setting languageHints is not needed. | ||
> In rare cases, when the language of the text in the image is known, setting a hint will help get better results | ||
> (although it will be a significant hindrance if the hint is wrong). | ||
> Text detection via the web interface returns an error if one or more of the specified languages is not | ||
> one of the [supported languages](https://cloud.google.com/vision/docs/languages). API requests will succeed | ||
> with a warning reporting invalid languages. | ||
#### Tesseract | ||
|
||
Languages supported by Tesseract are [listed in the user manual](https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html). | ||
|
||
## Contributing | ||
|
||
See [CONTRIBUTING.md](https://github.com/wikimedia/wikimedia-ocr/blob/main/CONTRIBUTING.md) | ||
|
||
## External links | ||
|
||
* https://phabricator.wikimedia.org/T142768 | ||
* https://github.com/wikisource/google-cloud-vision-php | ||
![CI](https://github.com/wikimedia/wikimedia-ocr/workflows/CI/badge.svg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.