OpenCC: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
(Created page with "Install [https://github.com/BYVoid/OpenCC OpenCC] on Centos7. OpenCC is the project for "conversion between Traditional and Simplified Chinese". == Installation == Install [h...")
 
Line 18: Line 18:
Open Chinese Convert (OpenCC) Command Line Tool
Open Chinese Convert (OpenCC) Command Line Tool
Version: 1.0.5
Version: 1.0.5
</pre>
== Usage ==
<pre>
# echo "项目管理" | opencc -c s2twp
專案管理
# echo "專案管理" | opencc -c tw2sp
项目管理
# echo "專案管理" | opencc -c tw2s
专案管理
# echo "项目管理" | opencc -c s2tw
項目管理
</pre>
</pre>



Revision as of 15:42, 15 July 2019

Install OpenCC on Centos7. OpenCC is the project for "conversion between Traditional and Simplified Chinese".

Installation

Install OpenCC on Centos7

  1. git clone https://github.com/BYVoid/OpenCC.git --depth 1
  2. Install GCC from repository sudo yum -y install gcc[1]
    • Verify the version of gcc because gcc 4.6 is required. gcc --version
  3. Install CMake from repository sudo yum -y install cmake
  4. Install Make from repository sudo yum -y install make
  5. Install Doxygen from repository sudo yum -y install doxygen
  6. cd OpenCC
  7. make
  8. sudo make install

Verify the installation

  1. Input opencc --version. And the expected result are as the following:
Open Chinese Convert (OpenCC) Command Line Tool
Version: 1.0.5

Usage

# echo "项目管理" | opencc -c s2twp
專案管理

# echo "專案管理" | opencc -c tw2sp
项目管理

# echo "專案管理" | opencc -c tw2s
专案管理

# echo "项目管理" | opencc -c s2tw
項目管理

Troubleshootings

cmake: command not found

Error message:

$ 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

Solution:

  1. Install GCC from repository sudo yum -y install gcc
    • Verify the version of gcc because gcc 4.6 is required. gcc --version

Doxygen is needed to build the documentation

Error message:

$ 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

Solution:

  1. Install Doxygen from repository sudo yum -y install doxygen

opencc: error while loading shared libraries: libopencc.so.2: cannot open shared object file: No such file or directory

Error message:

$ opencc --version
opencc: error while loading shared libraries: libopencc.so.2: cannot open shared object file: No such file or directory

Solution:

  1. Keyin: sudo ln -s /usr/lib/libopencc.so.2 /usr/lib64/libopencc.so.2[2]


References