kahne / fastwer Goto Github PK
View Code? Open in Web Editor NEWA PyPI package for fast word/character error rate (WER/CER) calculation
License: MIT License
A PyPI package for fast word/character error rate (WER/CER) calculation
License: MIT License
Like when I have CER score of 89.6 it means 89.6 %, and when I have CER like 0.6 it is 0.6% right?
Thank you
Hi I was running on a Window computer and was getting this type of errors:
After reading posts like this one:'
http://www.suodenjoki.dk/us/archive/2010/min-max.htm
I added a header #include <algorithm>
to the fastwer.cpp file and solved the problem
When I try to install your package, I get following logs:
Building wheel for fastwer (setup.py): started
Building wheel for fastwer (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9ycgx467/fastwer/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9ycgx467/fastwer/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-u5ooap27
cwd: /tmp/pip-install-9ycgx467/fastwer/
Complete output (18 lines):
running bdist_wheel
running build
running build_py
package init file 'src/__init__.py' not found (or not a regular file)
running build_ext
creating tmp
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c /tmp/tmp6skrj6ig.cpp -o tmp/tmp6skrj6ig.o -std=c++17
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c /tmp/tmpioypszq6.cpp -o tmp/tmpioypszq6.o -fvisibility=hidden
building 'fastwer' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include -I/usr/include/python3.6m -c src/fastwer.cpp -o build/temp.linux-x86_64-3.6/src/fastwer.o -DVERSION_INFO="0.1.3" -std=c++17 -fvisibility=hidden
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include -I/usr/include/python3.6m -c src/bindings.cpp -o build/temp.linux-x86_64-3.6/src/bindings.o -DVERSION_INFO="0.1.3" -std=c++17 -fvisibility=hidden
src/bindings.cpp:9:16: error: expected constructor, destructor, or type conversion before ‘(’ token
PYBIND11_MODULE(fastwer, m) {
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for fastwer
Running setup.py clean for fastwer
Hi, trying to install fastwer.
I successfully installed pybing11, but not fastwer, not on python 3.7 nor 3.10.
I tried cloning the repository and running setup.py but it wouldn't let me.
Here's the error:
!pip install --use-pep517 fastwer
Collecting fastwer
Using cached fastwer-0.1.3.tar.gz (4.6 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
Traceback (most recent call last):
File "C:\Users\domin\anaconda3\envs\OCR\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\Users\domin\anaconda3\envs\OCR\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\domin\anaconda3\envs\OCR\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\domin\AppData\Local\Temp\pip-build-env-ghfpmuls\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "C:\Users\domin\AppData\Local\Temp\pip-build-env-ghfpmuls\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "C:\Users\domin\AppData\Local\Temp\pip-build-env-ghfpmuls\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
super().run_setup(setup_script=setup_script)
File "C:\Users\domin\AppData\Local\Temp\pip-build-env-ghfpmuls\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
exec(code, locals())
File "<string>", line 27, in <module>
File "<string>", line 19, in get_include
ModuleNotFoundError: No module named 'pybind11'
[end of output]
...
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
The installation works no problem on Google Colab.
Any help would be appreciated.
Unable to install the package via pip command
pip install pybind11 fastwer
Collecting pybind11
Downloading https://files.pythonhosted.org/packages/8d/43/7339dbabbc2793718d59703aace4166f53c29ee1c202f6ff5bf8a26c4d91/pybind11-2.6.2-py2.py3-none-any.whl (191kB)
|████████████████████████████████| 194kB 8.4MB/s
Collecting fastwer
Downloading https://files.pythonhosted.org/packages/cb/4d/a497cf1554862372a25576ac38c60e4ae4494cd6795aa52a21eab041cfd2/fastwer-0.1.3.tar.gz
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Hello,
Getting the following error while collecting the package via pip:
import pybind11 ModuleNotFoundError: No module named 'pybind11'
I have to first install pybind11 independently, which is a problem.
I have installed the pybind11 package, but not able to install fastwer library. I am getting the following error message.
(venv) ➜ pip install fastwer
Collecting fastwer
Using cached fastwer-0.1.3.tar.gz (4.6 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pybind11 in ./venv/lib/python3.9/site-packages (from fastwer) (2.10.3)
Building wheels for collected packages: fastwer
Building wheel for fastwer (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [25 lines of output]
running bdist_wheel
running build
running build_py
running build_ext
creating var
creating var/folders
creating var/folders/m5
creating var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn
creating var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/badri/Desktop/sem2/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c /var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T/tmppww6ud_r.cpp -o var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T/tmppww6ud_r.o -std=c++17
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/badri/Desktop/sem2/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c /var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T/tmp8di6lowo.cpp -o var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T/tmp8di6lowo.o -fvisibility=hidden
building 'fastwer' extension
creating build
creating build/temp.macosx-10.9-universal2-cpython-39
creating build/temp.macosx-10.9-universal2-cpython-39/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include -I/Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include -I/Users/badri/Desktop/sem2/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c src/bindings.cpp -o build/temp.macosx-10.9-universal2-cpython-39/src/bindings.o -stdlib=libc++ -mmacosx-version-min=10.14 -DVERSION_INFO=\"0.1.3\" -std=c++17 -fvisibility=hidden
In file included from src/bindings.cpp:1:
In file included from /Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include/pybind11/pybind11.h:13:
In file included from /Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include/pybind11/detail/class.h:12:
In file included from /Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include/pybind11/detail/../attr.h:13:
/Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include/pybind11/detail/common.h:212:10: fatal error: 'Python.h' file not found
#include <Python.h>
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for fastwer
Running setup.py clean for fastwer
Failed to build fastwer
Installing collected packages: fastwer
Running setup.py install for fastwer ... error
error: subprocess-exited-with-error
× Running setup.py install for fastwer did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
running install
/Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/badri/Desktop/sem2/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c /var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T/tmpvl0tw8eh.cpp -o var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T/tmpvl0tw8eh.o -std=c++17
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/badri/Desktop/sem2/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c /var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T/tmp3kgy2zjx.cpp -o var/folders/m5/wq5632qs3f3d1sqh_34wtzw00000gn/T/tmp3kgy2zjx.o -fvisibility=hidden
building 'fastwer' extension
creating build
creating build/temp.macosx-10.9-universal2-cpython-39
creating build/temp.macosx-10.9-universal2-cpython-39/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include -I/Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include -I/Users/badri/Desktop/sem2/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c src/bindings.cpp -o build/temp.macosx-10.9-universal2-cpython-39/src/bindings.o -stdlib=libc++ -mmacosx-version-min=10.14 -DVERSION_INFO=\"0.1.3\" -std=c++17 -fvisibility=hidden
In file included from src/bindings.cpp:1:
In file included from /Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include/pybind11/pybind11.h:13:
In file included from /Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include/pybind11/detail/class.h:12:
In file included from /Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include/pybind11/detail/../attr.h:13:
/Users/badri/Desktop/sem2/venv/lib/python3.9/site-packages/pybind11/include/pybind11/detail/common.h:212:10: fatal error: 'Python.h' file not found
#include <Python.h>
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> fastwer
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
When installing fastwer-0-13
using pip, building wheels for the package breaks because of a subprocess-exited-with-error
.
Full error:
>> $ pip install pybind11 fastwer
Requirement already satisfied: pybind11 in ./.venv/lib64/python3.11/site-packages (2.10.4)
Collecting fastwer
Using cached fastwer-0.1.3.tar.gz (4.6 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: fastwer
Building wheel for fastwer (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [107 lines of output]
running bdist_wheel
running build
running build_py
running build_ext
creating tmp
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/inarighas/Projects/voice-transcript/.venv/include -I/usr/include/python3.11 -c /tmp/tmp7ny4ljxj.cpp -o tmp/tmp7ny4ljxj.o -std=c++17
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/inarighas/Projects/voice-transcript/.venv/include -I/usr/include/python3.11 -c /tmp/tmprbaqr7r2.cpp -o tmp/tmprbaqr7r2.o -fvisibility=hidden
building 'fastwer' extension
creating build
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/src
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/inarighas/Projects/voice-transcript/.venv/lib64/python3.11/site-packages/pybind11/include -I/home/inarighas/Projects/voice-transcript/.venv/lib64/python3.11/site-packages/pybind11/include -I/home/inarighas/Projects/voice-transcript/.venv/include -I/usr/include/python3.11 -c src/bindings.cpp -o build/temp.linux-x86_64-cpython-311/src/bindings.o -DVERSION_INFO=\"0.1.3\" -std=c++17 -fvisibility=hidden
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/inarighas/Projects/voice-transcript/.venv/lib64/python3.11/site-packages/pybind11/include -I/home/inarighas/Projects/voice-transcript/.venv/lib64/python3.11/site-packages/pybind11/include -I/home/inarighas/Projects/voice-transcript/.venv/include -I/usr/include/python3.11 -c src/fastwer.cpp -o build/temp.linux-x86_64-cpython-311/src/fastwer.o -DVERSION_INFO=\"0.1.3\" -std=c++17 -fvisibility=hidden
In file included from src/fastwer.cpp:1:
src/fastwer.hpp:19:38: error: ‘uint8_t’ has not been declared
19 | double round_to_digits(double d, uint8_t digits = 4);
| ^~~~~~~
src/fastwer.hpp:21:10: error: ‘uint32_t’ was not declared in this scope
21 | pair<uint32_t, uint32_t> compute(string &hypo, string &ref, bool char_level = false);
| ^~~~~~~~
src/fastwer.hpp:9:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
8 | #include <cassert>
+++ |+#include <cstdint>
9 |
src/fastwer.hpp:21:20: error: ‘uint32_t’ was not declared in this scope
21 | pair<uint32_t, uint32_t> compute(string &hypo, string &ref, bool char_level = false);
| ^~~~~~~~
src/fastwer.hpp:21:20: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
src/fastwer.hpp:21:28: error: template argument 1 is invalid
21 | pair<uint32_t, uint32_t> compute(string &hypo, string &ref, bool char_level = false);
| ^
src/fastwer.hpp:21:28: error: template argument 2 is invalid
src/fastwer.cpp:14:43: error: ‘uint8_t’ has not been declared
14 | double fastwer::round_to_digits(double d, uint8_t digits) {
| ^~~~~~~
src/fastwer.cpp:20:7: error: ‘uint32_t’ was not declared in this scope
20 | pair <uint32_t, uint32_t> fastwer::compute(string &hypo, string &ref, bool char_level) {
| ^~~~~~~~
src/fastwer.cpp:2:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
1 | #include "fastwer.hpp"
+++ |+#include <cstdint>
2 |
src/fastwer.cpp:20:17: error: ‘uint32_t’ was not declared in this scope
20 | pair <uint32_t, uint32_t> fastwer::compute(string &hypo, string &ref, bool char_level) {
| ^~~~~~~~
src/fastwer.cpp:20:17: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
src/fastwer.cpp:20:25: error: template argument 1 is invalid
20 | pair <uint32_t, uint32_t> fastwer::compute(string &hypo, string &ref, bool char_level) {
| ^
src/fastwer.cpp:20:25: error: template argument 2 is invalid
src/fastwer.cpp: In function ‘int fastwer::compute(std::string&, std::string&, bool)’:
src/fastwer.cpp:25:5: error: ‘uint32_t’ was not declared in this scope
25 | uint32_t m = hypo_tokens.size() + 1, n = ref_tokens.size() + 1;
| ^~~~~~~~
src/fastwer.cpp:25:5: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
src/fastwer.cpp:26:20: error: template argument 2 is invalid
26 | vector<uint32_t> f(m * n);
| ^
src/fastwer.cpp:26:24: error: ‘m’ was not declared in this scope
26 | vector<uint32_t> f(m * n);
| ^
src/fastwer.cpp:26:28: error: ‘n’ was not declared in this scope
26 | vector<uint32_t> f(m * n);
| ^
src/fastwer.cpp:32:21: error: expected ‘;’ before ‘matching_case’
32 | uint32_t matching_case = f[(i - 1) * n + (j - 1)] + (hypo_tokens[i - 1] == ref_tokens[j - 1] ? 0 : 1);
| ^~~~~~~~~~~~~~
| ;
src/fastwer.cpp:33:46: error: ‘matching_case’ was not declared in this scope
33 | f[i * n + j] = min(f[i * n + j], matching_case);
| ^~~~~~~~~~~~~
src/fastwer.cpp: In function ‘double fastwer::score_sent(std::string&, std::string&, bool)’:
src/fastwer.cpp:40:10: error: ‘uint32_t’ was not declared in this scope
40 | pair<uint32_t, uint32_t> stats = fastwer::compute(hypo, ref, char_level);
| ^~~~~~~~
src/fastwer.cpp:40:10: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
src/fastwer.cpp:40:28: error: template argument 1 is invalid
40 | pair<uint32_t, uint32_t> stats = fastwer::compute(hypo, ref, char_level);
| ^
src/fastwer.cpp:41:56: error: request for member ‘first’ in ‘stats’, which is of non-class type ‘int’
41 | return fastwer::round_to_digits(100 * double(stats.first) / stats.second, 4);
| ^~~~~
src/fastwer.cpp:41:71: error: request for member ‘second’ in ‘stats’, which is of non-class type ‘int’
41 | return fastwer::round_to_digits(100 * double(stats.first) / stats.second, 4);
| ^~~~~~
src/fastwer.cpp: In function ‘double fastwer::score(std::vector<std::__cxx11::basic_string<char> >&, std::vector<std::__cxx11::basic_string<char> >&, bool)’:
src/fastwer.cpp:47:17: error: ‘uint32_t’ was not declared in this scope
47 | vector<pair<uint32_t, uint32_t>> stats(n_examples);
| ^~~~~~~~
src/fastwer.cpp:47:17: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
src/fastwer.cpp:47:27: error: template argument 1 is invalid
47 | vector<pair<uint32_t, uint32_t>> stats(n_examples);
| ^~~~~~~~
src/fastwer.cpp:47:35: error: template argument 1 is invalid
47 | vector<pair<uint32_t, uint32_t>> stats(n_examples);
| ^~
src/fastwer.cpp:47:35: error: template argument 2 is invalid
src/fastwer.cpp:50:15: error: request for member ‘push_back’ in ‘stats’, which is of non-class type ‘int’
50 | stats.push_back(fastwer::compute(hypo[i], ref[i], char_level));
| ^~~~~~~~~
src/fastwer.cpp:51:30: error: request for member ‘back’ in ‘stats’, which is of non-class type ‘int’
51 | total_edits += stats.back().first;
| ^~~~
src/fastwer.cpp:52:32: error: request for member ‘back’ in ‘stats’, which is of non-class type ‘int’
52 | total_lengths += stats.back().second;
| ^~~~
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for fastwer
Running setup.py clean for fastwer
Failed to build fastwer
ERROR: Could not build wheels for fastwer, which is required to install pyproject.toml-based projects
I have a list of hypotheses and a list of references. Both have one element, a string. The hypothesis string has a length of 115233. The reference string has a length of 141575. I need to compute both WER and CER. When I compute WER with fastwer.score(hyps, refs)
, everything is normal. But, when I compute CER with fastwer.score(hyps, refs, char_level=True)
, my program pauses for an unexpected period of a few seconds, then prints "Segmentation fault", and then exits.
I would like to normalize the output following the article by Rafael C. Carrasco:
https://sites.google.com/site/textdigitisation/qualitymeasures/computingerrorrates
Like this:
where C = Number of correct characters
How can I calculate the number of correct characters?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.