Editing
OpenCC
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Install [https://github.com/BYVoid/OpenCC OpenCC] on [https://www.centos.org/download/ Centos7] Linux. OpenCC is the project for "conversion between Traditional and Simplified Chinese". == Installation == Install [https://github.com/BYVoid/OpenCC OpenCC] on Centos7 # {{kbd | key=<nowiki>git clone https://github.com/BYVoid/OpenCC.git --depth 1</nowiki>}} # Install GCC from repository {{kbd | key=<nowiki>sudo yum -y install gcc</nowiki>}}<ref>[https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ How To Install GCC on CentOS 7 | LinuxHostSupport]</ref> #* Verify the version of gcc because gcc 4.6 is required. {{kbd | key=<nowiki>gcc --version</nowiki>}} # Install [https://cmake.org/ CMake] from repository {{kbd | key=<nowiki>sudo yum -y install cmake</nowiki>}} #* Verify the installation of CMake: Input {{kbd | key=<nowiki>cmake--version</nowiki>}} Expected result are as the following:<pre>cmake version 2.8.12.2</pre> # Install [https://www.gnu.org/software/make/ Make] from repository {{kbd | key=<nowiki>sudo yum -y install make</nowiki>}} #* Verify the installation of Make: Input {{kbd | key=<nowiki>make--version</nowiki>}} Expected result are as the following:<pre>GNU Make 3.82 ... </pre> # Install [http://www.doxygen.nl/ Doxygen] from repository {{kbd | key=<nowiki>sudo yum -y install doxygen</nowiki>}} #* Verify the installation of doxygen: Input {{kbd | key=<nowiki>doxygen--version</nowiki>}} Expected result are as the following:<pre>1.8.5</pre> # {{kbd | key=<nowiki>cd OpenCC</nowiki>}} # {{kbd | key=<nowiki>make</nowiki>}} # {{kbd | key=<nowiki>sudo make install</nowiki>}} # (optional) {{kbd | key=<nowiki>sudo ln -s /usr/lib/libopencc.so.2 /usr/lib64/libopencc.so.2</nowiki>}} To check if the opencc was installed successfully, run this command in your terminal: <pre> opencc --version </pre> Expected result are as the following. Notice the version number may not be the same with yours. <pre> Open Chinese Convert (OpenCC) Command Line Tool Version: 1.0.5 </pre> == Usage == See the details on the page: [https://github.com/BYVoid/OpenCC GitHub - BYVoid/OpenCC: A project for conversion between Traditional and Simplified Chinese] Input/Output: characters <pre> ## Simplified Chinese to Traditional Chinese (Taiwan Standard) with Taiwanese idiom # echo "项目管理" | opencc -c s2twp 專案管理 ## Traditional Chinese (Taiwan Standard) to Simplified Chinese with Mainland Chinese idiom # echo "專案管理" | opencc -c tw2sp 项目管理 ## Traditional Chinese (Taiwan Standard) to Simplified Chinese # echo "專案管理" | opencc -c tw2s 专案管理 ## Simplified Chinese to Traditional Chinese (Taiwan Standard) # echo "项目管理" | opencc -c s2tw 項目管理 ## Convert the Traditional Chinese if converted from Simplified Chinese words not correctly # echo "項目管理" | opencc -c tw2s | opencc -c s2twp 專案管理 </pre> Input/Output: file <pre> ## Convert the text file encoding with Simplified Chinese to Traditional Chinese (Taiwan Standard) # opencc -i input.txt -o output.txt -c s2tw </pre> == Troubleshootings == === cmake: command not found on CentOS === Error message: <pre> $ make mkdir -p build/rel (cd build/rel; cmake \ -DBUILD_DOCUMENTATION:BOOL=ON \ -DENABLE_GTEST:BOOL=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ ../..) /bin/sh: line 1: cmake: command not found make: *** [build] Error 127 </pre> Solution<ref>How to run make from Cygwin environment? - Stack Overflow https://stackoverflow.com/questions/17710209/how-to-run-make-from-cygwin-environment</ref>: # Install GCC from repository {{kbd | key=<nowiki>sudo yum -y install gcc</nowiki>}} #* Verify the version of gcc because gcc 4.6 is required. {{kbd | key=<nowiki>gcc --version</nowiki>}} === Doxygen is needed to build the documentation === Error message: <pre> $ make mkdir -p build/rel (cd build/rel; cmake \ -DBUILD_DOCUMENTATION:BOOL=ON \ -DENABLE_GTEST:BOOL=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ ../..) -- The CXX compiler identification is GNU 4.8.5 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) CMake Error at doc/CMakeLists.txt:4 (message): Doxygen is needed to build the documentation. Please install it correctly -- Configuring incomplete, errors occurred! See also "/home/user/build/rel/CMakeFiles/CMakeOutput.log". make: *** [build] Error 1 </pre> Solution: # Install [http://www.doxygen.nl/ Doxygen] from repository {{kbd | key=<nowiki>sudo yum -y install doxygen</nowiki>}} === opencc: error while loading shared libraries: libopencc.so.2: cannot open shared object file: No such file or directory === Error message: <pre> $ opencc --version opencc: error while loading shared libraries: libopencc.so.2: cannot open shared object file: No such file or directory </pre> Solution: # Keyin: {{kbd | key=<nowiki>sudo ln -s /usr/lib/libopencc.so.2 /usr/lib64/libopencc.so.2</nowiki>}}<ref>[https://github.com/BYVoid/OpenCC/issues/259 opencc: error while loading shared libraries: libopencc.so.2: cannot open shared object file: No such file or directory · Issue #259 · BYVoid/OpenCC · GitHub]</ref> == References == <references /> [[Category:Software]] [[Category:Translation]]
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Template:Kbd
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information