請選擇 進入手機版 | 繼續訪問電腦版

COCO研究院

 找回密碼
 註冊
搜索
樓主: 超級美少女

[心得] Linode 初體驗

[複製鏈接]
 樓主| 發表於 14-9-1 11:51 | 顯示全部樓層
tinyding 發表於 14-9-1 11:41
先試試安裝底下兩者("gettext.i686" 以及 "gettext.x86_64") :



搞定~~~~~~

/usr/bin/opencc 有了~~

評分

參與人數 1金錢 +1 收起 理由
tinyding + 1 按一個讚

查看全部評分

 樓主| 發表於 14-9-1 13:19 | 顯示全部樓層
tinyding 發表於 14-9-1 11:41
先試試安裝底下兩者("gettext.i686" 以及 "gettext.x86_64") :




在問一下 opencc 使用指令 是???
發表於 14-9-1 13:25 | 顯示全部樓層
超級美少女 發表於 14-9-1 13:19
在問一下 opencc 使用指令 是???
  1. root@linode-001:/tmp# opencc --help

  2. Open Chinese Convert (OpenCC) Command Line Tool
  3. Version 0.3.0

  4. Author: BYVoid <byvoid.kcp@gmail.com>
  5. Bug Report: http://code.google.com/p/open-chinese-convert/issues/entry

  6. Usage:
  7. opencc [Options]

  8. Options:
  9. -i [file], --input=[file]   Read original text from [file].
  10. -o [file], --output=[file]  Write converted text to [file].
  11. -c [file], --config=[file]  Load configuration of conversion from [file].
  12. -v, --version               Print version and build information.
  13. -h, --help                  Print this help.

  14. With no input file, reads standard input and writes converted stream to standard output.
  15. Default configuration(zhs2zht.ini) will be loaded if not set.
複製代碼


 樓主| 發表於 14-9-1 13:26 | 顯示全部樓層
tinyding 發表於 14-9-1 13:25



舉實例啦,,看沒有~~
發表於 14-9-1 13:28 | 顯示全部樓層
超級美少女 發表於 14-9-1 13:19
在問一下 opencc 使用指令 是???

或者使用底下的命令也可以 ... :
  1. root@linode-001:/tmp# cat test-UTF8-CN_UTF8-TW-100M.txt | opencc > TXT.txt
  2. root@linode-001:/tmp# tail TXT.txt
  3. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  4. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  5. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  6. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  7. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  8. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  9. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  10. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  11. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  12. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
複製代碼


評分

參與人數 1金錢 +5 收起 理由
超級美少女 + 5 感謝分享

查看全部評分

發表於 14-9-1 15:15 | 顯示全部樓層
超級美少女 發表於 14-9-1 13:26
舉實例啦,,看沒有~~

加油吧!
尚有進階版 -> 在網頁底部 ... PHP Support 但我沒用過 ...
 樓主| 發表於 14-9-1 15:37 | 顯示全部樓層
tinyding 發表於 14-9-1 13:25

ss.png ..我的跑中文ㄋㄟ~~

評分

參與人數 1金錢 +1 收起 理由
tinyding + 1

查看全部評分

 樓主| 發表於 14-9-1 17:31 | 顯示全部樓層
tinyding 發表於 14-9-1 15:15
加油吧!
尚有進階版 -> 在網頁底部 ... PHP Support 但我沒用過 ...  ...


我要轉 utf8的~

opencc -i gb.txt -o big5.txt




錯誤:
opencc: symbol lookup error: opencc: undefined symbol: opencc_convert_utf8_free


發表於 14-9-1 18:44 | 顯示全部樓層
本帖最後由 tinyding 於 14-9-1 18:50 編輯
超級美少女 發表於 14-9-1 17:31
我要轉 utf8的~

opencc -i gb.txt -o big5.txt

底下是 "opencc --help" :
  1. root@linode-001:/tmp# opencc --help

  2. Open Chinese Convert (OpenCC) Command Line Tool
  3. Version 0.3.0

  4. Author: BYVoid <byvoid.kcp@gmail.com>
  5. Bug Report: http://code.google.com/p/open-chinese-convert/issues/entry

  6. Usage:
  7. opencc [Options]

  8. Options:
  9. -i [file], --input=[file]   Read original text from [file].
  10. -o [file], --output=[file]  Write converted text to [file].
  11. -c [file], --config=[file]  Load configuration of conversion from [file].
  12. -v, --version               Print version and build information.
  13. -h, --help                  Print this help.

  14. With no input file, reads standard input and writes converted stream to standard output.
  15. Default configuration(zhs2zht.ini) will be loaded if not set.
複製代碼


底下是 "man opencc > T1 ; cat T1" :
  1. OPENCC(1)                        User Commands                       OPENCC(1)



  2. NAME
  3.        opencc - simplified-traditional chinese conversion tool

  4. DESCRIPTION
  5.        Open Chinese Convert (OpenCC) Command Line Tool

  6.    Usage:
  7.        opencc [-i input_file] [-o output_file] [-c config_file]

  8.        -i Read original text from input_file.

  9.        -o Write converted text to output_file.

  10.        -c Load dictionary configuration from config_file.

  11.               Package   libopencc1   has   some   configuration  file  preset:
  12.               /usr/lib/${DEB_HOST_MULTIARCH}/opencc/*.ini; the ${DEB_HOST_MUL‐
  13.               TIARCH}   is   something   like  "x86_64-linux-gnu"  (AMD64)  or
  14.               "i386-linux-gnu" (i386), or something else; you can  get  it  by
  15.               `dpkg-architecture -qDEB_HOST_MULTIARCH`.

  16.               Note:

  17.               Text  from  standard input will be read if input_file is not set
  18.               and will be written to standard output  if  output_file  is  not
  19.               set.

  20.               Default  configuration(zhs2zht.ini)  will be load if config_file
  21.               is not set.

  22.        Open Chinese Convert (OpenCC) Command Line Tool

  23. SEE ALSO
  24.        iconv(1)



  25. opencc                             June 2010                         OPENCC(1)
複製代碼


由上述得知 opencc 的設定檔在 "/usr/lib" ... :
  1. root@linode-001:/tmp# cd /usr/lib
  2. root@linode-001:/usr/lib# find ./ -name "opencc*" -print
  3. ./x86_64-linux-gnu/opencc
複製代碼
切進目錄查看 ... :
  1. root@linode-001:/usr/lib# cd x86_64-linux-gnu/opencc
  2. root@linode-001:/usr/lib/x86_64-linux-gnu/opencc# ls -la
  3. total 8808
  4. drwxr-xr-x  2 root root    4096 Aug 28 08:40 .
  5. drwxr-xr-x 23 root root   20480 Aug 28 12:49 ..
  6. -rw-r--r--  1 root root     725 Dec  1  2011 from_tw_phrases.txt
  7. -rw-r--r--  1 root root     167 Dec  1  2011 from_tw_variants.txt
  8. -rw-r--r--  1 root root     873 Dec  1  2011 mix2zhs.ini
  9. -rw-r--r--  1 root root     874 Dec  1  2011 mix2zht.ini
  10. -rw-r--r--  1 root root 2184064 Jun 10  2012 simp_to_trad_characters.ocd
  11. -rw-r--r--  1 root root 4046192 Jun 10  2012 simp_to_trad_phrases.ocd
  12. -rw-r--r--  1 root root    3283 Dec  1  2011 to_cn_phrases.txt
  13. -rw-r--r--  1 root root    3471 Dec  1  2011 to_tw_phrases.txt
  14. -rw-r--r--  1 root root     168 Dec  1  2011 to_tw_variants.txt
  15. -rw-r--r--  1 root root 2185288 Jun 10  2012 trad_to_simp_characters.ocd
  16. -rw-r--r--  1 root root  495480 Jun 10  2012 trad_to_simp_phrases.ocd
  17. -rw-r--r--  1 root root     817 Dec  1  2011 zhs2zht.ini
  18. -rw-r--r--  1 root root     809 Dec  1  2011 zhs2zhtw_p.ini
  19. -rw-r--r--  1 root root     812 Dec  1  2011 zhs2zhtw_v.ini
  20. -rw-r--r--  1 root root     863 Dec  1  2011 zhs2zhtw_vp.ini
  21. -rw-r--r--  1 root root     817 Dec  1  2011 zht2zhs.ini
  22. -rw-r--r--  1 root root     733 Dec  1  2011 zht2zhtw_p.ini
  23. -rw-r--r--  1 root root     736 Dec  1  2011 zht2zhtw_v.ini
  24. -rw-r--r--  1 root root     787 Dec  1  2011 zht2zhtw_vp.ini
  25. -rw-r--r--  1 root root     890 Dec  1  2011 zhtw2zhcn_s.ini
  26. -rw-r--r--  1 root root     814 Dec  1  2011 zhtw2zhcn_t.ini
  27. -rw-r--r--  1 root root     843 Dec  1  2011 zhtw2zhs.ini
  28. -rw-r--r--  1 root root     767 Dec  1  2011 zhtw2zht.ini
複製代碼


預設的設定檔案是 "zhs2zht.ini" :
  1. root@linode-001:/usr/lib/x86_64-linux-gnu/opencc# cat zhs2zht.ini
  2. ; Open Chinese Convert
  3. ;
  4. ; Copyright 2010 BYVoid <byvoid.kcp@gmail.com>
  5. ;
  6. ; Licensed under the Apache License, Version 2.0 (the "License");
  7. ; you may not use this file except in compliance with the License.
  8. ; You may obtain a copy of the License at
  9. ;
  10. ;      http://www.apache.org/licenses/LICENSE-2.0
  11. ;
  12. ; Unless required by applicable law or agreed to in writing, software
  13. ; distributed under the License is distributed on an "AS IS" BASIS,
  14. ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. ; See the License for the specific language governing permissions and
  16. ; limitations under the License.

  17. title = simp_to_trad
  18. description = Standard Configuration for Conversion from Simplified Chinese to Traditional Chinese
  19. dict0 = OCD simp_to_trad_phrases.ocd
  20. dict0 = OCD simp_to_trad_characters.ocd
複製代碼


但你可以指定使用哪一個設定檔案,例如:
  1. root@linode-001:/tmp# opencc -i test-UTF8-CN_UTF8-TW-100M.txt -o TXT.txt -c /usr/lib/x86_64-linux-gnu/opencc/mix2zht.ini
  2. root@linode-001:/tmp# tail TXT.txt
  3. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  4. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  5. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  6. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  7. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  8. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  9. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  10. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  11. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
  12. 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
複製代碼



評分

參與人數 1金錢 +5 收起 理由
超級美少女 + 5 感謝分享

查看全部評分

 樓主| 發表於 14-9-1 19:13 | 顯示全部樓層
本帖最後由 超級美少女 於 14-9-1 19:16 編輯
tinyding 發表於 14-9-1 18:44
底下是 "opencc --help" :


  1. opencc -i gb.txt -o big5.txt -c /usr/share/opencc/mix2zht.ini
複製代碼

opencc: symbol lookup error: opencc: undefined symbol: opencc_convert_utf8_free







發表於 14-9-1 23:59 | 顯示全部樓層
超級美少女 發表於 14-9-1 19:13
opencc: symbol lookup error: opencc: undefined symbol: opencc_convert_utf8_free{:4_6 ...

如果 "gb.txt" 檔案並不是很大的話,記得上傳到論壇來,以便查看是因字碼衝突? 或是還有其他不明的因素所造成 ...使用 tar.gz 格式即可,例如:

  1. root@linode-001:/tmp# ls -la TT.txt
  2. -rw-r--r-- 1 root root 96 Aug 28 08:54 TT.txt
  3. root@linode-001:/tmp# tar zcvf TT.tar.gz TT.txt
  4. TT.txt
  5. root@linode-001:/tmp# ls -la TT.txt TT.tar.gz
  6. -rw-r--r-- 1 root root 226 Sep  1 15:54 TT.tar.gz
  7. -rw-r--r-- 1 root root  96 Aug 28 08:54 TT.txt
複製代碼


 樓主| 發表於 14-9-2 09:49 | 顯示全部樓層
tinyding 發表於 14-9-1 23:59
如果 "gb.txt" 檔案並不是很大的話,記得上傳到論壇來,以便查看是因字碼衝突? 或是還有其他不明的因素所造 ...

你試看看,看那個錯誤訊息,是編譯錯誤~

我已經重編2次,還是一樣~

gb.rar (2.22 KB, 下載次數: 367)
發表於 14-9-2 10:39 | 顯示全部樓層
超級美少女 發表於 14-9-2 09:49
你試看看,看那個錯誤訊息,是編譯錯誤~

我已經重編2次,還是一樣~

檔案我已下載,並且測試正常,一時之間看不出問題所在 ...
  1. root@linode-001:/tmp# opencc -i gb.txt -o TEST-gb.txt -c /usr/lib/x86_64-linux-gnu/opencc/mix2zht.ini
  2. root@linode-001:/tmp# ls -la gb.tar.gz gb.txt TEST-gb.txt
  3. -rw------- 1 root root  2345 Sep  2 02:21 gb.tar.gz
  4. -rwxr-xr-x 1 1003  513 16021 Sep  2 01:44 gb.txt
  5. -rw-r--r-- 1 root root 16021 Sep  2 02:30 TEST-gb.txt
  6. root@linode-001:/tmp# tail TEST-gb.txt

  7. 由於輸出太長了,所以,以下是截錄最後片段...
  8. /td>\r\n                </tr>\r\n               <tr style="height:13.5pt;">\r\n<td style="padding-top:0.0cm;padding-right:5.4pt;padding-bottom:0.0cm;padding-left:5.4pt;border-top-color:#ece9d8;border-right-color:windowtext;border-bottom-color:windowtext;border-left-color:windowtext;width:79.0pt;height:13.5pt;border-right-width:1.0pt;border-bottom-width:1.0pt;border-left-width:1.0pt;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;background-color:silver;" width="105">\r\n                          <p align="center" style="margin-top:0.0cm;margin-right:0.0cm;margin-bottom:0.0pt;margin-left:0.0cm;text-align:center;">\r\n                                     <strong><span style="color:#ff0000;font-family:黑體;font-size:medium;"><span style="font-size:24.0px;"><span style="color:#cc0000;"><strong><strong><span style="color:#ff0000;"><span style="font-size:18.0px;"><span style="color:#000000;"><strong><span style="font-family:simhei;"><span style="font-size:24.0px;"><b><span style="color:#333333;font-family:宋體;font-size:9.0pt;">商品尺碼</span></b></span></span></strong></sparoot@lin
複製代碼


發表於 14-9-2 11:22 | 顯示全部樓層
tinyding 發表於 14-9-2 10:39
檔案我已下載,並且測試正常,一時之間看不出問題所在 ...

底下是使用自行編譯的 opencc,但設定檔案則是使用安裝在系統內的 Opencc 套件的設定檔案 ... :
  1. root@linode-001:/tmp/opencc-0.4.3/build# ./src/tools/opencc -i /tmp/gb.txt -o /tmp/TEST-gb.txt -c /usr/lib/x86_64-linux-gnu/opencc/mix2zht.ini
  2. root@linode-001:/tmp/opencc-0.4.3/build# pwd
  3. /tmp/opencc-0.4.3/build
  4. root@linode-001:/tmp/opencc-0.4.3/build# ls -la /tmp/gb.tar.gz /tmp/gb.txt /tmp/TEST-gb.txt
  5. -rw------- 1 root root  2345 Sep  2 02:21 /tmp/gb.tar.gz
  6. -rwxr-xr-x 1 1003  513 16021 Sep  2 01:44 /tmp/gb.txt
  7. -rw-r--r-- 1 root root 16018 Sep  2 03:12 /tmp/TEST-gb.txt
  8. root@linode-001:/tmp/opencc-0.4.3/build# tail /tmp/TEST-gb.txt

  9. 由於輸出太長了,所以,以下是截錄最後片段...
  10. /td>\r\n                </tr>\r\n               <tr style="height:13.5pt;">\r\n<td style="padding-top:0.0cm;padding-right:5.4pt;padding-bottom:0.0cm;padding-left:5.4pt;border-top-color:#ece9d8;border-right-color:windowtext;border-bottom-color:windowtext;border-left-color:windowtext;width:79.0pt;height:13.5pt;border-right-width:1.0pt;border-bottom-width:1.0pt;border-left-width:1.0pt;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;background-color:silver;" width="105">\r\n                          <p align="center" style="margin-top:0.0cm;margin-right:0.0cm;margin-bottom:0.0pt;margin-left:0.0cm;text-align:center;">\r\n                                     <strong><span style="color:#ff0000;font-family:黑體;font-size:medium;"><span style="font-size:24.0px;"><span style="color:#cc0000;"><strong><strong><span style="color:#ff0000;"><span style="font-size:18.0px;"><span style="color:#000000;"><strong><span style="font-family:simhei;"><span style="font-size:24.0px;"><b><span style="color:#333333;font-family:宋體;font-size:9.0pt;">商品尺碼</span></b></span></span></strong></sparoot@lin
複製代碼

發表於 14-9-2 11:26 | 顯示全部樓層
tinyding 發表於 14-9-2 11:22
底下是使用自行編譯的 opencc,但設定檔案則是使用安裝在系統內的 Opencc 套件的設定檔案 ... :

...

上面的測試,都是在 Debian 系統底下測試的 ... 上星期六做完 CentOS 底下的 opencc 測試後,我就把 Linode 和 DigitalOcean 中的 CentOS 給砍了 ...
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-3-28 17:27

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook