I'm trying to use the "node-tesseract-ocr" module with electron to perform some basic image-to-text translations, but I'm having issues that I cannot seem to figure out, for the life of me. I'm using the exact same code as provided in the example (seen here: https://www.npmjs.com/package/node-tesseract-ocr), except I've changed the "lang" parameter for the configuration to the name of my custom .traineddata file. I've installed Tesseract manually alongside this, and have set the PATH variables for Tesseract ("C:\Program Files\Tesseract-OCR" and "C:\Program Files\Tesseract-OCR\tessdata"), and have placed the .traineddata file inside of the \tessdata folder.
Here's the error:
Command failed: tesseract "./screen.png" stdout -l mc --oem 1 --psm 3
Error opening data file C:\Program Files\Tesseract-OCR/tessdata/mc.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory.
Failed loading language 'mc'
Tesseract couldn't load any languages!
Could not initialize tesseract.
I have no idea why the slashes swap midway through the path to the .traineddata file; I'm assuming this is the issue, but I have no idea how to fix this, as it seems to be an issue with Tesseract itself.
Did I install an incorrect version or something? (I installed Tesseract using "tesseract-ocr-w64-setup-v5.2.0.20220712.exe" from "https://digi.bib.uni-mannheim.de/tesseract/", as suggested by "https://medium.com/quantrium-tech/installing-and-using-tesseract-4-on-windows-10-4f7930313f82").
Everything works perfectly fine when using "eng" as the language, except the characters are not always read properly (since I'm attempting to read characters from a game, rather than handwriting/a standard English font, which is why I need the custom .traineddata file to work).
Any help is appreciated.
I used the installation from https://github.com/UB-Mannheim/tesseract/wiki and it seems to work now. Not sure why the other installation was bugged, but oh well.
Related
I am working through the Odin Project and am stuck on the first lesson where we must build a webapp using webpack. I followed the tutorials here and hereon webpack's website, and I was able to get them to work. However, when I try to set up my own files to build my own project, I can't get CSS to load or a function in my index.js file.
I have the same directory style set up, and have even tried using the exact same index.js file they use in the tutorial.
I expect to get: a webpage to load that says "hello webpack" in red text.
Instead, I get this error: when I run $npx webpack, it says:
ERROR in ./src/style.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> .hello{
| color: red;
| }
# ./src/index.js 1:0-21
Upon googling the error, I found a stack overflow article and I tried renaming my rules array to 'loaders' in my .config file as this article suggests, but I still get the same error.
“You may need an appropriate loader to handle this file type” with Webpack and CSS
Also weird is the fact that some of the code in my index.js file works, and some does not. To elaborate, my console.log and alert works just fine after I run $npx webpack and load the page. However, they function that is supposed to add "hello webpack" to the DOM, does not, as evidence by the fact that nothing shows up at all. The page itself is blank.
My index.js code:
import './style.css';
console.log("console works");
alert("alert works");
function component() {
const element = document.createElement('div');
// Lodash, now imported by this script
element.innerHTML = _.join(['Hello', 'webpack'], ' ');
element.classList.add('hello');
return element;
}
document.body.appendChild(component());
You will notice that it is nearly the exact same as the asset management index.js file from the webpack tutorial. I did this purposely to have as little variance as possible between my stuff and the tutorial.
I don't know if it is too much information, but a link to the whole repo as it currently is set up can be found here
Update:
I re-setup the file from the ground up and noticed that the CSS stopped working when I went out of my way to change the bundle.js link they had in their example to main.js. While I double-checked to make sure that I made the correct corresponding changes to output in my config file, making this change had the sum total outcome of not allowing my CSS to work for some reason.
What this reason is? I have no idea, and would be very interested to learn why this happened if someone has a suggestion
But on the offchance that one of my fellow Odin learners googles this problem, I kept the example's bundle.js instead of changing to main.js as my output script and it worked fine.
I'm going to update my github now so my original github link will likely be out of date going forward.
Going through your GitHub repo commit history, I see that at some point you named your Webpack configuration file weback.config.js instead of webpack.config.js (the p was missing). This was likely the source of the problem, as Webpack couldn't find a loader configuration for the .css file you're importing.
i have made a graphic software with JavaScript and GJS with GNOME builder. The problem is that whenever I want to run the software, I have to enter the application ID in the terminal (e.g. org.example.app), which is inconvenient.
I changed the output section in src/meson.build file, but when i run it i get this error:
(exampleapp:2411): Gjs-WARNING **: 17:31:11.727: JS ERROR: ImportError: Unable to load file from: resource:///org/example/app/js/main.js (The resource at “/org/example/app/js/main.js” does not exist)
Can anyone help?
This is the expected executable name for a GJS application, per the Package Specification.
If you want to create an alias for it, you should probably just use a symbolic link (e.g. org.foo.Bar => foo-bar).
I'm using webpack 4.26.1 (latest).
The code import('./images/header.csv') produce the following error:
Uncaught (in promise) Error: Cannot find module './images/header.csv'
at webpackMissingModule (home.js:9)
My project structure:
'project-dir/src/components/home.js' (im here)
'project-dir/src/components/images/header.csv'
I tried to read https://webpack.js.org/api/module-methods/ but failed to understand what to do except adding random webpack comments which I don't understand.
Also, from the docs, I may be found the source of the problem but I'm not exactly sure I understand it and how to solve it.
Fully dynamic statements, such as import(foo), will fail because webpack requires at least some file location information. This is because foo could potentially be any path to any file in your system or project. The import() must contain at least some information about where the module is located, so bundling can be limited to a specific directory or set of files.
Every module that could potentially be requested on an import() call is included. For example, import(./locale/${language}.json) will cause every .json file in the ./locale directory to be bundled into the new chunk. At run time, when the variable language has been computed, any file like english.json or german.json will be available for consumption. Using the webpackInclude and webpackExclude options allows us to add regex patterns that reduce the files that webpack will bundle for this import.
More than providing me a solution, I will appreciate any answer that covers what is the actual problem with my code.
Thank you.
I develop a mule project in mule standalone 3.7.0 server.
I try to deploy in mule standalone 3.7.0 , i got a following error
"cvc-complex-type.2.4.a: Invalid content was found starting with element 'dw:transform-message'"
But when i deployed with below schema
http://www.mulesoft.org/schema/mule/ee/dw
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
Still i couldn't get the solution.
I also had the same issue using dataweave on mule standalone server. I got it resolved by copying all files from
AnypointStudio\plugins\org.mule.tooling.server.3.8.3.ee_6.2.1.201612161609\mule\plugins\mule-plugin-weave-3.8.3-dist\lib
this directory to
mule-standalone-3.8.1\lib\mule
this directory. Hope this is helpful :)
Dataweave is a Enterprise feature. But you should still be able to use it in Studio as long as you're using a EE runtime.
If you have multiple mule config files where you are using dataweave, all the files should contain the below header.
Make sure you also have dw in xmlns as below
<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"...........
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd"...."
In my Angular JS app, I'm using a lot of third party packages, mainly maintained via Bower.
When I use Grunt to concatenate all of them into one mega file, I'm getting errors when I load my page, for example that
Uncaught ReferenceError: angular is not defined and
GET http://localhost:8080/theproj/v4/dist/app/bootstrap.css.map 404 (Not Found)
What is the best way to properly concatenate all these files to ensure that everything loads in the right order and doesn't cause problems?
First issue: A lot of times third party libraries must be loaded in a particular order. That looks like like it's the source of your first issue. Something is trying to use angular and it's getting loaded before the angular code. You should refactor your grunt task to use a pre-defined order for third party libraries.
Second issue: You probably are missing the .map file. This is a file used by Chrome dev tools to show you the original source for the css (sass or less). Either provide the map file, or delete the reference to it from bootstrap.css. Or just ignore the error, it's only an error when you have chrome dev tools open, and doesn't actually affect your application.
For the issue of the correct order for your javascript files, i had that problem in a larger project where noone really had a clue which was the correct order.
Luckily we found that the Google Closure Compiler does exactly this: https://github.com/google/closure-compiler
You give it all your js files and it analyzes them all and concatenates them in order
$ java -jar compiler.jar --js_output_file=out.js in1.js in2.js in3.js ...
There is even a grunt plugin for the connection: https://github.com/gmarty/grunt-closure-compiler
'closure-compiler': {
frontend: {
closurePath: '/src/to/closure-compiler',
js: 'static/src/frontend.js',
jsOutputFile: 'static/js/frontend.min.js',
maxBuffer: 500,
options: {
compilation_level: 'ADVANCED_OPTIMIZATIONS',
language_in: 'ECMASCRIPT5_STRICT'
}
}
},
Another way would be to change your javascripts into AMD or CommonJS modules, this way you don't have to worry about the correct order. RequireJS (http://requirejs.org/docs/start.html) is a possibility for AMD for example or Webpack (http://webpack.github.io/) ...or many many others.