mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-04 11:35:13 +00:00
fix ocr can't recognize chinese characters
This commit is contained in:
parent
9282803871
commit
116cebaea4
5 changed files with 9 additions and 5 deletions
|
|
@ -224,11 +224,15 @@ class FocalPointModal extends ImmutablePureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
worker.recognize(media_url)
|
||||
.progress(({ progress }) => this.setState({ progress }))
|
||||
.finally(() => worker.terminate())
|
||||
.then(({ text }) => this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false }))
|
||||
.catch(() => this.setState({ detecting: false }));
|
||||
(async () => {
|
||||
await worker.loadLanguage('eng+chi_sim+chi_sim_vert+chi_tra+chi_tra_vert');
|
||||
await worker.initialize('eng+chi_sim+chi_tra');
|
||||
worker.recognize(media_url)
|
||||
.progress(({ progress }) => this.setState({ progress }))
|
||||
.finally(() => worker.terminate())
|
||||
.then(({ text }) => this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false }))
|
||||
.catch(() => this.setState({ detecting: false }));
|
||||
})();
|
||||
}).catch(() => this.setState({ detecting: false }));
|
||||
}
|
||||
|
||||
|
|
|
|||
BIN
public/ocr/lang-data/chi_sim.traineddata.gz
Normal file
BIN
public/ocr/lang-data/chi_sim.traineddata.gz
Normal file
Binary file not shown.
BIN
public/ocr/lang-data/chi_sim_vert.traineddata.gz
Normal file
BIN
public/ocr/lang-data/chi_sim_vert.traineddata.gz
Normal file
Binary file not shown.
BIN
public/ocr/lang-data/chi_tra.traineddata.gz
Normal file
BIN
public/ocr/lang-data/chi_tra.traineddata.gz
Normal file
Binary file not shown.
BIN
public/ocr/lang-data/chi_tra_vert.traineddata.gz
Normal file
BIN
public/ocr/lang-data/chi_tra_vert.traineddata.gz
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue