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

Add tesseract-ocr to process image messages #147

Merged
merged 7 commits into from Dec 12, 2019
Merged

Conversation

nonumpa
Copy link
Member

@nonumpa nonumpa commented Dec 4, 2019

a. Add tesseract-ocr to process image messages

  1. Extract message_process statements to processText function.
  2. Save and process image files in tmp_image_process dir.
  3. Update README.md about tesseract-ocr configuration. related project

b. Update reply messages for image input

  1. [initState] Don't reply article-found-prefix when messageType is not text.
  2. [askingArticleSource] Guide user to ask fact-checkers in case messageType is not text and is able to send article to database.

update : 2019/12/04 20:34

tesseract-ocr-4.1.0+tessdata-4.0.0 (my local machine)

"White word" tesseract can't recognize well.

tesseract-ocr-4.0.0+tessdata-4.0.0 (Heroku)

But on the Heroku the result is not good as my local machine, maybe I should update Buildpack's tesseract binary version to 4.1.0.

1. Extract message_process statements to `processText` function
2. Save and process image files in tmp_image_process dir
1. [initState] Don't reply article found prefix when `messageType` is not text
2. [askingArticleSource] Reorder statements, handle foundArticle first, able-to-send-to-database second, then others(self-input and image)
@coveralls
Copy link

coveralls commented Dec 4, 2019

Pull Request Test Coverage Report for Build 582

  • 13 of 14 (92.86%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.08%) to 96.296%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/handlers/initState.js 10 11 90.91%
Totals Coverage Status
Change from base Build 572: -1.08%
Covered Lines: 219
Relevant Lines: 225

💛 - Coveralls

@changhc
Copy link
Contributor

changhc commented Dec 4, 2019

How accurate is it now?

@nonumpa
Copy link
Member Author

nonumpa commented Dec 4, 2019

How accurate is it now?

update above

@@ -146,9 +150,16 @@ export default async function initState(params) {
},
templateMessage,
];
console.log(JSON.stringify(event));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this console.log, thanks

@@ -133,11 +135,13 @@ export default async function initState(params) {
},
};

replies = [
var prefixTextArticleFound = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const would be better

{
type: 'text',
text: `🔍 ${t`There are some messages that looks similar to "${articleSummary}" you have sent to me.`}`,
},
];
var textArticleFound = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const would be better

Copy link
Member

@MrOrz MrOrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MrOrz MrOrz merged commit 11425cd into dev Dec 12, 2019
@MrOrz MrOrz deleted the feature/tesseract-ocr branch December 23, 2019 18:35
@nonumpa nonumpa mentioned this pull request Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants