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
Conversation
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)
Pull Request Test Coverage Report for Build 582
💛 - Coveralls |
How accurate is it now? |
update above |
src/handlers/initState.js
Outdated
@@ -146,9 +150,16 @@ export default async function initState(params) { | |||
}, | |||
templateMessage, | |||
]; | |||
console.log(JSON.stringify(event)); |
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.
please remove this console.log, thanks
src/handlers/initState.js
Outdated
@@ -133,11 +135,13 @@ export default async function initState(params) { | |||
}, | |||
}; | |||
|
|||
replies = [ | |||
var prefixTextArticleFound = [ |
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.
const
would be better
src/handlers/initState.js
Outdated
{ | ||
type: 'text', | ||
text: `🔍 ${t`There are some messages that looks similar to "${articleSummary}" you have sent to me.`}`, | ||
}, | ||
]; | ||
var textArticleFound = [ |
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.
const
would be better
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.
LGTM!
a. Add tesseract-ocr to process image messages
processText
function.b. Update reply messages for image input
messageType
is not text.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.