1.7.4 SP1 // Hotenka Engine, etc. Merge Gitee PR!56 from upd/1.7.4sp1
This commit is contained in:
commit
2e919b8b5c
|
@ -8,13 +8,13 @@
|
|||
[submodule]
|
||||
active = .
|
||||
[remote "origin"]
|
||||
url = https://gitee.com/vchewing/vChewing-macOS
|
||||
url = https://gitee.com/vChewing/vChewing-macOS.git/
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
[branch "main"]
|
||||
remote = origin
|
||||
merge = refs/heads/main
|
||||
[submodule "Source/Data"]
|
||||
url = https://gitee.com/vchewing/libvchewing-data
|
||||
url = https://gitee.com/vChewing/libvchewing-data
|
||||
[branch "upd/dev"]
|
||||
remote = origin
|
||||
merge = refs/heads/upd/dev
|
||||
|
@ -28,12 +28,12 @@
|
|||
url = https://jihulab.com/vChewing/vChewing-macOS.git/
|
||||
fetch = +refs/heads/*:refs/remotes/gitlab/*
|
||||
[remote "github"]
|
||||
url = https://github.com/ShikiSuen//vChewing-macOS
|
||||
url = https://github.com/vChewing/vChewing-macOS/
|
||||
fetch = +refs/heads/*:refs/remotes/github/*
|
||||
[remote "all"]
|
||||
url = https://gitee.com/vchewing/vChewing-macOS
|
||||
url = https://gitee.com/vChewing/vChewing-macOS.git/
|
||||
fetch = +refs/heads/*:refs/remotes/all/*
|
||||
pushurl = https://gitee.com/vchewing/vChewing-macOS
|
||||
pushurl = https://gitee.com/vchewing/vChewing-macOS.git/
|
||||
pushurl = https://gitcode.net/vChewing/vChewing-macOS.git/
|
||||
pushurl = https://jihulab.com/vChewing/vChewing-macOS.git/
|
||||
pushurl = https://github.com/ShikiSuen//vChewing-macOS
|
||||
pushurl = https://github.com/vChewing/vChewing-macOS/
|
||||
|
|
7
AUTHORS
7
AUTHORS
|
@ -1,22 +1,21 @@
|
|||
$ Main contributors and volunteers of this repository (vChewing for macOS):
|
||||
|
||||
- Shiki Suen // Main developer of vChewing for macOS, Megrez language engine, and Tekkon syllable composer engine.
|
||||
- Shiki Suen // Main developer of vChewing for macOS, Megrez language engine, Hotenka Chinese Converter, and Tekkon syllable composer engine.
|
||||
- Hiraku Wang // Technical reinforcement in Cocoa during the Object-Cpp dev period of this project.
|
||||
- Isaac Xen // Technical reinforcement in Swift: SFX Module (NSSound ver.) and StringView Ranges Extension.
|
||||
|
||||
$ 3rd-Party Modules Used:
|
||||
|
||||
- LineReader: (c) 2019 and onwards Robert Muckle-Jones (Apache 2.0 License).
|
||||
- OpenCC: (c) 2010 and onwards Jiabao Guo, codename "Byvoid" (Apache-2.0 license).
|
||||
- SwiftyOpenCC: (c) 2017 and onwards ddddxxx (MIT License).
|
||||
- SwiftUI Preferences UI Framework: (c) 2018 and onwards Sindre Sorhus (MIT License).
|
||||
- SwiftUI VDKComboBox: (c) 2022 and onwards Bryan Jones (CC BY-SA 4.0)
|
||||
- Note that Hotenka Chinese Converter is rewritten by Shiki Suen (using Swift) from Nick Chen's Objective-C library "NCChineseConverter" (MIT License).
|
||||
|
||||
$ Contributors and volunteers of the upstream repo, having no responsibility in discussing anything in the current repo:
|
||||
|
||||
- Zonble Yang:
|
||||
- McBopomofo for macOS 2.x architect, especially state-based IME behavior management.
|
||||
- Voltaire candidate window MK2 (massively modified in vChewing by Shiki Suen).
|
||||
- Voltaire candidate window MK2 (massively modified as MK3 in vChewing by Shiki Suen).
|
||||
- InputHandler.
|
||||
- Notifier window and Tooltip UI.
|
||||
- NSStringUtils and FSEventStreamHelper.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
威注音輸入法歡迎有熱心的志願者們參與。
|
||||
|
||||
威注音目前的 codebase 更能代表一個先進的 macOS 輸入法雛形專案的形態。目前的 dev 分支除了第三方 OpenCC 模組以外被威注音使用的部分全都是清一色的 Swift codebase,一目了然,方便他人參與,比某些其它開源品牌旗下的專案更具程式方面的生命力。為什麼這樣講呢?那些傳統開源品牌的專案主要使用 C++ 這門不太友好的語言(Mandarin 模組現在對我而言仍舊是天書,一大堆針對記憶體指針的操作完全看不懂。搞不清楚在這一層之上的功能邏輯的話,就無法制定 Swift 版的 coding 策略),這也是我這次用 Swift 重寫了語言模型引擎與注音拼音並擊處理引擎、來換掉 Gramambular 與 OVMandarin 的原因(也是為後來者行方便)。
|
||||
威注音目前的 codebase 更能代表一個先進的 macOS 輸入法雛形專案的形態。目前的 dev 分支全都是清一色的 Swift codebase,一目了然,方便他人參與,比某些其它開源品牌旗下的專案更具程式方面的生命力。為什麼這樣講呢?那些傳統開源品牌的專案主要使用 C++ 這門不太友好的語言(Mandarin 模組現在對我而言仍舊是天書,一大堆針對記憶體指針的操作完全看不懂。搞不清楚在這一層之上的功能邏輯的話,就無法制定 Swift 版的 coding 策略),這也是我這次用 Swift 重寫了語言模型引擎與注音拼音並擊處理引擎、來換掉 Gramambular 與 OVMandarin 的原因(也是為後來者行方便)。
|
||||
|
||||
## 問題提報:
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ class AppDelegate: NSWindowController, NSApplicationDelegate {
|
|||
if elapsed >= kTranslocationRemovalDeadline {
|
||||
timer.invalidate()
|
||||
window?.endSheet(progressSheet, returnCode: .cancel)
|
||||
} else if appBundleChronoshiftedToARandomizedPath(kTargetPartialPath) == false {
|
||||
} else if readonlyAccessCheckGPR(kTargetPartialPath) == false {
|
||||
progressIndicator.doubleValue = 1.0
|
||||
timer.invalidate()
|
||||
window?.endSheet(progressSheet, returnCode: .continue)
|
||||
|
@ -163,7 +163,7 @@ class AppDelegate: NSWindowController, NSApplicationDelegate {
|
|||
}
|
||||
|
||||
let shouldWaitForTranslocationRemoval =
|
||||
appBundleChronoshiftedToARandomizedPath(kTargetPartialPath)
|
||||
readonlyAccessCheckGPR(kTargetPartialPath)
|
||||
&& (window?.responds(to: #selector(NSWindow.beginSheet(_:completionHandler:))) ?? false)
|
||||
|
||||
// 將既存輸入法扔到垃圾桶內
|
||||
|
@ -358,4 +358,11 @@ class AppDelegate: NSWindowController, NSApplicationDelegate {
|
|||
func windowWillClose(_: Notification) {
|
||||
NSApp.terminate(self)
|
||||
}
|
||||
|
||||
// Determines if an app is translocated by Gatekeeper to a randomized path
|
||||
// See https://weblog.rogueamoeba.com/2016/06/29/sierra-and-gatekeeper-path-randomization/
|
||||
// Theoretically, if the path is a randomized path then it cannot be writable to FileManager.
|
||||
func readonlyAccessCheckGPR(_ bundle: String) -> Bool {
|
||||
!FileManager.default.isWritableFile(atPath: (bundle as NSString).expandingTildeInPath)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright (c) 2011 and onwards The OpenVanilla Project (MIT License).
|
||||
// All possible vChewing-specific modifications are of:
|
||||
// (c) 2021 and onwards The vChewing Project (MIT-NTL License).
|
||||
/*
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
1. The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
2. No trademark license is granted to use the trade names, trademarks, service
|
||||
marks, or product names of Contributor, except as required to fulfill notice
|
||||
requirements above.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@import Cocoa;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// Determines if an app is translocated by Gatekeeper to a randomized path
|
||||
// See https://weblog.rogueamoeba.com/2016/06/29/sierra-and-gatekeeper-path-randomization/
|
||||
BOOL appBundleChronoshiftedToARandomizedPath(NSString *bundle);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (c) 2011 and onwards The OpenVanilla Project (MIT License).
|
||||
// All possible vChewing-specific modifications are of:
|
||||
// (c) 2021 and onwards The vChewing Project (MIT-NTL License).
|
||||
/*
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
1. The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
2. No trademark license is granted to use the trade names, trademarks, service
|
||||
marks, or product names of Contributor, except as required to fulfill notice
|
||||
requirements above.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#import "Chronosphere.h"
|
||||
#import <sys/mount.h>
|
||||
|
||||
BOOL appBundleChronoshiftedToARandomizedPath(NSString *bundle)
|
||||
{
|
||||
const char *bundleAbsPath = [[bundle stringByExpandingTildeInPath] UTF8String];
|
||||
int entryCount = getfsstat(NULL, 0, 0);
|
||||
int entrySize = sizeof(struct statfs);
|
||||
struct statfs *bufs = (struct statfs *)calloc(entryCount, entrySize);
|
||||
entryCount = getfsstat(bufs, entryCount * entrySize, MNT_NOWAIT);
|
||||
for (int i = 0; i < entryCount; i++)
|
||||
{
|
||||
if (!strcmp(bundleAbsPath, bufs[i].f_mntfromname))
|
||||
{
|
||||
free(bufs);
|
||||
|
||||
// getfsstat() may return us a cached result, and so we need to get the stat of the mounted fs.
|
||||
// If statfs() returns an error, the mounted fs is already gone.
|
||||
struct statfs stat;
|
||||
int checkResult = statfs(bundleAbsPath, &stat);
|
||||
if (checkResult != 0)
|
||||
{
|
||||
// Meaning the app's bundle is not mounted, that is it's not translocated.
|
||||
// It also means that the app is not loaded.
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
free(bufs);
|
||||
return NO;
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (c) 2011 and onwards The OpenVanilla Project (MIT License).
|
||||
// All possible vChewing-specific modifications are of:
|
||||
// (c) 2021 and onwards The vChewing Project (MIT-NTL License).
|
||||
/*
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
1. The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
2. No trademark license is granted to use the trade names, trademarks, service
|
||||
marks, or product names of Contributor, except as required to fulfill notice
|
||||
requirements above.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
//
|
||||
// Prefix header for all source files of the 'Installer' target in the 'Installer' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (c) 2011 and onwards The OpenVanilla Project (MIT License).
|
||||
// All possible vChewing-specific modifications are of:
|
||||
// (c) 2021 and onwards The vChewing Project (MIT-NTL License).
|
||||
/*
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
1. The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
2. No trademark license is granted to use the trade names, trademarks, service
|
||||
marks, or product names of Contributor, except as required to fulfill notice
|
||||
requirements above.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
#import "Chronosphere.h"
|
|
@ -17,7 +17,6 @@ vChewing macOS: MIT-NTL License 麻理(去商标)授权合约
|
|||
$ 在本专案内用到了下述第三方模组:
|
||||
|
||||
- LineReader: (c) 2019 and onwards Robert Muckle-Jones (Apache 2.0 License).
|
||||
- OpenCC: (c) 2010 and onwards Jiabao Guo, codename "Byvoid" (Apache-2.0 license).
|
||||
- SwiftyOpenCC: (c) 2017 and onwards ddddxxx (MIT License).
|
||||
- SwiftUI Preferences UI Framework: (c) 2018 and onwards Sindre Sorhus (MIT License).
|
||||
- SwiftUI VDKComboBox: (c) 2022 and onwards Bryan Jones (CC BY-SA 4.0)
|
||||
- Note that Hotenka Chinese Converter is rewritten by Shiki Suen (using Swift) from Nick Chen's Objective-C library "NCChineseConverter" (MIT License).
|
||||
|
|
|
@ -17,7 +17,6 @@ vChewing macOS: MIT-NTL License 麻理(去商標)授權合約
|
|||
$ 在該專案內用到了下述第三方:
|
||||
|
||||
- LineReader: (c) 2019 and onwards Robert Muckle-Jones (Apache 2.0 License).
|
||||
- OpenCC: (c) 2010 and onwards Jiabao Guo, codename "Byvoid" (Apache-2.0 license).
|
||||
- SwiftyOpenCC: (c) 2017 and onwards ddddxxx (MIT License).
|
||||
- SwiftUI Preferences UI Framework: (c) 2018 and onwards Sindre Sorhus (MIT License).
|
||||
- SwiftUI VDKComboBox: (c) 2022 and onwards Bryan Jones (CC BY-SA 4.0)
|
||||
- Note that Hotenka Chinese Converter is rewritten by Shiki Suen (using Swift) from Nick Chen's Objective-C library "NCChineseConverter" (MIT License).
|
||||
|
|
|
@ -17,7 +17,6 @@ macOS 版威注音の開発:Shiki Suen, Isaac Xen, Hiraku Wang, など。
|
|||
$ 他の用いたモジュール:
|
||||
|
||||
- LineReader: (c) 2019 and onwards Robert Muckle-Jones (Apache 2.0 License).
|
||||
- OpenCC: (c) 2010 and onwards Jiabao Guo, codename "Byvoid" (Apache-2.0 license).
|
||||
- SwiftyOpenCC: (c) 2017 and onwards ddddxxx (MIT License).
|
||||
- SwiftUI Preferences UI Framework: (c) 2018 and onwards Sindre Sorhus (MIT License).
|
||||
- SwiftUI VDKComboBox: (c) 2022 and onwards Bryan Jones (CC BY-SA 4.0)
|
||||
- Note that Hotenka Chinese Converter is rewritten by Shiki Suen (using Swift) from Nick Chen's Objective-C library "NCChineseConverter" (MIT License).
|
||||
|
|
|
@ -17,7 +17,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||
$ 3rd-Party Modules Used:
|
||||
|
||||
- LineReader: (c) 2019 and onwards Robert Muckle-Jones (Apache 2.0 License).
|
||||
- OpenCC: (c) 2010 and onwards Jiabao Guo, codename "Byvoid" (Apache-2.0 license).
|
||||
- SwiftyOpenCC: (c) 2017 and onwards ddddxxx (MIT License).
|
||||
- SwiftUI Preferences UI Framework: (c) 2018 and onwards Sindre Sorhus (MIT License).
|
||||
- SwiftUI VDKComboBox: (c) 2022 and onwards Bryan Jones (CC BY-SA 4.0)
|
||||
- Note that Hotenka Chinese Converter is rewritten by Shiki Suen (using Swift) from Nick Chen's Objective-C library "NCChineseConverter" (MIT License).
|
||||
|
|
5
Makefile
5
Makefile
|
@ -59,3 +59,8 @@ clean:
|
|||
|
||||
gc:
|
||||
git reflog expire --expire=now --all && git gc --prune=now --aggressive
|
||||
|
||||
.PHONY: test
|
||||
|
||||
test:
|
||||
xcodebuild -project vChewing.xcodeproj -scheme vChewing -configuration Debug test
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 DengXiang
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,17 +0,0 @@
|
|||
*.pyc
|
||||
*.tgz
|
||||
.project
|
||||
.cproject
|
||||
/.vscode
|
||||
/.mypy_cache
|
||||
/build
|
||||
/other
|
||||
/doc/html
|
||||
/dist
|
||||
/opencc.xcodeproj
|
||||
/test/dict.ocd
|
||||
/test/dict.txt
|
||||
/test/dict.bin
|
||||
/xcode
|
||||
/node_modules
|
||||
/*.egg-info
|
|
@ -1,12 +0,0 @@
|
|||
Author:
|
||||
Carbo Kuo <byvoid@byvoid.com>
|
||||
|
||||
Contributors:
|
||||
Peng Huang <shawn.p.huang@gmail.com>
|
||||
Kefu Chai <tchaikov@gmail.com>
|
||||
LI Daobing <lidaobing@gmail.com>
|
||||
Asias <asias.hejun@gmail.com>
|
||||
Peng Wu <alexepico@gmail.com>
|
||||
Xiaojun Ma <damage3025@gmail.com>
|
||||
佛振 <chen.sst@gmail.com>
|
||||
|
|
@ -1,230 +0,0 @@
|
|||
#
|
||||
# Open Chinese Convert
|
||||
#
|
||||
# Copyright 2010-2020 Carbo Kuo <byvoid@byvoid.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
######## Project settings
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
set (PACKAGE_NAME opencc)
|
||||
project (${PACKAGE_NAME} CXX)
|
||||
include (CTest)
|
||||
|
||||
######## Options
|
||||
option(BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build opencc as shared library" ON)
|
||||
option(ENABLE_GTEST "Build all tests." OFF)
|
||||
option(ENABLE_BENCHMARK "Build benchmark tests." OFF)
|
||||
option(ENABLE_DARTS "Build DartsDict (ocd format)." ON)
|
||||
option(BUILD_PYTHON "Build python library" OFF)
|
||||
option(USE_SYSTEM_DARTS "Use system version of Darts" OFF)
|
||||
option(USE_SYSTEM_GOOGLE_BENCHMARK "Use system version of Google Benchmark" OFF)
|
||||
option(USE_SYSTEM_GTEST "Use system version of GoogleTest" OFF)
|
||||
option(USE_SYSTEM_MARISA "Use system version of Marisa" OFF)
|
||||
option(USE_SYSTEM_PYBIND11 "Use system version of pybind11" OFF)
|
||||
option(USE_SYSTEM_RAPIDJSON "Use system version of RapidJSON" OFF)
|
||||
option(USE_SYSTEM_TCLAP "Use system version of TCLAP" OFF)
|
||||
|
||||
######## Package information
|
||||
set (PACKAGE_URL https://github.com/BYVoid/Opencc)
|
||||
set (PACKAGE_BUGREPORT https://github.com/BYVoid/Opencc/issues)
|
||||
set (OPENCC_VERSION_MAJOR 1)
|
||||
set (OPENCC_VERSION_MINOR 1)
|
||||
set (OPENCC_VERSION_REVISION 2)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set (version_suffix .Debug)
|
||||
endif (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
|
||||
set (
|
||||
OPENCC_VERSION
|
||||
${OPENCC_VERSION_MAJOR}.${OPENCC_VERSION_MINOR}.${OPENCC_VERSION_REVISION}${version_suffix}
|
||||
)
|
||||
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME
|
||||
"${PACKAGE_NAME}-${OPENCC_VERSION_MAJOR}.${OPENCC_VERSION_MINOR}.${OPENCC_VERSION_REVISION}"
|
||||
)
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
"/build/;/test/dict.ocd;/test/dict.txt;/test/dict.bin;/other/;/opencc.xcodeproj/;/.git/;.gitignore;~$;.pyc;${CPACK_SOURCE_IGNORE_FILES}"
|
||||
)
|
||||
include(CPack)
|
||||
|
||||
######## Windows
|
||||
|
||||
#if (WIN32)
|
||||
# set(CMAKE_SHARED_LIBRARY_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
# set(CMAKE_STATIC_LIBRARY_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
#endif (WIN32)
|
||||
|
||||
######## Mac OS X
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
endif()
|
||||
|
||||
######## Directory
|
||||
|
||||
set (DIR_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
set (DIR_INCLUDE ${DIR_PREFIX}/include/)
|
||||
set (DIR_SHARE ${DIR_PREFIX}/share/)
|
||||
set (DIR_ETC ${DIR_PREFIX}/etc/)
|
||||
set (DIR_LIBRARY ${DIR_PREFIX}/lib${LIB_SUFFIX}/)
|
||||
|
||||
if (DEFINED SHARE_INSTALL_PREFIX)
|
||||
set (DIR_SHARE ${SHARE_INSTALL_PREFIX})
|
||||
endif (DEFINED SHARE_INSTALL_PREFIX)
|
||||
|
||||
if (DEFINED INCLUDE_INSTALL_DIR)
|
||||
set (DIR_INCLUDE ${INCLUDE_INSTALL_DIR})
|
||||
endif (DEFINED INCLUDE_INSTALL_DIR)
|
||||
|
||||
if (DEFINED SYSCONF_INSTALL_DIR)
|
||||
set (DIR_ETC ${SYSCONF_INSTALL_DIR})
|
||||
endif (DEFINED SYSCONF_INSTALL_DIR)
|
||||
|
||||
if (DEFINED LIB_INSTALL_DIR)
|
||||
set (DIR_LIBRARY ${LIB_INSTALL_DIR})
|
||||
endif (DEFINED LIB_INSTALL_DIR)
|
||||
|
||||
set (DIR_SHARE_OPENCC ${DIR_SHARE}/opencc/)
|
||||
set (DIR_SHARE_LOCALE ${DIR_SHARE}/locale/)
|
||||
|
||||
######## Configuration
|
||||
|
||||
configure_file(
|
||||
opencc.pc.in
|
||||
opencc.pc
|
||||
@ONLY
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_BINARY_DIR}/opencc.pc
|
||||
DESTINATION
|
||||
${DIR_LIBRARY}/pkgconfig
|
||||
)
|
||||
|
||||
######## Compiler flags
|
||||
|
||||
add_definitions(
|
||||
-DPKGDATADIR="${DIR_SHARE_OPENCC}"
|
||||
-DLOCALEDIR="${DIR_SHARE_LOCALE}"
|
||||
-DVERSION="${OPENCC_VERSION}"
|
||||
-DPACKAGE_NAME="${PACKAGE_NAME}"
|
||||
)
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
add_definitions(
|
||||
-std=c++14
|
||||
-Wall
|
||||
)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions(-O0 -g3)
|
||||
endif ()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
add_definitions(
|
||||
-std=c++14
|
||||
-Wall
|
||||
)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions(-O0 -g3)
|
||||
endif ()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
add_definitions(
|
||||
/W4
|
||||
/D "_CRT_SECURE_NO_WARNINGS"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
add_definitions(
|
||||
-DOpencc_BUILT_AS_STATIC
|
||||
)
|
||||
endif (NOT BUILD_SHARED_LIBS)
|
||||
|
||||
if (ENABLE_GTEST)
|
||||
add_definitions(
|
||||
-DPROJECT_BINARY_DIR="${PROJECT_BINARY_DIR}"
|
||||
-DCMAKE_SOURCE_DIR="${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (ENABLE_BENCHMARK)
|
||||
add_definitions(
|
||||
-DPROJECT_BINARY_DIR="${PROJECT_BINARY_DIR}"
|
||||
-DCMAKE_SOURCE_DIR="${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (ENABLE_DARTS)
|
||||
add_definitions(
|
||||
-DENABLE_DARTS
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
######## Dependencies
|
||||
|
||||
if(NOT USE_SYSTEM_MARISA)
|
||||
message(STATUS "Use bundled marisa library.")
|
||||
add_subdirectory(deps/marisa-0.2.6)
|
||||
else()
|
||||
find_library(LIBMARISA NAMES marisa)
|
||||
if (LIBMARISA)
|
||||
message(STATUS "libmarisa found: ${LIBMARISA}")
|
||||
else()
|
||||
message(FATAL_ERROR "libmarisa not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
######## Subdirectories
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(test)
|
||||
|
||||
######## Testing
|
||||
|
||||
if (ENABLE_GTEST)
|
||||
if(NOT USE_SYSTEM_GTEST)
|
||||
add_subdirectory(deps/gtest-1.11.0)
|
||||
endif()
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
if (ENABLE_BENCHMARK)
|
||||
set(BENCHMARK_ENABLE_TESTING OFF)
|
||||
if(NOT USE_SYSTEM_GOOGLE_BENCHMARK)
|
||||
add_subdirectory(deps/google-benchmark)
|
||||
endif()
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
######## Python
|
||||
|
||||
if (BUILD_PYTHON)
|
||||
if(USE_SYSTEM_PYBIND11)
|
||||
include(pybind11Config)
|
||||
include(pybind11Common)
|
||||
include(pybind11Tools)
|
||||
else()
|
||||
add_subdirectory(deps/pybind11-2.5.0)
|
||||
endif()
|
||||
pybind11_add_module(opencc_clib src/py_opencc.cpp)
|
||||
target_link_libraries(opencc_clib PRIVATE libopencc)
|
||||
endif()
|
|
@ -1,56 +0,0 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
#
|
||||
# Open Chinese Convert
|
||||
#
|
||||
# Copyright 2010-2020 Carbo Kuo <byvoid@byvoid.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
PREFIX = /usr
|
||||
|
||||
.PHONY: build clean node test xcode-build
|
||||
|
||||
build:
|
||||
mkdir -p build/rel
|
||||
(cd build/rel; cmake \
|
||||
-DBUILD_DOCUMENTATION:BOOL=ON \
|
||||
-DENABLE_GTEST:BOOL=OFF \
|
||||
-DENABLE_BENCHMARK:BOOL=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
|
||||
../..)
|
||||
make -C build/rel VERBOSE=${VERBOSE} PREFIX=${PREFIX}
|
||||
|
||||
package: build
|
||||
make -C build/rel package_source VERBOSE=${VERBOSE}
|
||||
make -C build/rel package_source VERBOSE=${VERBOSE} PREFIX=${PREFIX}
|
||||
|
||||
test:
|
||||
mkdir -p build/dbg/root
|
||||
(cd build/dbg; cmake \
|
||||
-DBUILD_DOCUMENTATION:BOOL=OFF \
|
||||
-DENABLE_GTEST:BOOL=ON \
|
||||
-DENABLE_BENCHMARK:BOOL=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_INSTALL_PREFIX=`pwd`/root \
|
||||
../..)
|
||||
make -C build/dbg VERBOSE=${VERBOSE}
|
||||
(cd build/dbg; ctest --verbose)
|
||||
make -C build/dbg install VERBOSE=${VERBOSE}
|
||||
|
||||
benchmark:
|
||||
mkdir -p build/perf
|
||||
(cd build/perf; cmake \
|
||||
-DBUILD_DOCUMENTATION:BOOL=OFF \
|
||||
-DENABLE_GTEST:BOOL=OFF \
|
||||
-DENABLE_BENCHMARK:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_INSTALL_PREFIX=`pwd`/root \
|
||||
../..)
|
||||
make -C build/perf VERBOSE=${VERBOSE} PREFIX=${PREFIX}
|
||||
(cd build/perf; ctest --verbose)
|
||||
|
||||
node:
|
||||
node-gyp configure
|
||||
node-gyp build
|
||||
|
||||
node-test: node
|
||||
npm test
|
||||
|
||||
xcode-build:
|
||||
mkdir -p xcode
|
||||
(cd xcode; cmake \
|
||||
-G "Xcode" \
|
||||
-DBUILD_DOCUMENTATION:BOOL=OFF \
|
||||
-DENABLE_GTEST:BOOL=ON \
|
||||
-DENABLE_BENCHMARK:BOOL=ON \
|
||||
..; \
|
||||
xcodebuild build)
|
||||
|
||||
python-build:
|
||||
python setup.py build_ext
|
||||
|
||||
python-install: python-build
|
||||
python setup.py install
|
||||
|
||||
python-dist: python-build
|
||||
python setup.py bdist_wheel
|
||||
|
||||
python-test: python-build
|
||||
cd python; pytest .
|
||||
|
||||
test-all: test node-test python-test
|
||||
|
||||
format:
|
||||
find "src" "node" "test" -iname "*.hpp" -o -iname "*.cpp" -o -iname "*.cc" \
|
||||
-o -iname "*.c" -o -iname "*.h" \
|
||||
| xargs clang-format -i
|
||||
|
||||
clean:
|
||||
rm -rf build xcode python/opencc/clib *.egg-info
|
||||
|
||||
install: build
|
||||
make -C build/rel install VERBOSE=${VERBOSE} PREFIX=${PREFIX}
|
|
@ -1,233 +0,0 @@
|
|||
# Change History of OpenCC
|
||||
|
||||
## Version 1.1.2
|
||||
|
||||
2021年3月2日
|
||||
|
||||
* 新增香港繁體轉換。
|
||||
* 根據《通用漢字規範表》修正大量簡體異體字轉換。調整臺灣標準,避免過度轉換。
|
||||
* 修正編譯兼容性問題,包括並行編譯。
|
||||
* 修正1.1.0以來引入的性能嚴重下降問題。
|
||||
|
||||
## Version 1.1.1
|
||||
|
||||
2020年5月22日
|
||||
|
||||
* 正式提供[Python](https://pypi.org/project/OpenCC/)接口和TypeScript類型標註。
|
||||
* 更新動態鏈接庫`SOVERSION`到`1.1`,由於C++內部接口發生變更。
|
||||
* 進一步改進與Windows MSVC的兼容性。
|
||||
* 簡化頭文件結構,加快編譯速度。刪除不必要的`using`。
|
||||
* 修復部分香港標準字。
|
||||
|
||||
## Version 1.1.0
|
||||
|
||||
2020年5月10日
|
||||
|
||||
* 新辭典格式`ocd2`,基於Marisa Trie 0.2.5。辭典大小大幅減少。`STPhrases.ocd`從4.3MB減少到`STPhrases.ocd2`的924KB。
|
||||
* 升級依賴的rapidjson版本到1.1.0,tclap到1.2.2,gtest到1.11.0。
|
||||
* 更改「涌/湧」的默認轉換,修正多個詞組轉換。
|
||||
* 提供Windows的預編譯版本下載(AppVeyor)。
|
||||
* 增加基準測試結果。
|
||||
|
||||
## Version 1.0.6
|
||||
|
||||
2020年4月13日
|
||||
|
||||
* 正式支持日本語新字體轉換。
|
||||
* 升級Node.js依賴,改進兼容性。
|
||||
* 修復多處多平臺編譯和兼容性問題。
|
||||
* 修正大量轉換錯誤。
|
||||
|
||||
## Version 1.0.5
|
||||
|
||||
2017年2月6日
|
||||
|
||||
* 修正Windows下CMake和Visual Studio的問題。
|
||||
* 修正FNV Hash的32位編譯警告。
|
||||
* 增加若干臺灣常用詞彙轉換和異體字轉換。
|
||||
* 增加和修正若干轉換問題。
|
||||
* 加快Node模塊編譯速度。
|
||||
* 增加Node模塊的詞典轉換接口和Promise接口。
|
||||
|
||||
## Version 1.0.4
|
||||
|
||||
2016年4月1日
|
||||
|
||||
* 使編譯時的腳本兼容Python 3。
|
||||
* 修正Visual C++ 2015的編譯問題。
|
||||
* 增補臺灣、香港地區用字用詞轉換。
|
||||
* 更新nan以修正Node.js擴展編譯兼容性問題。
|
||||
|
||||
## Version 1.0.3
|
||||
|
||||
2015年7月22日
|
||||
|
||||
* 添加化學元素臺灣用字轉換。
|
||||
* 增補100餘組缺失的簡繁轉換字對。
|
||||
* 增補香港標準字。
|
||||
* 使用nan解決Node.js擴展編譯兼容性問題。
|
||||
* 命令行轉換工具支持就地轉換。
|
||||
* 測試框架遷移到GTest。
|
||||
* 修正Visual C++的編譯問題。
|
||||
* 實現無詞典詞彙抽取和分詞算法。
|
||||
* 優化轉換性能。
|
||||
|
||||
## Version 1.0.2
|
||||
|
||||
2014年11月8日
|
||||
|
||||
* 修正C語言接口的編譯錯誤問題
|
||||
* 修正默認簡繁轉換文件名錯誤問題
|
||||
* `DictEntry`增加`Values()`方法
|
||||
|
||||
## Version 1.0.1
|
||||
|
||||
2014年10月18日
|
||||
|
||||
* 使用C++11完全重寫OpenCC
|
||||
* 修復大量轉換錯誤
|
||||
* 增加香港繁體轉換
|
||||
|
||||
## Version 0.4.3
|
||||
|
||||
2013年5月17日
|
||||
|
||||
* 增加接口`opencc_convert_utf8_free`
|
||||
* 修正Node.js插件內存泄漏問題
|
||||
* 修正Windows下獲取當前目錄的問題
|
||||
|
||||
## Version 0.4.2
|
||||
|
||||
2013年4月14日
|
||||
|
||||
* 修正「阪」、「薰」繁簡轉換
|
||||
* 增加四對缺失的簡繁轉換
|
||||
* 增加API文檔,由Doxygen生成
|
||||
* 重構大量代碼
|
||||
|
||||
## Version 0.4.1
|
||||
|
||||
2013年3月21日
|
||||
|
||||
* 修正Node.js 0.10兼容性問題。
|
||||
* 從Unihan數據庫增加若干缺失的簡繁轉換單字。
|
||||
|
||||
## Version 0.4.0
|
||||
|
||||
2013年3月2日
|
||||
|
||||
* 修正「雕」「谥」「峯」轉換,新增數百條臺灣科技詞彙。
|
||||
* 修正命令行-h錯誤。
|
||||
* 修正長行讀取錯誤。
|
||||
* 修正錯誤類型拼寫錯誤。
|
||||
* 修正UTF-8編碼轉換錯誤。
|
||||
* 自動跳過UTF-8的BOM。
|
||||
* 修正配置和數據文件相對路徑問題。
|
||||
* 增加了gyp編譯系統。
|
||||
* 增加了Node.js接口。
|
||||
|
||||
## Version 0.3.0
|
||||
|
||||
2011年12月2日
|
||||
|
||||
* 增加中國大陸、臺灣地區異體字和習慣用詞轉換功能。
|
||||
* 修正詞典轉換鏈爲奇數時的緩衝區複製Bug。
|
||||
* 修正Big Endian平臺上的UTF-8轉換錯誤。
|
||||
* 修正「齣」「薑」詞組的問題。
|
||||
* 修正「钁」「卷」「干」「薰」「糉」「蝨」「麺」。
|
||||
* 增加「綑」到「捆」的繁簡轉換。
|
||||
* 增加「跡」「蹟」對立。
|
||||
* 增加「夫」「伕」對立。
|
||||
* 增加「毀」「譭」「燬」對立。
|
||||
* 增加「背」「揹」對立。
|
||||
|
||||
## Version 0.2.0
|
||||
|
||||
2010年12月23日
|
||||
|
||||
* 取消libopencc對iconv的依賴。
|
||||
* 增加UTF8編碼格式錯誤時提示信息。
|
||||
* 重構Python封裝。
|
||||
* 修正讀取一行長度超過緩衝區時的UTF8截斷錯誤。
|
||||
* 使用CMake代替Autotools構建編譯框架。
|
||||
* 修正包括「拿不準」在內諸多簡繁轉換問題。
|
||||
|
||||
## Version 0.1.2
|
||||
|
||||
2010年9月16日
|
||||
|
||||
* 增加「僅分詞」和「顯示多重候選字詞」的轉換接口。
|
||||
* 改進辭典文件的結構。
|
||||
* 修正轉換緩衝區永遠不足的Bug。
|
||||
* 修正多辭典轉換時略過某個辭典的Bug。
|
||||
* 修正輸入爲空時轉換的Bug。
|
||||
* 改進opencc命令行工具參數提示和幫助。
|
||||
|
||||
## Version 0.1.1
|
||||
|
||||
2010年8月10日
|
||||
|
||||
* 增加簡繁混雜到簡體或繁體的轉換。
|
||||
* 增加多詞典/詞典組的轉換支持。
|
||||
* 修正big endian平臺上的兼容性問題。
|
||||
* 修正apple平臺下編譯iconv依賴的問題。
|
||||
* 修正辭典中詞條長度長度不相等時轉換錯誤的Bug。
|
||||
* 重構辭典代碼抽象。
|
||||
* 增加編譯時的測試。
|
||||
* 分離辭典爲字典和詞典。
|
||||
|
||||
## Version 0.1.0
|
||||
|
||||
2010年7月28日
|
||||
|
||||
* 修正文件名緩衝區不足的Bug。
|
||||
* libopencc版本更新至1.0.0。
|
||||
* 分離臺灣特有的繁簡轉換「著」「么」。
|
||||
* 修改「众」「教」「查」「污」對應默認異體。
|
||||
* 加入「齧啮」「灩滟」繁簡轉換。
|
||||
* 增加「岳嶽」一簡對多繁轉換。
|
||||
* 隱藏不必要的類型,更新接口註釋。
|
||||
|
||||
## Version 0.0.5
|
||||
|
||||
2010年7月21日
|
||||
|
||||
* 修正`wchar_t`兼容性問題,使用`ucs4`。
|
||||
* 增加Windows移植分支。
|
||||
* 修正一個文件名緩衝區分配的問題。
|
||||
* 增加「囉」「溼」「廕」「彷」「徵」繁簡轉換。
|
||||
|
||||
## Version 0.0.4
|
||||
|
||||
2010年7月16日
|
||||
|
||||
* 增加「卹」「牴」「皁」「羶」「薹」等轉換。
|
||||
* 精簡辭典中大量不必要的數詞(含「千」「萬」)。
|
||||
* 修正最短路徑分詞時優先後向匹配的實現問題。
|
||||
* 修正辭典加載兼容性問題,當無法mmap時直接申請內存。
|
||||
* 修正C++接口在64位平臺下編譯的問題。
|
||||
|
||||
## Version 0.0.3
|
||||
|
||||
2010年6月22日
|
||||
|
||||
* 加入繁體到簡體的轉換。
|
||||
* 增加提示信息的中文翻譯,使用`GNU Gettext`。
|
||||
* 增加辭典配置文件支持。
|
||||
* 修正一些兼容性Bug。
|
||||
|
||||
## Version 0.0.2
|
||||
|
||||
2010年6月19日
|
||||
|
||||
* 分離詞庫。
|
||||
* 增加平面文件詞庫讀取的支持。
|
||||
* 增加平面文件詞庫到`Datrie`詞庫的轉換工具`opencc_dict`。
|
||||
* 提供UTF8文本直接轉換的接口。
|
||||
|
||||
## Version 0.0.1
|
||||
|
||||
2010年6月11日
|
||||
|
||||
* OpenCC初始版本釋出。
|
||||
* 支持簡繁轉換。
|
|
@ -1,277 +0,0 @@
|
|||
# Open Chinese Convert 開放中文轉換
|
||||
|
||||
[](https://travis-ci.org/BYVoid/OpenCC)
|
||||
[](https://ci.appveyor.com/project/Carbo/OpenCC)
|
||||
[](https://github.com/BYVoid/OpenCC/actions?query=workflow%3A%22Python+package%22)
|
||||
|
||||
## Introduction 介紹
|
||||
|
||||

|
||||
|
||||
Open Chinese Convert (OpenCC, 開放中文轉換) is an opensource project for conversions between Traditional Chinese, Simplified Chinese and Japanese Kanji (Shinjitai). It supports character-level and phrase-level conversion, character variant conversion and regional idioms among Mainland China, Taiwan and Hong Kong. This is not translation tool between Mandarin and Cantonese, etc.
|
||||
|
||||
中文簡繁轉換開源項目,支持詞彙級別的轉換、異體字轉換和地區習慣用詞轉換(中國大陸、臺灣、香港、日本新字體)。不提供普通話與粵語的轉換。
|
||||
|
||||
Discussion (Telegram): https://t.me/open_chinese_convert
|
||||
|
||||
### Features 特點
|
||||
|
||||
* 嚴格區分「一簡對多繁」和「一簡對多異」。
|
||||
* 完全兼容異體字,可以實現動態替換。
|
||||
* 嚴格審校一簡對多繁詞條,原則爲「能分則不合」。
|
||||
* 支持中國大陸、臺灣、香港異體字和地區習慣用詞轉換,如「裏」「裡」、「鼠標」「滑鼠」。
|
||||
* 詞庫和函數庫完全分離,可以自由修改、導入、擴展。
|
||||
|
||||
## Installation 安裝
|
||||
|
||||
See [Download](https://github.com/BYVoid/OpenCC/wiki/Download).
|
||||
|
||||
## Usage 使用
|
||||
|
||||
### Online demo 線上轉換展示
|
||||
|
||||
Warning: **This is NOT an API.** You will be banned if you make calls programmatically.
|
||||
|
||||
https://opencc.byvoid.com/
|
||||
|
||||
### Node.js
|
||||
|
||||
[npm](https://www.npmjs.com/opencc) `npm install opencc`
|
||||
|
||||
#### JavaScript
|
||||
```js
|
||||
const OpenCC = require('opencc');
|
||||
const converter = new OpenCC('s2t.json');
|
||||
converter.convertPromise("汉字").then(converted => {
|
||||
console.log(converted); // 漢字
|
||||
});
|
||||
```
|
||||
|
||||
#### TypeScript
|
||||
```ts
|
||||
import { OpenCC } from 'opencc';
|
||||
async function main() {
|
||||
const converter: OpenCC = new OpenCC('s2t.json');
|
||||
const result: string = await converter.convertPromise('汉字');
|
||||
console.log(result);
|
||||
}
|
||||
```
|
||||
|
||||
See [demo.js](https://github.com/BYVoid/OpenCC/blob/master/node/demo.js) and [ts-demo.ts](https://github.com/BYVoid/OpenCC/blob/master/node/ts-demo.ts).
|
||||
|
||||
### Python
|
||||
|
||||
[PyPI](https://pypi.org/project/OpenCC/) `pip install opencc` (Windows, Linux, Mac)
|
||||
|
||||
```python
|
||||
import opencc
|
||||
converter = opencc.OpenCC('s2t.json')
|
||||
converter.convert('汉字') # 漢字
|
||||
```
|
||||
|
||||
### C++
|
||||
|
||||
```c++
|
||||
#include "opencc.h"
|
||||
|
||||
int main() {
|
||||
const SimpleConverter converter("s2t.json");
|
||||
converter.Convert("汉字"); // 漢字
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
### C
|
||||
|
||||
```c
|
||||
#include "opencc.h"
|
||||
|
||||
int main() {
|
||||
opencc_t opencc = opencc_open("s2t.json");
|
||||
const char* input = "汉字";
|
||||
char* converted = opencc_convert_utf8(opencc, input, strlen(input)); // 漢字
|
||||
opencc_convert_utf8_free(converted);
|
||||
opencc_close(opencc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Document 文檔: https://byvoid.github.io/OpenCC/
|
||||
|
||||
### Command Line
|
||||
|
||||
* `opencc --help`
|
||||
* `opencc_dict --help`
|
||||
* `opencc_phrase_extract --help`
|
||||
|
||||
### Others (Unofficial)
|
||||
|
||||
* Swift (iOS): [SwiftyOpenCC](https://github.com/XQS6LB3A/SwiftyOpenCC)
|
||||
* Java: [opencc4j](https://github.com/houbb/opencc4j)
|
||||
* Android: [android-opencc](https://github.com/qichuan/android-opencc)
|
||||
* PHP: [opencc4php](https://github.com/nauxliu/opencc4php)
|
||||
* Pure JavaScript: [opencc-js](https://github.com/nk2028/opencc-js)
|
||||
* WebAssembly: [wasm-opencc](https://github.com/oyyd/wasm-opencc)
|
||||
|
||||
### Configurations 配置文件
|
||||
|
||||
#### 預設配置文件
|
||||
|
||||
* `s2t.json` Simplified Chinese to Traditional Chinese 簡體到繁體
|
||||
* `t2s.json` Traditional Chinese to Simplified Chinese 繁體到簡體
|
||||
* `s2tw.json` Simplified Chinese to Traditional Chinese (Taiwan Standard) 簡體到臺灣正體
|
||||
* `tw2s.json` Traditional Chinese (Taiwan Standard) to Simplified Chinese 臺灣正體到簡體
|
||||
* `s2hk.json` Simplified Chinese to Traditional Chinese (Hong Kong variant) 簡體到香港繁體
|
||||
* `hk2s.json` Traditional Chinese (Hong Kong variant) to Simplified Chinese 香港繁體到簡體
|
||||
* `s2twp.json` Simplified Chinese to Traditional Chinese (Taiwan Standard) with Taiwanese idiom 簡體到繁體(臺灣正體標準)並轉換爲臺灣常用詞彙
|
||||
* `tw2sp.json` Traditional Chinese (Taiwan Standard) to Simplified Chinese with Mainland Chinese idiom 繁體(臺灣正體標準)到簡體並轉換爲中國大陸常用詞彙
|
||||
* `t2tw.json` Traditional Chinese (OpenCC Standard) to Taiwan Standard 繁體(OpenCC 標準)到臺灣正體
|
||||
* `hk2t.json` Traditional Chinese (Hong Kong variant) to Traditional Chinese 香港繁體到繁體(OpenCC 標準)
|
||||
* `t2hk.json` Traditional Chinese (OpenCC Standard) to Hong Kong variant 繁體(OpenCC 標準)到香港繁體
|
||||
* `t2jp.json` Traditional Chinese Characters (Kyūjitai) to New Japanese Kanji (Shinjitai) 繁體(OpenCC 標準,舊字體)到日文新字體
|
||||
* `jp2t.json` New Japanese Kanji (Shinjitai) to Traditional Chinese Characters (Kyūjitai) 日文新字體到繁體(OpenCC 標準,舊字體)
|
||||
* `tw2t.json` Traditional Chinese (Taiwan standard) to Traditional Chinese 臺灣正體到繁體(OpenCC 標準)
|
||||
|
||||
## Build 編譯
|
||||
|
||||
### Build with CMake
|
||||
|
||||
#### Linux & Mac OS X
|
||||
|
||||
g++ 4.6+ or clang 3.2+ is required.
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
#### Windows Visual Studio:
|
||||
|
||||
```bash
|
||||
build.cmd
|
||||
```
|
||||
|
||||
### Test 測試
|
||||
|
||||
#### Linux & Mac OS X
|
||||
|
||||
```
|
||||
make test
|
||||
```
|
||||
|
||||
#### Windows Visual Studio:
|
||||
|
||||
```bash
|
||||
test.cmd
|
||||
```
|
||||
|
||||
### Benchmark 基準測試
|
||||
|
||||
```
|
||||
make benchmark
|
||||
```
|
||||
|
||||
Example results (from Github CI):
|
||||
|
||||
```
|
||||
1: ------------------------------------------------------------------
|
||||
1: Benchmark Time CPU Iterations
|
||||
1: ------------------------------------------------------------------
|
||||
1: BM_Initialization/hk2s 1.56 ms 1.56 ms 442
|
||||
1: BM_Initialization/hk2t 0.144 ms 0.144 ms 4878
|
||||
1: BM_Initialization/jp2t 0.260 ms 0.260 ms 2604
|
||||
1: BM_Initialization/s2hk 23.8 ms 23.8 ms 29
|
||||
1: BM_Initialization/s2t 25.6 ms 25.6 ms 28
|
||||
1: BM_Initialization/s2tw 24.0 ms 23.9 ms 30
|
||||
1: BM_Initialization/s2twp 24.6 ms 24.6 ms 28
|
||||
1: BM_Initialization/t2hk 0.052 ms 0.052 ms 12897
|
||||
1: BM_Initialization/t2jp 0.141 ms 0.141 ms 5012
|
||||
1: BM_Initialization/t2s 1.30 ms 1.30 ms 540
|
||||
1: BM_Initialization/tw2s 1.39 ms 1.39 ms 529
|
||||
1: BM_Initialization/tw2sp 1.69 ms 1.69 ms 426
|
||||
1: BM_Initialization/tw2t 0.089 ms 0.089 ms 7707
|
||||
1: BM_Convert2M 582 ms 582 ms 1
|
||||
1: BM_Convert/100 1.07 ms 1.07 ms 636
|
||||
1: BM_Convert/1000 11.0 ms 11.0 ms 67
|
||||
1: BM_Convert/10000 113 ms 113 ms 6
|
||||
1: BM_Convert/100000 1176 ms 1176 ms 1
|
||||
```
|
||||
|
||||
## Projects using OpenCC 使用 OpenCC 的項目
|
||||
|
||||
* [ibus-pinyin](https://github.com/ibus/ibus-pinyin)
|
||||
* [fcitx](https://github.com/fcitx/fcitx)
|
||||
* [rimeime](https://rime.im/)
|
||||
* [libgooglepinyin](http://code.google.com/p/libgooglepinyin/)
|
||||
* [ibus-libpinyin](https://github.com/libpinyin/ibus-libpinyin)
|
||||
* [alfred-chinese-converter](https://github.com/amowu/alfred-chinese-converter)
|
||||
* [GoldenDict](https://github.com/goldendict/goldendict)
|
||||
|
||||
## License 許可協議
|
||||
|
||||
Apache License 2.0
|
||||
|
||||
## Third Party Library 第三方庫
|
||||
|
||||
* [darts-clone](https://github.com/s-yata/darts-clone) BSD License
|
||||
* [marisa-trie](https://github.com/s-yata/marisa-trie) BSD License
|
||||
* [tclap](http://tclap.sourceforge.net/) MIT License
|
||||
* [rapidjson](https://github.com/Tencent/rapidjson) MIT License
|
||||
* [Google Test](https://github.com/google/googletest) BSD License
|
||||
|
||||
All these libraries are statically linked by default.
|
||||
|
||||
## Change History 版本歷史
|
||||
|
||||
* [NEWS](https://github.com/BYVoid/OpenCC/blob/master/NEWS.md)
|
||||
|
||||
### Links 相關鏈接
|
||||
|
||||
* Introduction 詳細介紹 https://github.com/BYVoid/OpenCC/wiki/%E7%B7%A3%E7%94%B1
|
||||
* 現代漢語常用簡繁一對多字義辨析表 http://ytenx.org/byohlyuk/KienxPyan
|
||||
|
||||
## Contributors 貢獻者
|
||||
|
||||
* [BYVoid](http://www.byvoid.com/)
|
||||
* [佛振](https://github.com/lotem)
|
||||
* [Peng Huang](https://github.com/phuang)
|
||||
* [LI Daobing](https://github.com/lidaobing)
|
||||
* [Kefu Chai](https://github.com/tchaikov)
|
||||
* [Kan-Ru Chen](http://kanru.info/)
|
||||
* [Ma Xiaojun](https://twitter.com/damage3025)
|
||||
* [Jiang Jiang](http://jjgod.org/)
|
||||
* [Ruey-Cheng Chen](https://github.com/rueycheng)
|
||||
* [Paul Meng](http://home.mno2.org/)
|
||||
* [Lawrence Lau](https://github.com/ktslwy)
|
||||
* [瑾昀](https://github.com/kunki)
|
||||
* [內木一郎](https://github.com/SyaoranHinata)
|
||||
* [Marguerite Su](https://www.marguerite.su/)
|
||||
* [Brian White](http://mscdex.net)
|
||||
* [Qijiang Fan](https://fqj.me/)
|
||||
* [LEOYoon-Tsaw](https://github.com/LEOYoon-Tsaw)
|
||||
* [Steven Yao](https://github.com/stevenyao)
|
||||
* [Pellaeon Lin](https://github.com/pellaeon)
|
||||
* [stony](https://github.com/stony-shixz)
|
||||
* [steelywing](https://github.com/steelywing)
|
||||
* [吕旭东](https://github.com/lvxudong)
|
||||
* [Weng Xuetian](https://github.com/wengxt)
|
||||
* [Ma Tao](https://github.com/iwater)
|
||||
* [Heinz Wiesinger](https://github.com/pprkut)
|
||||
* [J.W](https://github.com/jakwings)
|
||||
* [Amo Wu](https://github.com/amowu)
|
||||
* [Mark Tsai](https://github.com/mxgit1090)
|
||||
* [Zhe Wang](https://github.com/0x1997)
|
||||
* [sgqy](https://github.com/sgqy)
|
||||
* [Qichuan (Sean) ZHANG](https://github.com/qichuan)
|
||||
* [Flandre Scarlet](https://github.com/XadillaX)
|
||||
* [宋辰文](https://github.com/songchenwen)
|
||||
* [iwater](https://github.com/iwater)
|
||||
* [Xpol Wan](https://github.com/xpol)
|
||||
* [Weihang Lo](https://github.com/weihanglo)
|
||||
* [Cychih](https://github.com/pi314)
|
||||
* [kyleskimo](https://github.com/kyleskimo)
|
||||
* [Ryuan Choi](https://github.com/bunhere)
|
||||
* [Tony Able](https://github.com/TonyAble)
|
||||
* [Xiao Liang](https://github.com/yxliang01)
|
||||
|
||||
Please update this list you have contributed OpenCC.
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"includes": [
|
||||
"node/global.gypi",
|
||||
"node/configs.gypi",
|
||||
"node/dicts.gypi",
|
||||
"node/node_opencc.gypi",
|
||||
]
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
cmake -S. -Bbuild -DCMAKE_INSTALL_PREFIX:PATH=.
|
||||
cmake --build build --config Release --target install
|
|
@ -1,186 +0,0 @@
|
|||
find_package(PythonInterp REQUIRED)
|
||||
|
||||
set(OPENCC_DICT_BIN opencc_dict)
|
||||
set(DICT_MERGE_BIN "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/merge.py")
|
||||
set(DICT_REVERSE_BIN "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/reverse.py")
|
||||
set(DICT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dictionary)
|
||||
set(DICT_GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(
|
||||
DICTS_RAW
|
||||
STCharacters
|
||||
STPhrases
|
||||
TSCharacters
|
||||
TSPhrases
|
||||
TWVariants
|
||||
TWVariantsRevPhrases
|
||||
HKVariants
|
||||
HKVariantsRevPhrases
|
||||
JPVariants
|
||||
JPShinjitaiCharacters
|
||||
JPShinjitaiPhrases
|
||||
)
|
||||
|
||||
set(
|
||||
DICTS_GENERATED
|
||||
TWPhrases
|
||||
TWPhrasesRev
|
||||
TWVariantsRev
|
||||
HKVariantsRev
|
||||
JPVariantsRev
|
||||
)
|
||||
|
||||
set(DICTS ${DICTS_RAW} ${DICTS_GENERATED})
|
||||
|
||||
foreach(DICT ${DICTS})
|
||||
set(DICT_TARGETS ${DICT_TARGETS} ${DICT}.ocd2)
|
||||
endforeach(DICT)
|
||||
|
||||
add_custom_target(
|
||||
Dictionaries
|
||||
ALL
|
||||
DEPENDS
|
||||
${DICT_TARGETS}
|
||||
)
|
||||
|
||||
foreach(DICT ${DICTS_RAW})
|
||||
set(DICT_${DICT}_INPUT ${DICT_DIR}/${DICT}.txt)
|
||||
endforeach(DICT)
|
||||
|
||||
foreach(DICT ${DICTS_GENERATED})
|
||||
set(DICT_${DICT}_INPUT ${DICT_GENERATED_DIR}/${DICT}.txt)
|
||||
endforeach(DICT)
|
||||
|
||||
set(
|
||||
DICT_TWPhrases_GENERATING_INPUT
|
||||
${DICT_DIR}/TWPhrasesIT.txt
|
||||
${DICT_DIR}/TWPhrasesName.txt
|
||||
${DICT_DIR}/TWPhrasesOther.txt
|
||||
)
|
||||
set(
|
||||
DICT_TWPhrases_GENERATING_COMMAND
|
||||
${DICT_MERGE_BIN} ${DICT_TWPhrases_GENERATING_INPUT} TWPhrases.txt
|
||||
)
|
||||
|
||||
set(
|
||||
DICT_TWVariantsRev_GENERATING_INPUT
|
||||
${DICT_DIR}/TWVariants.txt
|
||||
)
|
||||
set(
|
||||
DICT_TWVariantsRev_GENERATING_COMMAND
|
||||
${DICT_REVERSE_BIN} ${DICT_TWVariantsRev_GENERATING_INPUT} TWVariantsRev.txt
|
||||
)
|
||||
|
||||
set(
|
||||
DICT_TWPhrasesRev_GENERATING_INPUT
|
||||
${DICT_GENERATED_DIR}/TWPhrases.txt
|
||||
)
|
||||
set(
|
||||
DICT_TWPhrasesRev_GENERATING_COMMAND
|
||||
${DICT_REVERSE_BIN} ${DICT_TWPhrasesRev_GENERATING_INPUT} TWPhrasesRev.txt
|
||||
)
|
||||
|
||||
set(
|
||||
DICT_HKVariantsRev_GENERATING_INPUT
|
||||
${DICT_DIR}/HKVariants.txt
|
||||
)
|
||||
set(
|
||||
DICT_HKVariantsRev_GENERATING_COMMAND
|
||||
${DICT_REVERSE_BIN} ${DICT_HKVariantsRev_GENERATING_INPUT} HKVariantsRev.txt
|
||||
)
|
||||
|
||||
set(
|
||||
DICT_JPVariantsRev_GENERATING_INPUT
|
||||
${DICT_DIR}/JPVariants.txt
|
||||
)
|
||||
set(
|
||||
DICT_JPVariantsRev_GENERATING_COMMAND
|
||||
${DICT_REVERSE_BIN} ${DICT_JPVariantsRev_GENERATING_INPUT} JPVariantsRev.txt
|
||||
)
|
||||
|
||||
foreach(DICT ${DICTS_GENERATED})
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${DICT}.txt
|
||||
COMMENT
|
||||
"Generating ${DICT}.txt"
|
||||
COMMAND
|
||||
${DICT_${DICT}_GENERATING_COMMAND}
|
||||
DEPENDS
|
||||
${DICT_${DICT}_GENERATING_INPUT}
|
||||
)
|
||||
set_directory_properties(
|
||||
PROPERTIES
|
||||
ADDITIONAL_MAKE_CLEAN_FILES
|
||||
"${DICT_GENERATED_DIR}/${DICT}.txt"
|
||||
)
|
||||
endforeach(DICT)
|
||||
|
||||
add_custom_target(
|
||||
copy_libopencc_to_dir_of_opencc_dict
|
||||
COMMENT
|
||||
"Copying libopencc to directory of opencc_dict"
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy "$<TARGET_FILE:libopencc>" "$<TARGET_FILE_DIR:${OPENCC_DICT_BIN}>"
|
||||
)
|
||||
if (WIN32)
|
||||
set(DICT_WIN32_DEPENDS copy_libopencc_to_dir_of_opencc_dict)
|
||||
else()
|
||||
set(DICT_WIN32_DEPENDS)
|
||||
endif()
|
||||
|
||||
foreach(DICT ${DICTS})
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${DICT}.ocd2
|
||||
COMMENT
|
||||
"Building ${DICT}.ocd2"
|
||||
COMMAND
|
||||
${OPENCC_DICT_BIN}
|
||||
--input ${DICT_${DICT}_INPUT}
|
||||
--output ${DICT}.ocd2
|
||||
--from text
|
||||
--to ocd2
|
||||
DEPENDS
|
||||
${DICT_WIN32_DEPENDS}
|
||||
${OPENCC_DICT_BIN}
|
||||
${DICT_${DICT}_INPUT}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${DICT_GENERATED_DIR}/${DICT}.ocd2
|
||||
DESTINATION
|
||||
${DIR_SHARE_OPENCC}
|
||||
)
|
||||
|
||||
set_directory_properties(
|
||||
PROPERTIES
|
||||
ADDITIONAL_MAKE_CLEAN_FILES
|
||||
"${DICT_GENERATED_DIR}/${DICT}.ocd2"
|
||||
)
|
||||
endforeach(DICT)
|
||||
|
||||
set(CONFIG_FILES
|
||||
config/hk2s.json
|
||||
config/hk2t.json
|
||||
config/jp2t.json
|
||||
config/s2hk.json
|
||||
config/s2t.json
|
||||
config/s2tw.json
|
||||
config/s2twp.json
|
||||
config/t2hk.json
|
||||
config/t2jp.json
|
||||
config/t2s.json
|
||||
config/t2tw.json
|
||||
config/tw2s.json
|
||||
config/tw2sp.json
|
||||
config/tw2t.json
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${CONFIG_FILES}
|
||||
DESTINATION
|
||||
${DIR_SHARE_OPENCC}
|
||||
)
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese (Hong Kong variant) to Simplified Chinese",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TSPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "HKVariantsRevPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "HKVariantsRev.ocd2"
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "TSPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "TSCharacters.ocd2"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese (Hong Kong variant) to Traditional Chinese",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "HKVariantsRevPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "HKVariantsRevPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "HKVariantsRev.ocd2"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"name": "New Japanese Kanji (Shinjitai) to Traditional Chinese Characters (Kyūjitai)",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "JPShinjitaiPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "JPShinjitaiPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "JPShinjitaiCharacters.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "JPVariantsRev.ocd2"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"name": "Simplified Chinese to Traditional Chinese (Hong Kong variant)",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "STPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "STPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "STCharacters.ocd2"
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "HKVariants.ocd2"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"name": "Simplified Chinese to Traditional Chinese",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "STPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "STPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "STCharacters.ocd2"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"name": "Simplified Chinese to Traditional Chinese (Taiwan standard)",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "STPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "STPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "STCharacters.ocd2"
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariants.ocd2"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"name": "Simplified Chinese to Traditional Chinese (Taiwan standard, with phrases)",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "STPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "STPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "STCharacters.ocd2"
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TWPhrases.ocd2"
|
||||
}
|
||||
}, {
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariants.ocd2"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese to Traditional Chinese (Hong Kong variant)",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "HKVariants.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "HKVariants.ocd2"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese Characters (Kyūjitai) to New Japanese Kanji (Shinjitai)",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "JPVariants.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "JPVariants.ocd2"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese to Simplified Chinese",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TSPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "TSPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "TSCharacters.ocd2"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese to Traditional Chinese (Taiwan standard)",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariants.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariants.ocd2"
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese (Taiwan standard) to Simplified Chinese",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TSPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "TWVariantsRevPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariantsRev.ocd2"
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "TSPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "TSCharacters.ocd2"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese (Taiwan standard) to Simplified Chinese (with phrases)",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TSPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "TWPhrasesRev.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariantsRevPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariantsRev.ocd2"
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "TSPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "TSCharacters.ocd2"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"name": "Traditional Chinese (Taiwan standard) to Traditional Chinese",
|
||||
"segmentation": {
|
||||
"type": "mmseg",
|
||||
"dict": {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariantsRevPhrases.ocd2"
|
||||
}
|
||||
},
|
||||
"conversion_chain": [{
|
||||
"dict": {
|
||||
"type": "group",
|
||||
"dicts": [{
|
||||
"type": "ocd2",
|
||||
"file": "TWVariantsRevPhrases.ocd2"
|
||||
}, {
|
||||
"type": "ocd2",
|
||||
"file": "TWVariantsRev.ocd2"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
僞 偽
|
||||
兌 兑
|
||||
叄 叁
|
||||
只 只 衹
|
||||
啓 啓 啟
|
||||
喫 吃
|
||||
囪 囱
|
||||
妝 妝 粧
|
||||
媼 媪
|
||||
嬀 媯
|
||||
悅 悦
|
||||
慍 愠
|
||||
戶 户
|
||||
挩 捝
|
||||
搵 揾
|
||||
擡 抬
|
||||
敓 敚
|
||||
敘 敍 敘
|
||||
柺 枴
|
||||
梲 棁
|
||||
棱 稜 棱
|
||||
榲 榅
|
||||
檯 枱
|
||||
氳 氲
|
||||
涗 涚
|
||||
溫 温
|
||||
溼 濕
|
||||
潙 溈
|
||||
潨 潀
|
||||
熅 煴
|
||||
爲 為
|
||||
癡 痴
|
||||
皁 皂
|
||||
祕 秘
|
||||
稅 税
|
||||
竈 灶
|
||||
糉 粽 糉 糭
|
||||
縕 緼
|
||||
纔 才
|
||||
脣 唇
|
||||
脫 脱
|
||||
膃 腽
|
||||
臥 卧
|
||||
臺 台
|
||||
菸 煙
|
||||
蒕 蒀
|
||||
蔥 葱
|
||||
蔿 蒍
|
||||
蘊 藴
|
||||
蛻 蜕
|
||||
衆 眾
|
||||
衛 衞
|
||||
覈 核
|
||||
說 説
|
||||
踊 踴
|
||||
轀 輼
|
||||
醞 醖
|
||||
鉢 缽
|
||||
鉤 鈎
|
||||
銳 鋭
|
||||
鍼 針
|
||||
閱 閲
|
||||
鰮 鰛
|
|
@ -1,156 +0,0 @@
|
|||
一口吃個 一口喫個
|
||||
一口吃成 一口喫成
|
||||
一家三口 一家三口
|
||||
一家五口 一家五口
|
||||
一家六口 一家六口
|
||||
一家四口 一家四口
|
||||
七星巖 七星巖
|
||||
世胄 世胄
|
||||
介胄 介冑
|
||||
傅巖 傅巖
|
||||
免胄 免冑
|
||||
冠胄 冠冑
|
||||
千巖競秀 千巖競秀
|
||||
千巖萬壑 千巖萬壑
|
||||
千巖萬谷 千巖萬谷
|
||||
口吃 口吃
|
||||
台山 台山
|
||||
台州 台州
|
||||
台州地區 台州地區
|
||||
台州市 台州市
|
||||
吃口 喫口 吃口
|
||||
吃口令 吃口令
|
||||
吃口飯 喫口飯
|
||||
吃吃 喫喫 吃吃
|
||||
吃子 喫子 吃子
|
||||
名胄 名胄
|
||||
國胄 國胄
|
||||
圍巖 圍巖
|
||||
地胄 地胄
|
||||
壓胄子 壓冑子
|
||||
士胄 士胄
|
||||
大巖桐 大巖桐
|
||||
天台女 天台女
|
||||
天台宗 天台宗
|
||||
天台山 天台山
|
||||
天台縣 天台縣
|
||||
天潢貴胄 天潢貴胄
|
||||
奇巖 奇巖
|
||||
寶胄 寶胄
|
||||
小巖洞 小巖洞
|
||||
岫巖縣 岫巖縣
|
||||
峯巖 峯巖
|
||||
嵌巖 嵌巖
|
||||
巉巖 巉巖
|
||||
巖壁 巖壁
|
||||
巖居 巖居
|
||||
巖居穴處 巖居穴處
|
||||
巖居谷飲 巖居谷飲
|
||||
巖岸 巖岸
|
||||
巖巉 巖巉
|
||||
巖巖 巖巖
|
||||
巖徼 巖徼
|
||||
巖手縣 巖手縣
|
||||
巖村 巖村
|
||||
巖洞 巖洞
|
||||
巖流圈 巖流圈
|
||||
巖牆 巖牆
|
||||
巖牆之下 巖牆之下
|
||||
巖畫 巖畫
|
||||
巖穴 巖穴
|
||||
巖穴之士 巖穴之士
|
||||
巖薔薇 巖薔薇
|
||||
巖邑 巖邑
|
||||
巖郎 巖郎
|
||||
巖阻 巖阻
|
||||
巖陛 巖陛
|
||||
帝胄 帝胄
|
||||
幽巖 幽巖
|
||||
幽棲巖谷 幽棲巖谷
|
||||
張口 張口
|
||||
懸巖 懸巖
|
||||
懸巖峭壁 懸巖峭壁
|
||||
懸胄 懸冑
|
||||
攀巖 攀巖
|
||||
支胄 支胄
|
||||
教胄 教胄
|
||||
景胄 景胄
|
||||
望胄 望胄
|
||||
末胄 末胄
|
||||
村胄 村胄
|
||||
枕巖漱流 枕巖漱流
|
||||
枝胄 枝胄
|
||||
氏胄 氏胄
|
||||
洪胄 洪胄
|
||||
浙江天台縣 浙江天台縣
|
||||
清胄 清胄
|
||||
灰巖殘丘 灰巖殘丘
|
||||
玄胄 玄胄
|
||||
甲胄 甲冑
|
||||
甲胄魚類 甲冑魚類
|
||||
皇胄 皇胄
|
||||
石灰巖洞 石灰巖洞
|
||||
神胄 神胄
|
||||
簪纓世胄 簪纓世胄
|
||||
系胄 系胄
|
||||
紅巖 紅巖
|
||||
絕巖 絕巖
|
||||
緒胄 緒胄
|
||||
纂胄 纂胄
|
||||
胃口 胃口
|
||||
胄嗣 胄嗣
|
||||
胄子 胄子
|
||||
胄序 胄序
|
||||
胄族 胄族
|
||||
胄甲 冑甲
|
||||
胄監 胄監
|
||||
胄科 冑科
|
||||
胄緒 胄緒
|
||||
胄胤 胄胤
|
||||
胄裔 胄裔
|
||||
胄裔繁衍 胄裔繁衍
|
||||
胄閥 胄閥
|
||||
胡雪巖 胡雪巖
|
||||
胤胄 胤胄
|
||||
苗胄 苗胄
|
||||
英胄 英胄
|
||||
華胄 華胄
|
||||
血胄 血胄
|
||||
裔胄 裔胄
|
||||
訓胄 訓胄
|
||||
試胄 試胄
|
||||
豪門貴胄 豪門貴胄
|
||||
貝胄 貝冑
|
||||
貴胄 貴胄
|
||||
賢胄 賢胄
|
||||
蹇吃 蹇吃
|
||||
躬擐甲胄 躬擐甲冑
|
||||
遐胄 遐胄
|
||||
遙胄 遙胄
|
||||
遙遙華胄 遙遙華胄
|
||||
遠胄 遠胄
|
||||
遺胄 遺胄
|
||||
鄧艾吃 鄧艾吃
|
||||
重巖疊嶂 重巖疊嶂
|
||||
金胄 金胄
|
||||
鎧胄 鎧冑
|
||||
鑿巖 鑿巖
|
||||
門胄 門胄
|
||||
開口 開口
|
||||
雲巖區 雲巖區
|
||||
非層巖 非層巖
|
||||
韓侂胄 韓侂冑
|
||||
飮胄 飮冑
|
||||
骨巖巖 骨巖巖
|
||||
高胄 高胄
|
||||
魚胄 魚冑
|
||||
鮮胄 鮮胄
|
||||
鴻胄 鴻胄
|
||||
黃巖區 黃巖區
|
||||
黃巖島 黃巖島
|
||||
黃炎貴胄 黃炎貴胄
|
||||
齒胄 齒胄
|
||||
龍巖 龍巖
|
||||
龍巖市 龍巖市
|
||||
龍巖村 龍巖村
|
||||
龍胄 龍胄
|
|
@ -1,7 +0,0 @@
|
|||
両 兩 輛
|
||||
弁 辨 辯 瓣 辦 弁
|
||||
御 御 禦
|
||||
欠 缺 欠
|
||||
糸 絲 糸
|
||||
芸 藝 芸
|
||||
浜 濱 浜
|
|
@ -1,176 +0,0 @@
|
|||
一獲千金 一攫千金
|
||||
丁寧 叮嚀
|
||||
丁重 鄭重
|
||||
三差路 三叉路
|
||||
世論 輿論
|
||||
亜鈴 啞鈴
|
||||
交差 交叉
|
||||
供宴 饗宴
|
||||
俊馬 駿馬
|
||||
保塁 堡壘
|
||||
個条書 箇条書
|
||||
偏平 扁平
|
||||
停泊 碇泊
|
||||
優俊 優駿
|
||||
先兵 尖兵
|
||||
先鋭 尖鋭
|
||||
共役 共軛
|
||||
冗舌 饒舌
|
||||
凶器 兇器
|
||||
削岩 鑿岩
|
||||
包丁 庖丁
|
||||
包帯 繃帯
|
||||
区画 區劃
|
||||
厳然 儼然
|
||||
友宜 友誼
|
||||
反乱 叛乱
|
||||
収集 蒐集
|
||||
叙情 抒情
|
||||
台頭 擡頭
|
||||
合弁 合辦
|
||||
喜遊曲 嬉遊曲
|
||||
嘆願 歎願
|
||||
回転 廻転
|
||||
回遊 回游
|
||||
奉持 捧持
|
||||
委縮 萎縮
|
||||
展転 輾轉
|
||||
希少 稀少
|
||||
幻惑 眩惑
|
||||
広範 廣汎
|
||||
広野 曠野
|
||||
廃虚 廢墟
|
||||
建坪率 建蔽率
|
||||
弁当 辨當
|
||||
弁膜 瓣膜
|
||||
弁護 辯護
|
||||
弁髪 辮髮
|
||||
弦歌 絃歌
|
||||
恩義 恩誼
|
||||
意向 意嚮
|
||||
慰謝料 慰藉料
|
||||
憶断 臆断
|
||||
憶病 臆病
|
||||
戦没 戰歿
|
||||
扇情 煽情
|
||||
手帳 手帖
|
||||
技量 伎倆
|
||||
抜粋 抜萃
|
||||
披歴 披瀝
|
||||
抵触 牴触
|
||||
抽選 抽籤
|
||||
拘引 勾引
|
||||
拠出 醵出
|
||||
拠金 醵金
|
||||
掘削 掘鑿
|
||||
控除 扣除
|
||||
援護 掩護
|
||||
放棄 抛棄
|
||||
散水 撒水
|
||||
敬謙 敬虔
|
||||
敷延 敷衍
|
||||
断固 断乎
|
||||
族生 簇生
|
||||
昇叙 陞敘
|
||||
暖房 煖房
|
||||
暗唱 暗誦
|
||||
暗夜 闇夜
|
||||
暴露 曝露
|
||||
枯渇 涸渇
|
||||
格好 恰好
|
||||
格幅 恰幅
|
||||
棄損 毀損
|
||||
模索 摸索
|
||||
橋頭保 橋頭堡
|
||||
欠缺 欠缺
|
||||
死体 屍體
|
||||
殿部 臀部
|
||||
母指 拇指
|
||||
気迫 気魄
|
||||
決別 訣別
|
||||
決壊 決潰
|
||||
沈殿 沈澱
|
||||
油送船 油槽船
|
||||
波乱 波瀾
|
||||
注釈 註釋
|
||||
洗浄 洗滌 洗浄
|
||||
活発 活潑
|
||||
浸透 滲透
|
||||
浸食 浸蝕
|
||||
消却 銷卻
|
||||
混然 渾然
|
||||
湾曲 彎曲
|
||||
溶接 熔接
|
||||
漁労 漁撈
|
||||
漂然 飄然
|
||||
激高 激昂
|
||||
火炎 火焰
|
||||
焦燥 焦躁
|
||||
班点 斑点
|
||||
留飲 溜飲
|
||||
略奪 掠奪
|
||||
疎通 疏通
|
||||
発酵 醱酵
|
||||
白亜 白堊
|
||||
相克 相剋
|
||||
知恵 智慧
|
||||
破棄 破毀
|
||||
確固 確乎
|
||||
禁固 禁錮
|
||||
符丁 符牒
|
||||
粉装 扮装
|
||||
紫班 紫斑
|
||||
終息 終熄
|
||||
総合 綜合
|
||||
編集 編輯
|
||||
義援 義捐
|
||||
耕運機 耕耘機
|
||||
肝心 肝腎
|
||||
肩甲骨 肩胛骨
|
||||
背徳 悖德
|
||||
脈拍 脈搏
|
||||
膨張 膨脹
|
||||
芳純 芳醇
|
||||
英知 叡智
|
||||
蒸留 蒸溜
|
||||
薫蒸 燻蒸
|
||||
薫製 燻製
|
||||
衣装 衣裳
|
||||
衰退 衰退 衰頽
|
||||
裕然 悠然
|
||||
補佐 輔佐
|
||||
訓戒 訓誡
|
||||
試練 試煉
|
||||
詭弁 詭辯
|
||||
講和 媾和
|
||||
象眼 象嵌
|
||||
貫録 貫禄
|
||||
買弁 買辦
|
||||
賛辞 讚辭
|
||||
踏襲 蹈襲
|
||||
車両 車輛
|
||||
転倒 顛倒
|
||||
輪郭 輪廓
|
||||
退色 褪色
|
||||
途絶 杜絶
|
||||
連係 連繫
|
||||
連合 聯合
|
||||
選考 銓衡
|
||||
酢酸 醋酸
|
||||
野卑 野鄙
|
||||
鉱石 礦石
|
||||
間欠 間歇
|
||||
関数 函數
|
||||
防御 防禦
|
||||
険阻 嶮岨
|
||||
障壁 牆壁
|
||||
障害 障礙
|
||||
隠滅 湮滅
|
||||
集落 聚落
|
||||
雇用 雇傭
|
||||
風諭 諷喩
|
||||
飛語 蜚語
|
||||
香典 香奠
|
||||
骨格 骨骼
|
||||
高進 亢進
|
||||
鳥観 鳥瞰
|
|
@ -1,367 +0,0 @@
|
|||
乘 乗
|
||||
亂 乱
|
||||
亙 亘
|
||||
亞 亜
|
||||
佛 仏
|
||||
來 来
|
||||
假 仮
|
||||
傳 伝
|
||||
僞 偽
|
||||
價 価
|
||||
儉 倹
|
||||
兒 児
|
||||
內 内
|
||||
兩 両
|
||||
剎 刹
|
||||
剩 剰
|
||||
劍 剣
|
||||
劑 剤
|
||||
勞 労
|
||||
勳 勲
|
||||
勵 励
|
||||
勸 勧
|
||||
勻 匀
|
||||
區 区
|
||||
卷 巻
|
||||
卻 却
|
||||
參 参
|
||||
吳 呉
|
||||
咒 呪
|
||||
啞 唖
|
||||
單 単
|
||||
噓 嘘
|
||||
嚙 噛
|
||||
嚴 厳
|
||||
囑 嘱
|
||||
圈 圏
|
||||
國 国
|
||||
圍 囲
|
||||
圓 円
|
||||
圖 図
|
||||
團 団
|
||||
增 増
|
||||
墮 堕
|
||||
壓 圧
|
||||
壘 塁
|
||||
壞 壊
|
||||
壤 壌
|
||||
壯 壮
|
||||
壹 壱
|
||||
壽 寿
|
||||
奧 奥
|
||||
奬 奨
|
||||
妝 粧
|
||||
孃 嬢
|
||||
學 学
|
||||
寢 寝
|
||||
實 実
|
||||
寫 写
|
||||
寬 寛
|
||||
寶 宝
|
||||
將 将
|
||||
專 専
|
||||
對 対
|
||||
屆 届
|
||||
屬 属
|
||||
峯 峰
|
||||
峽 峡
|
||||
嶽 岳
|
||||
巖 巌
|
||||
巢 巣
|
||||
帶 帯
|
||||
廁 厠
|
||||
廢 廃
|
||||
廣 広
|
||||
廳 庁
|
||||
彈 弾
|
||||
彌 弥
|
||||
彎 弯
|
||||
彥 彦
|
||||
徑 径
|
||||
從 従
|
||||
徵 徴
|
||||
德 徳
|
||||
恆 恒
|
||||
悅 悦
|
||||
惠 恵
|
||||
惡 悪
|
||||
惱 悩
|
||||
慘 惨
|
||||
應 応
|
||||
懷 懐
|
||||
戀 恋
|
||||
戰 戦
|
||||
戲 戯
|
||||
戶 戸
|
||||
戾 戻
|
||||
拂 払
|
||||
拔 抜
|
||||
拜 拝
|
||||
挾 挟
|
||||
插 挿
|
||||
揭 掲
|
||||
搔 掻
|
||||
搖 揺
|
||||
搜 捜
|
||||
摑 掴
|
||||
擇 択
|
||||
擊 撃
|
||||
擔 担
|
||||
據 拠
|
||||
擴 拡
|
||||
攝 摂
|
||||
攪 撹
|
||||
收 収
|
||||
效 効
|
||||
敕 勅
|
||||
敘 叙
|
||||
數 数
|
||||
斷 断
|
||||
晉 晋
|
||||
晚 晩
|
||||
晝 昼
|
||||
暨 曁
|
||||
曆 暦
|
||||
曉 暁
|
||||
曾 曽
|
||||
會 会
|
||||
枡 桝
|
||||
查 査
|
||||
條 条
|
||||
棧 桟
|
||||
棱 稜 棱
|
||||
榆 楡
|
||||
榮 栄
|
||||
樂 楽
|
||||
樓 楼
|
||||
樞 枢
|
||||
樣 様
|
||||
橫 横
|
||||
檢 検
|
||||
櫻 桜
|
||||
權 権
|
||||
歐 欧
|
||||
歡 歓
|
||||
步 歩
|
||||
歲 歳
|
||||
歷 歴
|
||||
歸 帰
|
||||
殘 残
|
||||
殼 殻
|
||||
毆 殴
|
||||
每 毎
|
||||
氣 気
|
||||
污 汚
|
||||
沒 没
|
||||
涉 渉
|
||||
淚 涙
|
||||
淨 浄
|
||||
淺 浅
|
||||
渴 渇
|
||||
溌 潑
|
||||
溪 渓
|
||||
溫 温
|
||||
溼 湿
|
||||
滯 滞
|
||||
滿 満
|
||||
潛 潜
|
||||
澀 渋
|
||||
澤 沢
|
||||
濟 済
|
||||
濤 涛
|
||||
濱 浜
|
||||
濾 沪
|
||||
瀧 滝
|
||||
瀨 瀬
|
||||
灣 湾
|
||||
焰 焔
|
||||
燈 灯
|
||||
燒 焼
|
||||
營 営
|
||||
爐 炉
|
||||
爭 争
|
||||
爲 為
|
||||
牀 床
|
||||
犧 犠
|
||||
狀 状
|
||||
狹 狭
|
||||
獨 独
|
||||
獵 猟
|
||||
獸 獣
|
||||
獻 献
|
||||
瓣 弁
|
||||
產 産
|
||||
畫 画
|
||||
當 当
|
||||
疊 畳
|
||||
疎 疏
|
||||
痹 痺
|
||||
瘦 痩
|
||||
癡 痴
|
||||
發 発
|
||||
皋 皐
|
||||
盜 盗
|
||||
盡 尽
|
||||
碎 砕
|
||||
祕 秘
|
||||
祿 禄
|
||||
禦 御
|
||||
禪 禅
|
||||
禮 礼
|
||||
禱 祷
|
||||
稅 税
|
||||
稱 称
|
||||
稻 稲
|
||||
穎 頴
|
||||
穗 穂
|
||||
穩 穏
|
||||
穰 穣
|
||||
竃 竈
|
||||
竊 窃
|
||||
粹 粋
|
||||
糉 粽
|
||||
絕 絶
|
||||
絲 糸
|
||||
經 経
|
||||
綠 緑
|
||||
緖 緒
|
||||
緣 縁
|
||||
縣 県
|
||||
縱 縦
|
||||
總 総
|
||||
繋 繫
|
||||
繡 繍
|
||||
繩 縄
|
||||
繪 絵
|
||||
繼 継
|
||||
續 続
|
||||
纔 才
|
||||
纖 繊
|
||||
缺 欠
|
||||
罐 缶
|
||||
羣 群
|
||||
聯 連
|
||||
聰 聡
|
||||
聲 声
|
||||
聽 聴
|
||||
肅 粛
|
||||
脣 唇
|
||||
脫 脱
|
||||
腦 脳
|
||||
腳 脚
|
||||
膽 胆
|
||||
臟 臓
|
||||
臺 台
|
||||
與 与
|
||||
舉 挙
|
||||
舊 旧
|
||||
舍 舎
|
||||
荔 茘
|
||||
莊 荘
|
||||
莖 茎
|
||||
菸 煙
|
||||
萊 莱
|
||||
萬 万
|
||||
蔣 蒋
|
||||
蔥 葱
|
||||
薰 薫
|
||||
藏 蔵
|
||||
藝 芸
|
||||
藥 薬
|
||||
蘆 芦
|
||||
處 処
|
||||
虛 虚
|
||||
號 号
|
||||
螢 蛍
|
||||
蟲 虫
|
||||
蠟 蝋
|
||||
蠶 蚕
|
||||
蠻 蛮
|
||||
裝 装
|
||||
覺 覚
|
||||
覽 覧
|
||||
觀 観
|
||||
觸 触
|
||||
說 説
|
||||
謠 謡
|
||||
證 証
|
||||
譯 訳
|
||||
譽 誉
|
||||
讀 読
|
||||
變 変
|
||||
讓 譲
|
||||
豐 豊
|
||||
豫 予
|
||||
貓 猫
|
||||
貳 弐
|
||||
賣 売
|
||||
賴 頼
|
||||
贊 賛
|
||||
贗 贋
|
||||
踐 践
|
||||
輕 軽
|
||||
輛 輌
|
||||
轉 転
|
||||
辨 弁
|
||||
辭 辞
|
||||
辯 弁
|
||||
遞 逓
|
||||
遥 遙
|
||||
遲 遅
|
||||
邊 辺
|
||||
鄉 郷
|
||||
酢 醋
|
||||
醉 酔
|
||||
醗 醱
|
||||
醫 医
|
||||
醬 醤
|
||||
釀 醸
|
||||
釋 釈
|
||||
鋪 舗
|
||||
錄 録
|
||||
錢 銭
|
||||
鍊 錬
|
||||
鐵 鉄
|
||||
鑄 鋳
|
||||
鑛 鉱
|
||||
閱 閲
|
||||
關 関
|
||||
陷 陥
|
||||
隨 随
|
||||
險 険
|
||||
隱 隠
|
||||
雙 双
|
||||
雜 雑
|
||||
雞 鶏
|
||||
霸 覇
|
||||
靈 霊
|
||||
靜 静
|
||||
顏 顔
|
||||
顯 顕
|
||||
餘 余
|
||||
騷 騒
|
||||
驅 駆
|
||||
驗 験
|
||||
驛 駅
|
||||
髓 髄
|
||||
體 体
|
||||
髮 髪
|
||||
鬥 闘
|
||||
鱉 鼈
|
||||
鷗 鴎
|
||||
鹼 鹸
|
||||
鹽 塩
|
||||
麥 麦
|
||||
麪 麺
|
||||
麴 麹
|
||||
黃 黄
|
||||
黑 黒
|
||||
默 黙
|
||||
點 点
|
||||
黨 党
|
||||
齊 斉
|
||||
齋 斎
|
||||
齒 歯
|
||||
齡 齢
|
||||
龍 竜
|
||||
龜 亀
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,278 +0,0 @@
|
|||
一目瞭然 一目了然
|
||||
上鍊 上链
|
||||
不瞭解 不了解
|
||||
么麼 幺麽
|
||||
么麽 幺麽
|
||||
乾乾淨淨 干干净净
|
||||
乾乾脆脆 干干脆脆
|
||||
癥候 征候
|
||||
綜合症 综合征
|
||||
乾元 乾元
|
||||
乾卦 乾卦
|
||||
乾嘉 乾嘉
|
||||
乾圖 乾图
|
||||
乾坤 乾坤
|
||||
乾坤一擲 乾坤一掷
|
||||
乾坤再造 乾坤再造
|
||||
乾坤大挪移 乾坤大挪移
|
||||
乾宅 乾宅
|
||||
乾斷 乾断
|
||||
乾旦 乾旦
|
||||
乾曜 乾曜
|
||||
乾清宮 乾清宫
|
||||
乾盛世 乾盛世
|
||||
乾紅 乾红
|
||||
乾綱 乾纲
|
||||
乾縣 乾县
|
||||
乾象 乾象
|
||||
乾造 乾造
|
||||
乾道 乾道
|
||||
乾陵 乾陵
|
||||
乾隆 乾隆
|
||||
乾隆年間 乾隆年间
|
||||
乾隆皇帝 乾隆皇帝
|
||||
以免藉口 以免借口
|
||||
以功覆過 以功复过
|
||||
侔德覆載 侔德复载
|
||||
傢俱 家具
|
||||
傷亡枕藉 伤亡枕藉
|
||||
八濛山 八濛山
|
||||
凌藉 凌借
|
||||
出醜狼藉 出丑狼藉
|
||||
函覆 函复
|
||||
千鍾粟 千锺粟
|
||||
反反覆覆 反反复复
|
||||
反覆 反复
|
||||
反覆思維 反复思维
|
||||
反覆思量 反复思量
|
||||
反覆性 反复性
|
||||
名覆金甌 名复金瓯
|
||||
哪吒 哪吒
|
||||
回覆 回复
|
||||
壺裏乾坤 壶里乾坤
|
||||
大目乾連冥間救母變文 大目乾连冥间救母变文
|
||||
宫商角徵羽 宫商角徵羽
|
||||
射覆 射复
|
||||
尼乾陀 尼乾陀
|
||||
幺麼 幺麽
|
||||
幺麼小丑 幺麽小丑
|
||||
幺麼小醜 幺麽小丑
|
||||
康乾 康乾
|
||||
張法乾 张法乾
|
||||
彷彿 仿佛
|
||||
彷徨 彷徨
|
||||
徵弦 徵弦
|
||||
徵絃 徵弦
|
||||
徵羽摩柯 徵羽摩柯
|
||||
徵聲 徵声
|
||||
徵調 徵调
|
||||
徵音 徵音
|
||||
情有獨鍾 情有独钟 情有独锺
|
||||
憑藉 凭借
|
||||
憑藉着 凭借着
|
||||
手鍊 手链
|
||||
扭轉乾坤 扭转乾坤
|
||||
找藉口 找借口
|
||||
拉鍊 拉链
|
||||
拉鍊工程 拉链工程
|
||||
拜覆 拜复
|
||||
據瞭解 据了解
|
||||
文錦覆阱 文锦复阱
|
||||
於世成 於世成
|
||||
於乎 於乎
|
||||
於仲完 於仲完
|
||||
於倫 於伦
|
||||
於其一 於其一
|
||||
於則 於则
|
||||
於勇明 於勇明
|
||||
於呼哀哉 於呼哀哉
|
||||
於單 於单
|
||||
於坦 於坦
|
||||
於崇文 於崇文
|
||||
於忠祥 於忠祥
|
||||
於惟一 於惟一
|
||||
於戲 於戏
|
||||
於敖 於敖
|
||||
於梨華 於梨华
|
||||
於清言 於清言
|
||||
於潛 於潜
|
||||
於琳 於琳
|
||||
於穆 於穆
|
||||
於竹屋 於竹屋
|
||||
於菟 於菟
|
||||
於邑 於邑
|
||||
於陵子 於陵子
|
||||
旋乾轉坤 旋乾转坤
|
||||
旋轉乾坤 旋转乾坤
|
||||
旋轉乾坤之力 旋转乾坤之力
|
||||
明瞭 明了
|
||||
明覆 明复
|
||||
書中自有千鍾粟 书中自有千锺粟
|
||||
有序 有序
|
||||
朝乾夕惕 朝乾夕惕
|
||||
木吒 木吒
|
||||
李乾德 李乾德
|
||||
李澤鉅 李泽钜
|
||||
李鍊福 李链福
|
||||
李鍾郁 李锺郁
|
||||
樊於期 樊於期
|
||||
沈沒 沉没
|
||||
沈沒成本 沉没成本
|
||||
沈積 沉积
|
||||
沈船 沉船
|
||||
沈默 沉默
|
||||
流徵 流徵
|
||||
浪蕩乾坤 浪荡乾坤
|
||||
滑藉 滑借
|
||||
無序 无序
|
||||
牴牾 抵牾
|
||||
牴觸 抵触
|
||||
狐藉虎威 狐借虎威
|
||||
珍珠項鍊 珍珠项链
|
||||
甚鉅 甚钜
|
||||
申覆 申复
|
||||
畢昇 毕昇
|
||||
發覆 发复
|
||||
盼既示覆 盼既示复
|
||||
瞭如 了如
|
||||
瞭如指掌 了如指掌
|
||||
瞭望 瞭望
|
||||
瞭然 了然
|
||||
瞭然於心 了然于心
|
||||
瞭若指掌 了若指掌
|
||||
瞭解 了解
|
||||
瞭解到 了解到
|
||||
示覆 示复
|
||||
神祇 神祇
|
||||
稟覆 禀复
|
||||
答覆 答复
|
||||
篤麼 笃麽
|
||||
簡單明瞭 简单明了
|
||||
籌畫 筹划
|
||||
素藉 素借
|
||||
老態龍鍾 老态龙钟 老态龙锺
|
||||
肘手鍊足 肘手链足
|
||||
茵藉 茵借
|
||||
萬鍾 万锺
|
||||
蒜薹 蒜薹
|
||||
蕓薹 芸薹
|
||||
蕩覆 荡复
|
||||
蕭乾 萧乾
|
||||
藉代 借代
|
||||
藉以 借以
|
||||
藉助 借助
|
||||
藉助於 借助于
|
||||
藉卉 借卉
|
||||
藉口 借口
|
||||
藉喻 借喻
|
||||
藉寇兵 借寇兵
|
||||
藉寇兵齎盜糧 借寇兵赍盗粮
|
||||
藉手 借手
|
||||
藉據 借据
|
||||
藉故 借故
|
||||
藉故推辭 借故推辞
|
||||
藉方 借方
|
||||
藉條 借条
|
||||
藉槁 借槁
|
||||
藉機 借机
|
||||
藉此 借此
|
||||
藉此機會 借此机会
|
||||
藉甚 借甚
|
||||
藉由 借由
|
||||
藉着 借着
|
||||
藉端 借端
|
||||
藉端生事 借端生事
|
||||
藉箸代籌 借箸代筹
|
||||
藉草枕塊 借草枕块
|
||||
藉藉 藉藉
|
||||
藉藉无名 藉藉无名
|
||||
藉詞 借词
|
||||
藉讀 借读
|
||||
藉資 借资
|
||||
衹得 只得
|
||||
衹見樹木 只见树木
|
||||
衹見樹木不見森林 只见树木不见森林
|
||||
袖裏乾坤 袖里乾坤
|
||||
覆上 复上
|
||||
覆住 复住
|
||||
覆信 复信
|
||||
覆冒 复冒
|
||||
覆呈 复呈
|
||||
覆命 复命
|
||||
覆墓 复墓
|
||||
覆宗 复宗
|
||||
覆帳 复帐
|
||||
覆幬 复帱
|
||||
覆成 复成
|
||||
覆按 复按
|
||||
覆文 复文
|
||||
覆杯 复杯
|
||||
覆校 复校
|
||||
覆瓿 复瓿
|
||||
覆盂 复盂
|
||||
覆盆 覆盆
|
||||
覆盆子 覆盆子
|
||||
覆盤 覆盘
|
||||
覆育 复育
|
||||
覆蕉尋鹿 复蕉寻鹿
|
||||
覆逆 复逆
|
||||
覆醢 复醢
|
||||
覆醬瓿 复酱瓿
|
||||
覆電 复电
|
||||
覆露 复露
|
||||
覆鹿尋蕉 复鹿寻蕉
|
||||
覆鹿遺蕉 复鹿遗蕉
|
||||
覆鼎 复鼎
|
||||
見覆 见复
|
||||
角徵 角徵
|
||||
角徵羽 角徵羽
|
||||
計畫 计划
|
||||
變徵 变徵
|
||||
變徵之聲 变徵之声
|
||||
變徵之音 变徵之音
|
||||
貂覆額 貂复额
|
||||
買臣覆水 买臣复水
|
||||
踅門瞭戶 踅门了户
|
||||
躪藉 躏借
|
||||
郭子乾 郭子乾
|
||||
酒逢知己千鍾少 酒逢知己千锺少
|
||||
酒逢知己千鍾少話不投機半句多 酒逢知己千锺少话不投机半句多
|
||||
醞藉 酝借
|
||||
重覆 重复
|
||||
金吒 金吒
|
||||
金鍊 金链
|
||||
鈞覆 钧复
|
||||
鉅子 钜子
|
||||
鉅萬 钜万
|
||||
鉅防 钜防
|
||||
鉸鍊 铰链
|
||||
銀鍊 银链
|
||||
錢鍾書 钱锺书
|
||||
鍊墜 链坠
|
||||
鍊子 链子
|
||||
鍊形 链形
|
||||
鍊條 链条
|
||||
鍊錘 链锤
|
||||
鍊鎖 链锁
|
||||
鍛鍾 锻锺
|
||||
鍾繇 钟繇 锺繇
|
||||
鍾萬梅 锺万梅
|
||||
鍾重發 锺重发
|
||||
鍾鍛 锺锻
|
||||
鍾馗 锺馗
|
||||
鎖鍊 锁链
|
||||
鐵鍊 铁链
|
||||
鑽石項鍊 钻石项链
|
||||
雁杳魚沈 雁杳鱼沉
|
||||
雖覆能復 虽覆能复
|
||||
電覆 电复
|
||||
露覆 露复
|
||||
項鍊 项链
|
||||
頗覆 颇复
|
||||
頸鍊 颈链
|
||||
顛乾倒坤 颠乾倒坤
|
||||
顛倒乾坤 颠倒乾坤
|
||||
顧藉 顾借
|
||||
麼些族 麽些族
|
||||
黄鍾公 黄锺公
|
||||
龍鍾 龙钟 龙锺
|
|
@ -1,388 +0,0 @@
|
|||
PN結 PN接面
|
||||
SQL注入 SQL隱碼攻擊
|
||||
SQL注入攻擊 SQL隱碼攻擊
|
||||
U盤 隨身碟
|
||||
三極管 三極體
|
||||
下拉列表 下拉選單
|
||||
並行計算 平行計算
|
||||
中間件 中介軟體
|
||||
串口 串列埠
|
||||
串行 序列
|
||||
串行端口 串列埠
|
||||
主引導記錄 主開機記錄
|
||||
主板 主機板
|
||||
二極管 二極體
|
||||
互聯網 網際網路
|
||||
交互 互動
|
||||
交互式 互動式
|
||||
人工智能 人工智慧
|
||||
代碼 程式碼 代碼
|
||||
代碼頁 內碼表
|
||||
以太網 乙太網
|
||||
任務欄 工作列
|
||||
任務管理器 工作管理員
|
||||
仿真 模擬
|
||||
位圖 點陣圖
|
||||
低級 低階 低級
|
||||
便攜式 行動式 攜帶型
|
||||
保存 儲存
|
||||
信噪比 訊雜比
|
||||
信息 資訊
|
||||
信息安全 資訊保安
|
||||
信息技術 資訊科技
|
||||
信息論 資訊理論
|
||||
信號 訊號 信號
|
||||
信道 通道
|
||||
傳感 感測
|
||||
像素 畫素
|
||||
僞代碼 虛擬碼
|
||||
優先級 優先順序
|
||||
優化 最佳化
|
||||
元數據 後設資料
|
||||
元編程 超程式設計
|
||||
光標 游標
|
||||
光盤 光碟
|
||||
光驅 光碟機
|
||||
免提 擴音
|
||||
內存 記憶體
|
||||
內核 核心
|
||||
內置 內建
|
||||
內聯函數 行內函數
|
||||
全局 全域性
|
||||
全角 全形
|
||||
兼容 相容
|
||||
冒泡排序 氣泡排序
|
||||
函數 函式
|
||||
函數式編程 函數語言程式設計
|
||||
刀片服務器 刀鋒伺服器
|
||||
分佈式 分散式
|
||||
分區 分割槽
|
||||
分辨率 解析度
|
||||
刷新 重新整理
|
||||
刻錄 燒錄
|
||||
前綴 字首
|
||||
剪切 剪下
|
||||
剪貼板 剪貼簿
|
||||
創建 建立
|
||||
加載 載入
|
||||
半角 半形
|
||||
博客 部落格
|
||||
卸載 解除安裝
|
||||
原代碼 原始碼
|
||||
參數 引數
|
||||
參數表 參數列
|
||||
句柄 控制代碼
|
||||
可視化 視覺化
|
||||
呼出 撥出
|
||||
呼叫轉移 來電轉駁
|
||||
命令式編程 指令式程式設計
|
||||
命令行 命令列
|
||||
命名空間 名稱空間
|
||||
哈希 雜湊
|
||||
單片機 微控制器
|
||||
回調 回撥
|
||||
固件 韌體
|
||||
圖像 影象
|
||||
圖庫 相簿
|
||||
圖標 圖示
|
||||
在線 線上
|
||||
地址 地址 位址
|
||||
地址欄 位址列
|
||||
城域網 都會網路
|
||||
堆棧 堆疊
|
||||
場效應管 場效電晶體
|
||||
壁紙 桌布 壁紙
|
||||
外置 外接
|
||||
外鍵 外來鍵
|
||||
多任務 多工
|
||||
多態 多型
|
||||
多線程 多執行緒
|
||||
字庫 字型檔
|
||||
字段 欄位
|
||||
字符 字元
|
||||
字符串 字串
|
||||
字符集 字符集
|
||||
字節 位元組
|
||||
字體 字型
|
||||
存儲 儲存
|
||||
存盤 存檔
|
||||
宏 宏 巨集
|
||||
宏內核 單核心
|
||||
寄存器 暫存器
|
||||
密鑰 金鑰
|
||||
實例 例項 實例
|
||||
實模式 真實模式
|
||||
審覈 稽覈
|
||||
寫保護 防寫
|
||||
寬帶 寬頻
|
||||
尋址 定址
|
||||
對話框 對話方塊
|
||||
對象 物件 對象
|
||||
導入 匯入
|
||||
導出 匯出
|
||||
局域網 區域網
|
||||
局部 區域性
|
||||
屏幕 螢幕
|
||||
屏蔽 遮蔽
|
||||
嵌套 巢狀
|
||||
布爾 布林
|
||||
帶寬 頻寬
|
||||
引導程序 載入程式
|
||||
彙編 彙編 組譯
|
||||
彙編語言 組合語言
|
||||
後綴 字尾
|
||||
循環 迴圈 循環
|
||||
性價比 價效比
|
||||
性能 效能
|
||||
截取 擷取
|
||||
截屏 截圖
|
||||
打印 列印
|
||||
打印機 印表機
|
||||
打開 開啟 打開
|
||||
批量 批次
|
||||
拋出 丟擲
|
||||
拷貝 複製
|
||||
持久性 永續性
|
||||
指針 指標
|
||||
捲積 摺積
|
||||
掃描儀 掃描器
|
||||
掛斷 結束通話
|
||||
採樣 取樣
|
||||
採樣率 取樣率
|
||||
接口 介面
|
||||
控件 控制元件
|
||||
插件 外掛
|
||||
搜索 搜尋
|
||||
操作數 運算元
|
||||
操作符 運算子
|
||||
操作系統 作業系統
|
||||
擴展 擴充套件
|
||||
擴展名 副檔名
|
||||
支持 支援
|
||||
支持者 支持者
|
||||
散列 雜湊
|
||||
數字 數字 數位
|
||||
數字印刷 數位印刷
|
||||
數字電子 數位電子
|
||||
數字電路 數位電路
|
||||
數據 資料
|
||||
數據倉庫 資料倉儲
|
||||
數據報 資料包
|
||||
數據庫 資料庫
|
||||
數據挖掘 資料探勘
|
||||
數據源 資料來源
|
||||
數組 陣列
|
||||
文件 檔案
|
||||
文件名 檔名
|
||||
文件夾 資料夾
|
||||
文件擴展名 副檔名
|
||||
文字處理 文書處理
|
||||
文本 文字
|
||||
文檔 文件
|
||||
映射 對映
|
||||
時分多址 分時多重進接
|
||||
時分複用 分時多工
|
||||
時鐘頻率 時脈頻率
|
||||
晶閘管 閘流體
|
||||
晶體管 電晶體
|
||||
智能 智慧
|
||||
最終用戶 終端使用者
|
||||
有損壓縮 有失真壓縮
|
||||
服務器 伺服器
|
||||
本地代碼 原生代碼
|
||||
析構函數 解構函式
|
||||
枚舉 列舉
|
||||
查找 查詢
|
||||
查看 檢視
|
||||
桌面型 桌上型
|
||||
構造函數 建構函式
|
||||
標識符 識別符號
|
||||
模塊 模組
|
||||
模擬 模擬 類比
|
||||
模擬電子 類比電子
|
||||
模擬電路 類比電路
|
||||
權限 許可權
|
||||
正則表達式 正規表示式
|
||||
死機 宕機
|
||||
殺毒 防毒
|
||||
比特 位元
|
||||
比特幣 比特幣
|
||||
比特率 位元率
|
||||
波分複用 波長分波多工
|
||||
消息 訊息 消息
|
||||
添加 新增
|
||||
源代碼 原始碼
|
||||
源文件 原始檔
|
||||
源碼 原始碼
|
||||
溢出 溢位
|
||||
滾動條 捲軸
|
||||
演示文稿 簡報
|
||||
激光 鐳射
|
||||
激活 啟用
|
||||
無損壓縮 無失真壓縮
|
||||
物理內存 實體記憶體
|
||||
物理地址 實體地址
|
||||
狀態欄 狀態列
|
||||
用戶 使用者
|
||||
用戶名 使用者名稱
|
||||
界面 介面
|
||||
異步 非同步
|
||||
登錄 登入
|
||||
發佈 釋出
|
||||
發送 傳送
|
||||
皮膚 面板
|
||||
盤片 碟片
|
||||
盤符 磁碟機代號
|
||||
目標代碼 目的碼
|
||||
相冊 相簿
|
||||
矢量 向量
|
||||
知識產權 智慧財產權
|
||||
短信 簡訊
|
||||
硬件 硬體
|
||||
硬盤 硬碟
|
||||
碼分多址 分碼多重進接
|
||||
碼率 位元速率
|
||||
磁盤 磁碟
|
||||
磁道 磁軌
|
||||
社區 社羣 社區
|
||||
移動硬盤 行動硬碟
|
||||
移動網絡 行動網路
|
||||
移動資料 行動資料
|
||||
移動通信 行動通訊
|
||||
移動電話 行動電話
|
||||
程序 程式
|
||||
程序員 程式設計師
|
||||
空分多址 分空間多重進接
|
||||
空分複用 空間多工
|
||||
窗口 視窗
|
||||
端口 埠
|
||||
筆記本電腦 膝上型電腦
|
||||
算子 運算元
|
||||
算法 演算法
|
||||
範式 正規化
|
||||
粘貼 貼上 粘貼
|
||||
紅心大戰 傷心小棧
|
||||
組件 元件
|
||||
綁定 繫結
|
||||
網上鄰居 網路上的芳鄰
|
||||
網卡 網絡卡
|
||||
網吧 網咖
|
||||
網絡 網路
|
||||
網關 閘道器
|
||||
線程 執行緒
|
||||
編程 程式設計
|
||||
編程語言 程式語言
|
||||
緩存 快取
|
||||
縮略圖 縮圖
|
||||
縮進 縮排
|
||||
總線 匯流排
|
||||
缺省 預設
|
||||
聯繫 聯絡
|
||||
聯繫歷史 通話記錄
|
||||
聲卡 音效卡
|
||||
聲明 宣告
|
||||
脫機 離線
|
||||
腳本 指令碼
|
||||
自動轉屏 自動旋轉螢幕
|
||||
臺式機 桌上型電腦
|
||||
航天飛機 太空梭
|
||||
芯片 晶片
|
||||
花屏 破圖
|
||||
菜單 選單 菜單
|
||||
萬維網 全球資訊網
|
||||
藍屏 藍色畫面
|
||||
藍牙 藍芽
|
||||
虛函數 虛擬函式
|
||||
虛擬機 虛擬機器
|
||||
表達式 表示式 運算式
|
||||
複印 影印
|
||||
複選按鈕 覈取按鈕
|
||||
複選框 覈取方塊
|
||||
視圖 檢視
|
||||
視頻 影片 視訊
|
||||
視頻會議 視訊會議
|
||||
視頻通話 視訊通話
|
||||
解釋器 直譯器
|
||||
觸摸 觸控
|
||||
觸摸屏 觸控式螢幕
|
||||
計算機安全 電腦保安
|
||||
計算機科學 電腦科學
|
||||
訪問 訪問 存取
|
||||
設備 裝置
|
||||
設置 設定
|
||||
註冊機 序號產生器
|
||||
註冊表 登錄檔
|
||||
註銷 登出
|
||||
調制 調變
|
||||
調度 排程
|
||||
調用 呼叫
|
||||
調色板 調色盤
|
||||
調製解調器 數據機
|
||||
調試 除錯 偵錯
|
||||
調試器 偵錯程式
|
||||
變量 變數
|
||||
軟件 軟體
|
||||
軟驅 軟碟機
|
||||
轉義字符 跳脫字元
|
||||
通信 通訊
|
||||
通訊卡 通話卡
|
||||
通配符 萬用字元
|
||||
連接 連線
|
||||
連接器 聯結器
|
||||
進制 進位制
|
||||
進程 程序 進程
|
||||
運算符 運算子
|
||||
運行 執行
|
||||
過程式編程 程序式程式設計
|
||||
遞歸 遞迴
|
||||
遠程 遠端
|
||||
適配器 介面卡
|
||||
邏輯門 邏輯閘
|
||||
重命名 重新命名
|
||||
重裝 重灌
|
||||
重載 過載
|
||||
金屬氧化物半導體 金氧半導體
|
||||
錄像 錄影
|
||||
鏈接 連結
|
||||
鏈表 連結串列
|
||||
鏡像 映象
|
||||
門戶網站 入口網站
|
||||
門電路 閘電路
|
||||
閃存 快閃記憶體
|
||||
關係數據庫 關聯式資料庫
|
||||
隊列 佇列
|
||||
集成 整合
|
||||
集成電路 積體電路
|
||||
集羣 叢集
|
||||
雲存儲 雲端儲存
|
||||
雲計算 雲端計算
|
||||
面向對象 物件導向
|
||||
面向過程 程序導向
|
||||
音頻 音訊
|
||||
頁眉 頁首
|
||||
頁腳 頁尾
|
||||
項目 專案
|
||||
預處理器 前處理器
|
||||
頭文件 標頭檔案
|
||||
頻分多址 分頻多重進接
|
||||
頻分複用 分頻多工
|
||||
類型 型別
|
||||
類模板 類别範本
|
||||
顯像管 映象管
|
||||
顯卡 顯示卡
|
||||
顯存 視訊記憶體
|
||||
飛行模式 飛航模式
|
||||
首席信息官 資訊長
|
||||
首席執行官 執行長
|
||||
首席技術官 技術長
|
||||
首席運營官 營運長
|
||||
高性能計算 高效能運算
|
||||
高清 高畫質
|
||||
高端 高階 進階
|
||||
高級 高階 進階 高級
|
||||
高速緩存 快取記憶體
|
||||
黑客 駭客
|
||||
默認 預設
|
||||
默認值 預設值
|
||||
點擊 點選
|
||||
鼠標 滑鼠
|
|
@ -1,84 +0,0 @@
|
|||
乍得 查德
|
||||
也門 葉門
|
||||
仙童半導體 快捷半導體
|
||||
伯利茲 貝里斯
|
||||
佛得角 維德角
|
||||
傅里葉 傅立葉
|
||||
克羅地亞 克羅埃西亞
|
||||
列支敦士登 列支敦斯登
|
||||
利比里亞 賴比瑞亞
|
||||
加納 迦納
|
||||
加蓬 加彭
|
||||
博茨瓦納 波札那
|
||||
卡塔爾 卡達
|
||||
危地馬拉 瓜地馬拉
|
||||
厄瓜多爾 厄瓜多
|
||||
厄立特里亞 厄利垂亞
|
||||
吉布堤 吉布地
|
||||
哈薩克斯坦 哈薩克
|
||||
哥斯達黎加 哥斯大黎加
|
||||
喫茶小舖 喫茶小舖
|
||||
圖瓦盧 吐瓦魯
|
||||
土庫曼斯坦 土庫曼
|
||||
圭亞那 蓋亞那
|
||||
坦桑尼亞 坦尚尼亞
|
||||
埃塞俄比亞 衣索比亞
|
||||
基里巴斯 吉里巴斯
|
||||
塔吉克斯坦 塔吉克
|
||||
塞拉利昂 獅子山
|
||||
塞浦路斯 塞普勒斯
|
||||
塞舌爾 塞席爾
|
||||
多米尼加 多明尼加
|
||||
安提瓜和巴布達 安地卡及巴布達
|
||||
尼日利亞 奈及利亞
|
||||
尼日爾 尼日
|
||||
岡比亞 甘比亞
|
||||
巴巴多斯 巴貝多
|
||||
巴布亞新幾內亞 巴布亞紐幾內亞
|
||||
布基納法索 布吉納法索
|
||||
布隆迪 蒲隆地
|
||||
帕勞 帛琉
|
||||
幾內亞比紹 幾內亞比索
|
||||
意大利 義大利
|
||||
所羅門羣島 索羅門羣島
|
||||
文萊 汶萊
|
||||
斯威士蘭 史瓦濟蘭
|
||||
斯洛文尼亞 斯洛維尼亞
|
||||
新西蘭 紐西蘭
|
||||
格林納達 格瑞那達
|
||||
格魯吉亞 喬治亞
|
||||
歐拉 尤拉
|
||||
毛里塔尼亞 茅利塔尼亞
|
||||
毛里求斯 模里西斯
|
||||
沙特阿拉伯 沙烏地阿拉伯
|
||||
波斯尼亞黑塞哥維那 波士尼亞赫塞哥維納
|
||||
津巴布韋 辛巴威
|
||||
洪都拉斯 宏都拉斯
|
||||
溫納圖萬 那杜
|
||||
烏茲別克斯坦 烏茲別克
|
||||
特立尼達和多巴哥 千里達及托巴哥
|
||||
瑙魯 諾魯
|
||||
瓦努阿圖 萬那杜
|
||||
盧旺達 盧安達
|
||||
科摩羅 葛摩
|
||||
科特迪瓦 象牙海岸
|
||||
突尼斯 突尼西亞
|
||||
純喫茶 純喫茶
|
||||
索馬里 索馬利亞
|
||||
老撾 寮國
|
||||
聖基茨和尼維斯 聖克里斯多福及尼維斯
|
||||
聖文森特和格林納丁斯 聖文森及格瑞那丁
|
||||
聖盧西亞 聖露西亞
|
||||
聖馬力諾 聖馬利諾
|
||||
肯尼亞 肯亞
|
||||
莫桑比克 莫三比克
|
||||
萊索托 賴索托
|
||||
萬象 永珍
|
||||
蘇里南 蘇利南
|
||||
貝寧 貝南
|
||||
贊比亞 尚比亞
|
||||
阿塞拜疆 亞塞拜然
|
||||
阿拉伯聯合酋長國 阿拉伯聯合大公國
|
||||
香農 夏農
|
||||
馬爾代夫 馬爾地夫
|
||||
馬里共和國 馬利共和國
|
|
@ -1,37 +0,0 @@
|
|||
元音 母音
|
||||
冰棍 冰棒
|
||||
出租車 計程車
|
||||
咖喱 咖哩
|
||||
塑料 塑膠
|
||||
奔馳 賓士
|
||||
奶酪 乳酪
|
||||
幾率 機率
|
||||
方便麪 泡麵 速食麵
|
||||
李彥宏 李彥宏
|
||||
概率 機率
|
||||
海內存知己 海內存知己
|
||||
涼菜 冷盤
|
||||
的士 計程車
|
||||
砹 砈
|
||||
硅 矽
|
||||
程序不正義 程序不正義
|
||||
程序正義 程序正義
|
||||
空氣淨化器 空氣清淨機
|
||||
納米 奈米
|
||||
自行車 腳踏車
|
||||
詞組 片語
|
||||
蹦極 高空彈跳
|
||||
輔音 子音
|
||||
通過 透過 通過
|
||||
酰 醯
|
||||
鈁 鍅
|
||||
鈈 鈽
|
||||
錇 鉳
|
||||
鍀 鎝
|
||||
鎄 鑀
|
||||
鎇 鋂
|
||||
鎿 錼
|
||||
鐦 鉲
|
||||
鑥 鎦
|
||||
黃宏 黃宏
|
||||
借記卡 簽帳金融卡
|
|
@ -1,39 +0,0 @@
|
|||
僞 偽
|
||||
啓 啟
|
||||
喫 吃
|
||||
嫺 嫻
|
||||
嬀 媯
|
||||
峯 峰
|
||||
幺 么
|
||||
擡 抬
|
||||
棱 稜
|
||||
檐 簷
|
||||
污 汙
|
||||
泄 洩
|
||||
潙 溈
|
||||
潨 潀
|
||||
爲 為
|
||||
牀 床
|
||||
痹 痺
|
||||
癡 痴
|
||||
皁 皂
|
||||
着 著
|
||||
睾 睪
|
||||
祕 秘
|
||||
竈 灶
|
||||
糉 粽
|
||||
繮 韁
|
||||
纔 才
|
||||
羣 群
|
||||
脣 唇
|
||||
蔘 參
|
||||
蔿 蒍
|
||||
衆 眾
|
||||
裏 裡
|
||||
覈 核
|
||||
踊 踴
|
||||
鉢 缽
|
||||
鍼 針
|
||||
鮎 鯰
|
||||
麪 麵
|
||||
齶 顎
|
|
@ -1,68 +0,0 @@
|
|||
一口吃個 一口喫個
|
||||
一口吃成 一口喫成
|
||||
一家三口 一家三口
|
||||
一家五口 一家五口
|
||||
一家六口 一家六口
|
||||
一家四口 一家四口
|
||||
凶事 凶事
|
||||
凶信 凶信
|
||||
凶兆 凶兆
|
||||
凶吉 凶吉
|
||||
凶地 凶地
|
||||
凶多吉少 凶多吉少
|
||||
凶宅 凶宅
|
||||
凶年 凶年
|
||||
凶德 凶德
|
||||
凶怪 凶怪
|
||||
凶日 凶日
|
||||
凶服 凶服
|
||||
凶歲 凶歲
|
||||
凶死 凶死
|
||||
凶氣 凶氣
|
||||
凶煞 凶煞
|
||||
凶燄 凶燄
|
||||
凶神 凶神
|
||||
凶禮 凶禮
|
||||
凶耗 凶耗
|
||||
凶肆 凶肆
|
||||
凶荒 凶荒
|
||||
凶訊 凶訊
|
||||
凶豎 凶豎
|
||||
凶身 凶身
|
||||
凶逆 凶逆
|
||||
凶門 凶門
|
||||
口吃 口吃
|
||||
吃口 喫口 吃口
|
||||
吃口令 吃口令
|
||||
吃口飯 喫口飯
|
||||
吃吃 喫喫 吃吃
|
||||
吃子 喫子 吃子
|
||||
合著 合著
|
||||
吉凶 吉凶
|
||||
名著 名著
|
||||
四凶 四凶
|
||||
大凶 大凶
|
||||
巨著 巨著
|
||||
張口 張口
|
||||
昭著 昭著
|
||||
歲凶 歲凶
|
||||
胃口 胃口
|
||||
著作 著作
|
||||
著名 著名
|
||||
著式 著式
|
||||
著志 著志
|
||||
著於 著於
|
||||
著書 著書
|
||||
著白 著白
|
||||
著稱 著稱
|
||||
著者 著者
|
||||
著述 著述
|
||||
著錄 著錄
|
||||
蹇吃 蹇吃
|
||||
逢凶 逢凶
|
||||
避凶 避凶
|
||||
鄧艾吃 鄧艾吃
|
||||
鉅著 鉅著
|
||||
開口 開口
|
||||
閔凶 閔凶
|
||||
顯著 顯著
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="100px" height="100px" viewBox="-10 -10.48 100 100"
|
||||
overflow="visible" enable-background="new -10 -10.48 100 100" xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<g>
|
||||
<path d="M47.2,24.959c0.746,0,2.346,0.64,4.8,1.92c2.026,1.12,3.04,2.16,3.04,3.12c0,0.428-0.56,0.88-1.68,1.36
|
||||
c-2.4,1.174-4.641,2.56-6.721,4.16l-3.92,2.96c-0.427,0.268-0.8,0.507-1.12,0.72c0.693,0.427,1.093,1.014,1.2,1.759
|
||||
c0.106,1.068,0.187,2.107,0.24,3.121c1.066-0.107,2.133-0.188,3.2-0.24c6.826-0.641,12.053-1.36,15.68-2.16
|
||||
c1.546-0.32,2.48-0.48,2.8-0.48c0.32,0,1.761,0.48,4.32,1.44c2.08,1.067,3.12,2.054,3.12,2.96c0,0.854-1.44,1.279-4.32,1.279H55.76
|
||||
c-3.308,0-7.467,0.16-12.479,0.48c0.319,4.48,0.479,8.48,0.479,12c0,6.027-0.587,10.267-1.76,12.721
|
||||
c-1.067,1.706-2.054,2.56-2.96,2.56c-0.48,0-1.04-0.374-1.68-1.12c-2.668-3.414-5.094-6-7.28-7.76
|
||||
c-0.48-0.267-0.72-0.533-0.72-0.801c0-0.212,0.106-0.319,0.32-0.319c0.692,0,1.786,0.427,3.28,1.28
|
||||
c2.026,0.64,3.333,0.959,3.92,0.959c0.427,0,0.772-0.292,1.04-0.879c0.427-0.961,0.772-2.507,1.04-4.641
|
||||
c0.267-2.452,0.4-5.732,0.4-9.84c0-1.387-0.028-2.666-0.08-3.84c-0.748,0.054-1.468,0.107-2.16,0.16
|
||||
c-5.388,0.373-11.254,1.279-17.6,2.72c-1.654,0.427-2.748,0.64-3.28,0.64c-0.908,0-2.32-0.372-4.24-1.119
|
||||
c-1.974-0.801-2.96-1.467-2.96-2c0-0.693,0.64-1.094,1.92-1.201c6.826-0.105,11.866-0.451,15.12-1.039
|
||||
c4.052-0.533,8.346-1.013,12.88-1.44C38.8,43.493,38.612,42.693,38.4,42c-0.374-1.387-0.96-2.347-1.761-2.88
|
||||
c-0.479-0.266-0.72-0.506-0.72-0.72c0-0.586,0.532-0.88,1.6-0.88c0.427,0,1.2,0.24,2.32,0.72c2.24-2.613,4.08-5.066,5.521-7.36
|
||||
c0.372-0.586,0.56-0.986,0.56-1.2c0-0.426-0.294-0.64-0.88-0.64c-0.428,0-1.36,0.134-2.8,0.4C39.68,29.919,36,30.773,31.2,32
|
||||
c-1.12,0.32-1.84,0.48-2.16,0.48c-0.48,0-1.308-0.292-2.48-0.88c-1.228-0.692-1.84-1.227-1.84-1.6c0-0.426,0.506-0.64,1.52-0.64
|
||||
c4.16-0.266,7.706-0.772,10.64-1.52c2.88-0.64,5.732-1.412,8.561-2.32C46.347,25.147,46.933,24.959,47.2,24.959z M35.04,5.919
|
||||
c1.12,0,2.532,0.454,4.24,1.36c1.706,1.068,2.826,2.108,3.359,3.12c0.533,1.12,0.801,2.24,0.801,3.36c0,1.173-0.32,2-0.96,2.48
|
||||
c5.065-0.64,10.372-1.44,15.92-2.4c1.652-0.48,2.72-0.72,3.199-0.72c0.801,0,2.267,0.907,4.4,2.72
|
||||
c2.452,1.974,3.68,3.468,3.68,4.48c0,1.12-1.04,1.76-3.12,1.92c-3.04,0.427-6.693,1.333-10.96,2.72
|
||||
c-0.213,0-0.319-0.106-0.319-0.32c2.933-3.84,4.399-6.106,4.399-6.8c0-0.64-0.507-0.96-1.52-0.96
|
||||
c-7.84,0.214-18.88,1.708-33.12,4.48c-1.228,0.107-1.974,0.16-2.24,0.16c-0.907,0-1.68-0.106-2.32-0.32
|
||||
c-0.16,0.907-0.48,1.947-0.96,3.12c-0.854,1.974-1.654,3.334-2.4,4.08c-0.534,0.428-1.04,0.64-1.52,0.64
|
||||
c-0.534,0-1.094-0.346-1.68-1.04c-0.32-0.586-0.48-1.28-0.48-2.08c0-0.746,0.16-1.386,0.48-1.92c1.066-1.333,2.32-4.132,3.76-8.4
|
||||
c0.16-0.64,0.4-0.96,0.72-0.96c0.533,0,1.066,0.667,1.6,2c0.16,0.534,0.292,1.014,0.4,1.44h0.88c5.653-0.16,11.867-0.64,18.64-1.44
|
||||
c-0.854-0.586-1.84-1.973-2.96-4.16c-1.707-3.36-2.56-5.44-2.56-6.24C34.4,6.08,34.612,5.973,35.04,5.919z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 3.3 KiB |
|
@ -1,207 +0,0 @@
|
|||
划 劃 畫 划 「划」讀音hua2,意義爲「撥水前進」、「合算」。「劃」讀作hua2時,意義爲「戳傷」,讀作hua4是意義爲「分界」、「設計」。「畫」基本意義爲「繪畫」。 劃分 劃破 圖畫 畫押 划船 划算
|
||||
卤 滷 鹵 「滷」特別作爲一種烹調方法,「鹵」用作其他意義或化學元素。 滷汁 滷肉 鹵素
|
||||
历 歷 曆 「日曆」作「曆」,與歷史有關用「歷」。 萬年曆 歷史
|
||||
发 發 髮 與毛髮有關用「髮」,其餘意義爲「發」。 發財 發送 頭髮 令人髮指
|
||||
只 只 隻 「隻」用作量詞,「只」爲副詞「僅」。 船隻 隻言片語 只有 僅只
|
||||
台 臺 檯 颱 台 與「平地」有關用「臺」,與「櫃檯」有關用「檯」,與「颱風」有關用「颱」。「台」爲罕用字。 看臺 高臺 電視臺 寫字檯 颱風 兄台 天台山 五臺山 臺灣
|
||||
后 後 后 與「帝王」、「帝王配偶」有關用「后」,與「時間先後」有關用「後」。 皇后 以後
|
||||
坛 壇 罈 「罈」爲一種容器,其餘意義爲「壇」。 祭壇 論壇 罈子 酒罈
|
||||
复 復 複 覆 表示重疊意義用「複」,表示往返意義用「復」,表示「翻倒」、「遮蓋」用「覆」。 複製 重複 反復 恢復 覆蓋 傾覆 翻雲覆雨 反覆無常
|
||||
尽 盡 儘 「儘」用於「放開」、「最大限度」之意。其餘用「盡」。 儘管 儘量 極盡 自盡 盡頭
|
||||
干 幹 乾 干 榦 「干」本意爲盾牌,意義與武器有關。「乾」意義爲「水分少」。「幹」意義爲「主幹」或爲動詞。「榦」特別用於「版榦」。 干戈 干涉 干擾 干預 乾燥 乾貨 骨幹 幹部 幹活 版榦
|
||||
并 並 併 并 「併」特比用於「合併」之義,其餘一般作「並」。 並且 兼併 吞併 并州 兼容并包
|
||||
当 當 噹 「噹」用於擬聲詞,其餘用「當」。 叮噹 噹啷 當然 當年 應當
|
||||
志 志 誌 與記錄有關用「誌」,其餘用「志」。 志向 志氣 雜誌 日誌
|
||||
汇 匯 彙 「彙」爲「相同種類聚集成的東西」,「匯」傾向於「水流匯合」一動作。 辭彙 彙編 彙報 匯合 匯款
|
||||
系 系 係 繫 「係」強調「關係」,「系」爲一個整體,「繫」與連接有關。 系統 係數 干係 關係 聯繫 維繫 繫鞋帶
|
||||
脏 髒 臟 「臟」讀音zang4,意義爲「身體器官」,「髒」讀音zang1,意義爲「不乾淨」。 內臟 骯髒
|
||||
荡 蕩 盪 與「洗滌」、「搖動」有掛用「盪」,其餘用「蕩」。 盪漾 盪滌 動盪 掃蕩 放蕩 蕩然無存 蕩氣迴腸
|
||||
获 獲 穫 「獲」一般用於動詞,「穫」一般用於名詞。 不勞而獲 獲益 收穫
|
||||
采 採 采 「採」用於動詞,其餘用「采」。 採集 博採眾長 丰采 神采奕奕
|
||||
里 裏 里 「裏」與「外」相對,其餘用「里」。 里程 故里 裏外
|
||||
钟 鍾 鐘 「鍾」意義爲聚集,「鐘」爲一種樂器。 鍾情 鍾愛 鐘鼓 掩耳盜鐘
|
||||
饥 飢 饑 「飢」意義爲「吃不飽」,「饑」意義爲「穀物不熟」。 飢餓 饑荒 饑饉
|
||||
丰 豐 丰 表示「美好的容貌的姿態」用「丰」,其餘一般爲「豐」。 丰采 丰姿 豐富 五穀豐登 張三丰
|
||||
丑 醜 丑 「丑」用於十二地支和戲角色,「醜」爲「不美」。 小丑 丑角 辛丑條約 醜陋 醜惡
|
||||
了 了 瞭 「了」意義爲「完畢」、「完全」。「瞭」讀作liao3時意義爲「明白」、「清楚」,讀作liao4時意義爲「遠看」。 不了了之 了無牽掛 明瞭 瞭解 一目瞭然 瞭望
|
||||
借 借 藉 「依賴、假借、草墊」之意用「藉」,其餘一般用「借」。(習慣用法區別) 慰藉 藉口 憑藉 借住 借題發揮 借刀殺人
|
||||
克 克 剋 與「戰勝」、「約束」、「傷害」有關意義用「剋」,其餘用「克」。 克服 以柔克剛 千克 攻剋 剋扣 剋夫
|
||||
准 準 准 「准」只用於「允許」意義,其餘用「準」。 准許 不准 準備 標準
|
||||
刮 刮 颳 「吹襲」用「颳」,其餘用「刮」。 颳風 冰前颳雪 刮鬍子 刮痧 耳刮子
|
||||
制 制 製 「製」只用於「製作」相關意義,其餘用「制」。 制度 控制 製作
|
||||
吁 籲 吁 「呼喊﹑請求」用「籲」,讀音yu4,「歎氣」用「吁」,讀音xu1。 長吁短歎 呼籲 籲請
|
||||
吊 吊 弔 「弔」只用於「祭奠死者」相關意義,其餘用「吊」。 吊車 上吊 弔唁 弔喪
|
||||
团 團 糰 與「食品」有關用「糰」,其餘用團。 飯糰 糯米糰 團體 社團
|
||||
困 困 睏 「睏」特指「瞌睡」,其餘用「困」。 困擾 困局 貧困 睏意 睏倦
|
||||
布 佈 布 「布」爲「紡織品」,其餘用「佈」。 棉布 發佈 佈置 擺佈 遍佈
|
||||
御 御 禦 與「抵抗」有關用「禦」,其餘用「御」。 御馬 御用 防禦 抵禦
|
||||
斗 鬭 斗 「斗」爲一種容積計量單位,「鬭」表示「鬭爭」之意。 五斗米 車載斗量 鬭爭 戰鬭
|
||||
曲 曲 麯 「麯」與釀酒有關,其餘用「曲」。 樂曲 曲直 酒麯 大麯
|
||||
松 鬆 松 「松」爲一種樹木名詞,「鬆」與「緊」相對、 松樹 雪松 輕鬆 肉鬆
|
||||
淀 澱 淀 「淀」之意義爲「淺水」,其餘用「澱」。 澱粉 沉澱 海淀區 白洋淀
|
||||
纤 纖 縴 表示「細小」用「纖」,讀作xian1。表示拉船用「縴」,讀作qian4。 纖維 光纖 縴夫
|
||||
致 致 緻 與「細密」、「意趣」有關用「緻」,其餘用致。 導致 致敬 精緻 緻密 別緻 雅緻
|
||||
蔑 蔑 衊 表示「血污」、「誹謗」用「衊」,其餘意義用「蔑」。 輕蔑 蔑視 誣衊
|
||||
仇 仇 讎 與「校對」有關用「讎」,其餘用「仇」。 仇恨 報仇 讎校 仇讎
|
||||
冬 冬 鼕 「鼕」爲鼓聲擬聲詞,其餘用「冬」。 隆冬 冬暖夏涼 鼕鼕
|
||||
咸 咸 鹹 「鹹」意義與「淡」相對,其餘用「咸」。 老少咸宜 鹹淡
|
||||
云 雲 云 「云」意義爲「說」,其餘用「雲」。 人云亦云 雲霧
|
||||
仆 僕 仆 「仆」意義爲「跌倒」,讀音pu1,「僕」爲「供人使喚的人」,讀音pu2。 前仆後繼 仆街 奴僕 公僕 風塵僕僕
|
||||
舍 舍 捨 「捨」讀作she3,用於「放棄」意義,其餘用「舍」,讀作she4,古文亦同「捨」。 宿舍 村舍 退避三舍 捨弃 舍我其誰 不舍晝夜
|
||||
签 籤 簽 「簽」用於動詞,表示「題字題名」,其餘用「籤」。 簽名 簽證 標籤 書籤 牙籤
|
||||
折 折 摺 與「叠」有關用「摺」,與「斷」有關用「折」。 摺紙 摺扇 存摺 折斷 折腰 折服 打折 損兵折將
|
||||
谷 谷 穀 表示「兩山之間」的地域用「谷」,表示農作物時用「穀」。 山谷 稻穀
|
||||
几 幾 几 「几」只用作「茶几」。表示「幾乎」、「幾個」意義用「幾」。 茶几 幾乎 幾個
|
||||
辟 闢 辟 「闢」用於「開墾」、「駁斥」意義。其餘用「辟」。 開闢 闢謠 另闢蹊徑 精闢 辟邪 鞭辟入裏
|
||||
奸 奸 姦 「姦」只用於淫亂之意,其餘用「奸」。 漢奸 狼狽爲奸 強姦
|
||||
游 遊 游 「游」與「水」有關,其餘用「遊」。 游泳 上游 遊戲 遊蕩
|
||||
佣 傭 佣 「傭」爲「僕役」,讀音yong1,「佣」爲「中間人」,讀音yong4。 傭人 雇傭 傭兵 佣金
|
||||
苏 蘇 囌 甦 「甦」與「醒」、「恢復」有關,「囌」用於「嚕囌」(囉唆),其餘用「蘇」。 甦醒 甦生 復甦 嚕囌 蘇州 屠蘇 蘇俄
|
||||
回 回 迴 與「旋轉」、「返迴」有關用「迴」,其餘用「回」。 迴合 迴光返照 迴旋 迴避 回答 回族 回絕
|
||||
面 面 麪 「面」意義爲「臉」、「外表」,「麪」爲小麥磨成的粉。 臉面 麪條 麪粉
|
||||
向 向 嚮 曏 「曏」表示「從前」,「嚮」表示「引導」、「傾向」,其餘用「向」。 曏者 嚮導 嚮往 嚮晦 方向 意向 向晚 向背 向來
|
||||
伙 夥 伙 「伙」只用於「伙食」、「工具」相關意義,其餘用「夥」。 夥同 夥伴 小夥子 伙食 包伙 傢伙
|
||||
郁 鬱 郁 與「文采豐盛」、「濃烈」有關意義用「郁」,其餘用「鬱」。 馥郁 郁郁乎文哉 鬱結 憂鬱 鬱金香 鬱悶 鬱郁
|
||||
朴 樸 朴 表示「原本的」意義用「樸」,其他音義用「朴」。 樸素 純樸 質樸 朴刀 朴姓 朴硝
|
||||
才 才 纔 表示「方」、「僅」用「纔」,其餘用「才」。 才俊 才幹 才能 纔能 剛纔 方纔
|
||||
朱 朱 硃 「硃」用於與「硃砂」有關意義,其餘用「朱」。 硃砂 近朱者赤
|
||||
别 別 彆 「彆」讀音bie4,與「彆扭」有關,其餘用「別」。 區別 彆扭
|
||||
卷 捲 卷 「捲」表示彎曲,讀音juan3,其餘用「卷」,讀音juan4。 席捲 捲土重來 花捲 試卷 卷帙 讀萬卷書
|
||||
蒙 蒙 矇 濛 懞 表示「欺騙」、「猜測」、「盲」用「矇」,表示「細雨」用「濛」,表示「老實」用「懞」,其餘意義用「蒙」。 矇騙 矇蔽 矇混 濛濛細雨 涳濛 懞直 蒙受 蒙昧 啓蒙 蒙古
|
||||
征 徵 征 與「召集」和「蹟象」有關用「徵」,與「遠征」、「討伐」有關用「征」。 征服 遠征 徵兵 徵收 徵兆 特徵 徵詢
|
||||
症 症 癥 「癥」爲一種「腹中結硬塊的疾病」,讀音zheng1。一般病症用「症」,讀音zheng4。 絕症 癌症 對症下藥 癥結
|
||||
恶 惡 噁 「噁心」用「噁」,其餘一般用「惡」。 善惡 噁心 二噁英
|
||||
注 注 註 與「記錄」有關意義用「註」,其餘用「注」。 注意 注入 關注 註冊 註釋 命中註定
|
||||
哄 哄 鬨 與「眾人喧鬧」有關用「鬨」,讀音hong4,其餘用「哄」。 哄騙 哄孩子 起鬨 一鬨而散
|
||||
参 參 蔘 「蔘」表示一種植物,其餘用「參」。 參與 參數 內参 海参崴 人蔘 黃金蔘
|
||||
腌 醃 腌 「腌」用於「腌臢」,表示一種食物加工方法用「醃」。 腌臢 醃漬 醃肉
|
||||
彩 彩 綵 表示「五彩的絲織品」用「綵」,其餘用「彩」。 張燈結綵 綵頭 剪綵 彩票 五彩繽紛
|
||||
占 佔 占 與巫術有關用「占」,讀音zhan1,其餘用「佔」,讀音zhan4。 占卜 占星 佔領 佔據
|
||||
欲 欲 慾 「慾」只用於「情慾」有關意義,其餘用「欲」。 獸慾 慾火 貪欲 暢所欲言 震耳欲聾
|
||||
扎 扎 紮 表示「纏束」、「軍隊屯駐」用「紮」,其餘用「扎」。 駐紮 包紮 安營紮寨 扎針 扎花 掙扎
|
||||
熏 熏 燻 「燻」特指一種烹飪方法,其餘用「熏」。 熏陶 利慾熏心 臭氣熏天 燻肉
|
||||
赞 贊 讚 與「表揚」有關意義用「讚」,其餘用「贊」。 贊助 贊同 讚美
|
||||
尝 嘗 嚐 與「喫」、「品嚐」有關意義用「嚐」,其餘用「嘗」。 嘗試 品嚐
|
||||
吃 喫 吃 解作「食」時用「喫」,解作「言蹇難也」時用「吃」。 喫飯 喫水 口吃
|
||||
烟 煙 菸 「煙」用於一般煙霧,與「菸草」有關時用「菸」。 煙霧 菸草 香菸
|
||||
周 周 週 賙 與「週期」有關用「週」,濟助他人用「賙」,其餘意義爲「周」。 周朝 眾所周知 週歲 週而復始 賙濟
|
||||
柜 櫃 柜 表示收藏東西的傢具時作「櫃」,表示一種落葉喬木用「柜」。 書櫃 柜柳
|
||||
喂 餵 喂 表示「餵養」時用「餵」,「喂」僅用作語氣詞。 餵豬 喂!
|
||||
幸 幸 倖 「倖」專指「意外地成功或避免」,其餘一般用「幸」。 倖免 倖存 僥倖 倖運 幸福 寵幸 慶幸
|
||||
凶 兇 凶 與占卜吉凶有關用「凶」,與「殺害」有關用「兇」。 凶宅 吉凶 兇殺 兇器 行兇
|
||||
杰 傑 杰 「杰」常用於人名,表示「出眾」用「傑」。 傑出 俊傑 傑作 李連杰 周杰倫 狄仁杰
|
||||
针 針 鍼 「鍼」用於以砭石製成的針,其餘均作「針」。 針線 針鋒相對 鍼砭 鍼灸
|
||||
戚 戚 慼 鏚 表示「憂愁」、「悲傷」用「慼」,「鏚」爲一種武器,其他意義用「戚」。 悲慼 慼慼 干鏚羽旄 戚繼光 親戚
|
||||
托 托 託 與「捧呈」、「承受」有關用「托」,與「寄」、「委任」有關用「託」。 襯托 槍托 寄託 託付 推託
|
||||
挨 挨 捱 表示「承受」、「拖延」、「抗拒」有關用「捱」,讀爲ai2,其餘用「挨」,讀爲ai1。 挨家挨戶 捱打
|
||||
挽 挽 輓 與「哀悼死者」有關用「輓」,其餘意義爲「挽」。 挽救 力挽狂瀾 輓聯 哀輓
|
||||
栗 慄 栗 表示「因恐懼而發抖」用「慄」,其餘意義用「栗」。 板栗 火中取栗 戰慄 不寒而慄
|
||||
炼 煉 鍊 專指「熔鍊金屬」時用「鍊」,一般意義用「煉」。 鍊鐵 淬鍊 煉乳 修煉
|
||||
链 鏈 鍊 「鏈」用作一般的「金屬繩狀物」,「鍊」專指首飾。 鎖鏈 鏈接 項鍊 金手鍊
|
||||
穗 穗 繐 「繐」用作「結紮成的裝飾物」,其餘用「穗」。 麥穗 帽繐
|
||||
雕 彫 鵰 「鵰」爲一種猛禽,與「彫刻」有關時用「彫」。 一箭雙鵰 彫刻 彫蟲小技
|
||||
梁 樑 梁 與「橋樑」、「棟樑」有關用「樑」,其餘意義爲「梁」。 樑上君子 鼻樑 大梁城 梁朝 梁山
|
||||
升 升 昇 「昇」字帶有濃烈喜慶氣氛,其餘用「升」。 上升 一升水 旭日東昇 歌舞昇平
|
||||
摆 擺 襬 表示「衣服下緣的部分」用「襬」,其餘用「擺」。 搖擺 擺放 裙襬 下襬
|
||||
岩 巖 岩 「岩」只用於「岩石」相關意義,其餘用「巖」。 沉積岩 岩漿 巖壁 中空成巖
|
||||
娘 娘 孃 「孃」意義爲「母親」,其餘用「娘」。 老孃 爹孃 孃家 姑娘 娘子 婆娘 舞娘
|
||||
僵 僵 殭 「殭」意義爲「不腐朽的屍體」,其餘用「僵」。 殭屍 殭蠶 僵硬 僵局 李代桃僵 百足之蟲,死而不僵
|
||||
药 藥 葯 「葯」特指「花的雄蕊中貯藏花粉的部份」,其餘用「藥」。 醫藥 良藥 芍藥 藥到病除 花葯
|
||||
余 餘 余 「余」爲第一人稱代詞或地名。 剩餘 多餘 余吾鎮
|
||||
蜡 蠟 蜡 「蜡」只用於「蜡月」。 蠟燭 蜂蠟 石蠟 蜡月
|
||||
出 出 齣 「齣」只用於「一齣戲」。 出入 出道 一齣戲
|
||||
卜 卜 蔔 「蔔」只用於「蘿蔔」。 占卜 卜辭 蘿蔔
|
||||
同 同 衕 「衕」只用於「衚衕」。 大同 衚衕
|
||||
板 板 闆 「闆」只用於「老闆」。 板塊 老闆
|
||||
漓 漓 灕 「灕」只用於「灕江」。 大汗淋漓 淋漓盡致 灕江 灕水
|
||||
术 術 朮 「朮」僅用於中藥名「白朮」相關。 法術 白朮 兀朮
|
||||
仑 侖 崙 表示「崑崙」時用崙。 崑崙 加侖
|
||||
秋 秋 鞦 「鞦」只用於「鞦韆」。 秋季 鞦韆
|
||||
千 千 韆 「韆」只用於「鞦韆」。 千萬 鞦韆
|
||||
帘 簾 帘 表示旗幟狀的標識用「帘」。 窗簾 珠簾 酒帘
|
||||
庵 庵 菴 「菴」只用作「菴藹」,讀作an4。 尼姑庵 菴藹
|
||||
尸 屍 尸 「尸」表示「主持」、「佔用」。 屍體 尸位素餐
|
||||
胡 胡 衚 鬍 「衚」只用於「衚衕」,「鬍」只用於「鬍鬚」。 胡人 胡亂 衚衕 鬍鬚
|
||||
须 須 鬚 「鬚」只用於「鬍鬚」。 必須 鬍鬚
|
||||
据 據 据 「据」只用於「拮据」。 數據 根據 拮据
|
||||
筑 築 筑 「筑」爲古代一種樂器,其餘用「築」。 建築 築巢 擊筑
|
||||
夸 誇 夸 「夸」見於古文和專有名詞。 誇大 誇獎 夸父 夸克
|
||||
苹 蘋 苹 「苹」、「蘋」爲兩種不同的植物。 蘋果 白蘋 苹縈 食野之苹
|
||||
袅 裊 嫋 與「嬌柔」、「婉轉」有關用「嫋」,其餘意義用「裊」。 嫋娜 餘音嫋嫋 裊繞
|
||||
暗 暗 闇 與「愚昧」有關意義用「闇」,其餘用「暗」。 闇昧 愚闇 偏信則闇 棄暗投明 暗號 暗示 黑暗
|
||||
冲 衝 沖 冲 與「撞擊」有關用「衝」,與「水流」有關用「沖」,「冲」見於古文。 要衝 衝突 俯衝 沖牛奶
|
||||
表 表 錶 「錶」用作「鐘錶」,其餘用「表」。 表達 表示 代表 手錶
|
||||
杆 杆 桿 表示細長的棍狀物,「杆」讀音gan1,傾向於較大的,「桿」讀音gan3,傾向於較小的。 球杆 旗杆 電線杆 筆桿 杠桿 大腸桿菌
|
||||
鉴 鑒 鑑 用於「鏡子」、「圖章」意義時用「鑑」,其他引申意義均用「鑒」。 銅鑑 印鑑 借鑒 鑒定 明鑒 鑒賞 殷鑒不遠
|
||||
搜 搜 蒐 「搜」意義爲「尋找」,與「聚集」和其他意義有關用「蒐」。 搜身 搜尋 蒐集 蒐羅 蒐購 春蒐
|
||||
杯 杯 盃 「盃」特別用於「獎盃」 獎盃 冠軍盃 世界盃
|
||||
铲 剷 鏟 「剷」用作動詞意義 剷除 鏟子
|
||||
扣 扣 釦 「釦」表示衣服上的結 鈕釦
|
||||
念 念 唸 與「讀」相近意義用「唸」 唸書 唸經 思念 繫念
|
||||
杠 杠 槓 「杠」特別用於「牀杠」 牀杠
|
||||
泛 泛 氾 表示「漂浮」「顯現」用「泛」,表示「大水」用「氾」 廣泛 泛舟 泛藍 氾濫
|
||||
核 核 覈 與「校對」相關意義用「覈」 覈實 覈對 覈算 考覈
|
||||
巨 巨 鉅 「鉅」與金屬有關,或用於固定名詞區別 艱鉅 鉅變 鉅鹿 鉅款 鉅貪 鉅富 鉅子
|
||||
叹 嘆 歎 悲傷有關用「嘆」,其他用「歎」 哀嘆 感嘆 仰天長嘆 嘆息 嘆氣 吟歎 詠歎 歎賞 歎爲觀止 歎羨 讚歎
|
||||
价 價 价 表示僕役用「价」 小价 貴价 盛价 價格
|
||||
私 私 俬 室內使用的器具 傢俬
|
||||
局 局 侷 表示「狹小」用「侷」 大局 侷促 侷限
|
||||
拐 拐 柺 與「柺杖」有關用「柺」 柺杖 鐵柺李 拐彎
|
||||
弦 弦 絃 「絃」專指樂器 管絃 琴絃 續絃 箭在弦上 弦月
|
||||
哗 譁 嘩 擬聲詞用「嘩」 嘩啦 譁然 喧譁 譁眾取寵
|
||||
凄 悽 淒 傾向於悲慘用「悽」,寒冷用「淒」 淒涼 悽慘 悽楚 悽惻
|
||||
家 家 傢 「傢」爲「家」某些意義的分化字 傢俬、傢具、傢伙
|
||||
席 席 蓆 「蓆」特指涼蓆 涼蓆 草蓆
|
||||
酸 酸 痠 肢體疼痛用「痠」 痠痛 腰痠
|
||||
噪 噪 譟 壯大聲勢用「譟」 鼓譟 譟詐 譟動 聒噪 噪音
|
||||
咽 咽 嚥 「嚥」用於「吞嚥」之意 下嚥 嗚咽 咽喉
|
||||
愈 愈 癒 「癒」表示恢復 癒合 治癒
|
||||
凌 凌 淩 「淩」作姓氏 淩氏
|
||||
毁 毀 譭 燬 與「燒」、「熔」有關用「燬」。「譭」表示「污衊」。 禁燬 燒燬 詆譭 譭譽參半 譭棄
|
||||
苔 苔 薹 「苔」爲「附着在地面上的真菌藻類共生體」,「薹」爲「中央部分所長出來的莖」。 青苔 苔原 苔藓 蒜薹 蕓薹 菜薹
|
||||
糊 糊 餬 「填飽肚子」用「餬」。 養家餬口
|
||||
抵 抵 牴 「牴」本意爲「有角的獸類用角碰撞」,引申爲「衝突」。 牴觸 牴牾
|
||||
恤 恤 卹 「卹」用作「撫慰」「賑濟」,「恤」用作「憂慮」「憐憫」。 體恤 憂國恤民 撫卹 卹金 振窮卹貧
|
||||
荫 蔭 廕 表示「庇護」「父祖恩澤」用「廕」。 廕庇 封妻廕子
|
||||
皂 皁 皂 「皂」專指肥皂。 香皂 皂莢樹 青紅皁白
|
||||
芸 芸 蕓 「蕓」只用作「蕓薹」。 蕓薹 蕓香
|
||||
背 背 揹 「揹」作動詞,表示「負荷」,讀陰平聲。 揹黑鍋 揹負
|
||||
夫 夫 伕 「伕」指「出苦力的人」。 車伕 轎伕 腳伕
|
||||
迹 蹟 跡 「蹟」特指「前人留下的事物」。 遺蹟 事蹟 奇蹟
|
||||
涌 湧 涌 「湧」本作「涌」,後分化。「湧」爲「水上溢」;「涌」爲「小河」,讀音chong1。 湧起 洶湧 浪湧 東涌
|
||||
录 錄 彔 「彔」爲雕刻木材,見於古文。
|
||||
极 極 极 「极」見於古文。
|
||||
愿 願 愿 「愿」見於古文,意義爲「忠厚」﹑「謹慎」。
|
||||
胜 勝 胜 「胜」爲「腥」之本字。
|
||||
确 確 确 「确」見於古文。
|
||||
叶 葉 叶 「叶」爲「協」古異體。
|
||||
虫 蟲 虫 「虫」爲「虺」的古字。
|
||||
厂 廠 厂 「厂」爲「庵」的古字。
|
||||
修 修 脩 「脩」指「乾肉」或「酬金」,古通「修」。
|
||||
价 價 价 「价」古義爲僕人。
|
||||
合 合 閤 「閤」見於古文,意義爲「宮殿」、「邊門」。
|
||||
适 適 适 「适」爲一古字,意義爲「迅速」。
|
||||
弥 彌 瀰 「瀰」爲「水深滿的樣子」,只見於古文。
|
||||
厘 釐 厘 「厘」見於古文。
|
||||
涂 塗 涂 「涂」見於姓氏和古文。
|
||||
个 個 箇 个 「箇」用於「箇中」地名「箇舊」,「个」見於古文。
|
||||
于 於 于 「于」見於姓氏和古文。
|
||||
党 黨 党 「党」只用於「党項族」或姓氏。
|
||||
种 種 种 「种」爲姓氏,其餘用「種」。
|
||||
万 萬 万 「万」只用於複姓「万俟」。
|
||||
范 範 范 「范」只用於姓氏,其餘用「範」。
|
||||
沈 瀋 沈 「瀋」意義爲「汁」,亦是河流名,「沈」作姓氏(讀作shen3時)。
|
||||
姜 姜 薑 「姜」爲姓氏,「薑」爲一種植物調味料。
|
||||
闲 閒 閑 「閑」「閒」在一般意義上爲異體字,其他意義見於古文或通假。
|
||||
证 證 証 証諫、士尉以証君
|
||||
佑 佑 祐 福祉用「祐」。嘉祐 僧祐
|
||||
谥 諡 謚 「諡」用於「諡號」,「謚」見於古文。
|
||||
熏 熏 燻 「熏」可用於「煙燻」或「薰香」義。
|
||||
旋 旋 鏇 「旋」用於「旋轉」等。「鏇」用於「旋轉削切」等。
|
||||
沾 沾 霑 「雨水浸潤」、「受恩」等義用「霑」,「浸溼」等義通用,「接觸」「染上」「帶有」等義用「沾」。
|
||||
跖 跖 蹠 「腳掌」等以「蹠」為正字。「跖」可用於人名,如「盜跖」。
|
||||
玩 玩 翫 「鬆懈、輕忽」用「翫」,其餘「玩」「翫」通用。
|
||||
璇 璇 璿 星名用「璇」。「天文儀」、「美玉」義可互通。二字皆有用於人名。 天璇
|
||||
它 它 牠 對動物的第三人稱用「牠」。
|
||||
蝎 蠍 蝎 「蝎」另兼正字義為「木中蠹蟲」。
|
||||
唇 脣 唇 「嘴脣」以「脣」為正字。「唇」另義為「驚駭」,讀作zhēn。
|
|
@ -1,12 +0,0 @@
|
|||
畫 画 划
|
||||
覆 覆 复
|
||||
藉 藉 借
|
||||
乾 乾 干
|
||||
瞭 瞭 了
|
||||
鍊 炼 链
|
||||
蘋 苹 蘋
|
||||
於 于 於
|
||||
鉅 巨 钜
|
||||
衹 衹 只
|
||||
著 着 著
|
||||
沈 沈 沉
|
|
@ -1,147 +0,0 @@
|
|||
丟 丟 丢
|
||||
並 並 竝
|
||||
幷 并 幷
|
||||
僞 偽 僞
|
||||
兌 兌 兑
|
||||
內 內 内
|
||||
冊 冊 册
|
||||
冢 冢 塚
|
||||
剁 剁 刴
|
||||
剋 剋 尅
|
||||
劃 劃 𠟱 劐 𠜻
|
||||
劍 劍 劎 劒 剣 剱 劔
|
||||
匯 匯 滙
|
||||
升 升 陞 阩 𧿘
|
||||
只 只 𠮡 𠷓
|
||||
呆 呆 獃
|
||||
啓 啓 啟
|
||||
回 回 囘 囬
|
||||
囪 囪 囱
|
||||
垛 垛 垜
|
||||
埼 埼 碕 崎 隑
|
||||
壩 垻 壩
|
||||
壺 壷 壺
|
||||
夠 够 夠
|
||||
嫋 嫋 嬝
|
||||
嬀 媯 嬀
|
||||
嬤 嬤 嬷
|
||||
崙 崙 崘
|
||||
嶽 嶽 𡶓 𡶳 𡴳
|
||||
廁 廁 厠
|
||||
愨 愨 慤 𣪎
|
||||
戶 戶 户 戸
|
||||
挆 挆 挅
|
||||
捂 捂 摀
|
||||
擔 擔 担
|
||||
擡 擡 抬
|
||||
曬 曬 晒
|
||||
朵 朵 朶
|
||||
杴 杴 鍁 𣞘
|
||||
查 査 查
|
||||
棱 棱 稜
|
||||
殼 㱿 殻 殼 㱿 𣪊
|
||||
污 汙 污 汚
|
||||
泄 泄 洩
|
||||
涌 湧 涌
|
||||
溯 溯 泝
|
||||
潙 溈 潙
|
||||
煙 煙 烟
|
||||
爲 爲 為
|
||||
牀 牀 床
|
||||
牆 牆 墻
|
||||
獎 獎 奬 𤟌 㢡
|
||||
產 產 産
|
||||
畫 畫 畵 𤱪 𨽶 𤲯
|
||||
瘻 瘻 瘺
|
||||
癡 癡 痴
|
||||
衆 衆 眾
|
||||
禿 禿 秃
|
||||
秋 秋 龝 秌
|
||||
秘 祕 秘
|
||||
竈 竈 灶
|
||||
累 累 纍
|
||||
絕 絕 絶 𢇍 𠤉
|
||||
絛 絛 縧
|
||||
綠 綠 緑
|
||||
綫 線 綫
|
||||
繃 繃 綳
|
||||
繡 繡 綉
|
||||
繮 繮 韁
|
||||
罈 罈 墰 罎 壜
|
||||
罵 罵 駡
|
||||
羣 羣 群
|
||||
考 考 攷
|
||||
脣 脣 唇
|
||||
蓴 蓴 蒓
|
||||
蘊 蘊 藴
|
||||
裏 裏 裡
|
||||
說 說 説
|
||||
謠 謠 謡 䚻
|
||||
譾 譾 謭
|
||||
豎 豎 竪
|
||||
豔 艷 豔 豓
|
||||
贓 贓 贜
|
||||
贗 贗 贋 偐
|
||||
跺 跺 跥
|
||||
踊 踴 踊
|
||||
躲 躲 躱
|
||||
逾 逾 踰
|
||||
醞 醞 醖
|
||||
醯 酰 醯
|
||||
鉢 鉢 缽
|
||||
鉤 鉤 鈎
|
||||
銳 銳 鋭
|
||||
錄 錄 録
|
||||
錘 錘 鎚
|
||||
鏽 鏥 銹 鏽
|
||||
鐫 鐫 鎸 鋑 𥍯
|
||||
钁 钁 鐝
|
||||
閱 閱 閲
|
||||
阪 坂 阪
|
||||
僱 僱 雇
|
||||
雕 雕 彫 琱
|
||||
雞 雞 鷄 鶏
|
||||
鞝 鞝 緔
|
||||
頹 頹 頽
|
||||
顏 顏 顔
|
||||
館 館 舘
|
||||
鬥 鬭 鬥 鬭 闘
|
||||
鬨 鬨 閧
|
||||
鯗 鯗 鮝
|
||||
鱷 鱷 鰐 𧍞
|
||||
鳧 鳧 鳬
|
||||
鶿 鶿 鷀
|
||||
鹼 鹼 礆 碱
|
||||
麴 麯 麴
|
||||
麪 麪 麵
|
||||
麼 麽 麼
|
||||
黴 黴 霉
|
||||
齎 齎 賫
|
||||
捻 捻 撚
|
||||
柺 柺 枴
|
||||
棲 棲 栖
|
||||
臥 臥 卧
|
||||
教 教 敎
|
||||
勳 勳 勛
|
||||
剿 剿 勦
|
||||
甕 甕 瓮
|
||||
餚 餚 肴
|
||||
鼴 鼴 鼹
|
||||
蔥 葱 蔥
|
||||
搗 擣 搗
|
||||
螂 蜋 螂
|
||||
溼 濕 溼
|
||||
羶 羶 羴
|
||||
痺 痺 痹
|
||||
蝨 虱 蝨
|
||||
檐 檐 簷
|
||||
暱 昵 暱
|
||||
灩 灩 灎 灧
|
||||
齧 嚙 齧
|
||||
彝 彝 彞
|
||||
檾 檾 苘 䔛
|
||||
餈 餈 糍
|
||||
拋 拋 抛
|
||||
糉 糉 粽
|
||||
峯 峰 峯
|
||||
鵰 鵰 雕
|
|
@ -1,76 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import codecs
|
||||
import sys
|
||||
|
||||
|
||||
def sort_items(input_filename, output_filename):
|
||||
input_file = codecs.open(input_filename, "r", encoding="utf-8")
|
||||
dic = {}
|
||||
|
||||
for line in input_file:
|
||||
if len(line) == 0 or line == '\n':
|
||||
continue
|
||||
try:
|
||||
key, value = line.split("\t")
|
||||
except ValueError:
|
||||
print(line)
|
||||
while value[-1] == "\n" or value[-1] == "\r":
|
||||
value = value[:-1]
|
||||
dic[key] = value
|
||||
|
||||
input_file.close()
|
||||
|
||||
output_file = open(output_filename, "wb")
|
||||
|
||||
for key in sorted(dic.keys()):
|
||||
line = key + "\t" + dic[key] + "\n"
|
||||
output_file.write(line.encode('utf-8'))
|
||||
|
||||
output_file.close()
|
||||
|
||||
|
||||
def reverse_items(input_filename, output_filename):
|
||||
input_file = codecs.open(input_filename, "r", encoding="utf-8")
|
||||
dic = {}
|
||||
|
||||
for line in input_file:
|
||||
if len(line) == 0:
|
||||
continue
|
||||
key, value = line.split("\t")
|
||||
while value[-1] == "\n" or value[-1] == "\r":
|
||||
value = value[:-1]
|
||||
|
||||
value_list = value.split(" ")
|
||||
for value in value_list:
|
||||
if value in dic:
|
||||
dic[value].append(key)
|
||||
else:
|
||||
dic[value] = [key]
|
||||
|
||||
input_file.close()
|
||||
|
||||
output_file = open(output_filename, "wb")
|
||||
|
||||
for key in sorted(dic.keys()):
|
||||
line = key + "\t" + " ".join(dic[key]) + "\n"
|
||||
output_file.write(line.encode('utf-8'))
|
||||
|
||||
output_file.close()
|
||||
|
||||
|
||||
def find_target_items(input_filename, keyword):
|
||||
input_file = codecs.open(input_filename, "r", encoding="utf-8")
|
||||
for line in input_file:
|
||||
if len(line) == 0:
|
||||
continue
|
||||
key, value = line.split("\t")
|
||||
while value[-1] == "\n" or value[-1] == "\r":
|
||||
value = value[:-1]
|
||||
|
||||
value_list = value.split(" ")
|
||||
for value in value_list:
|
||||
if keyword in value:
|
||||
sys.stdout.write(line)
|
||||
|
||||
input_file.close()
|
|
@ -1,12 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from common import find_target_items
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print("Find the value keyword in all pairs")
|
||||
print(("Usage: ", sys.argv[0], "[input] [keyword]"))
|
||||
exit(1)
|
||||
|
||||
find_target_items(sys.argv[1], sys.argv[2])
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import codecs
|
||||
import sys
|
||||
|
||||
from common import sort_items
|
||||
|
||||
if len(sys.argv) < 4:
|
||||
print("Merge and sort all text dictionaries")
|
||||
print(("Usage: ", sys.argv[0], "[input1] [input2] ... [inputN] [output]"))
|
||||
exit(1)
|
||||
|
||||
all_lines = []
|
||||
for i in range(1, len(sys.argv) - 1):
|
||||
input_file = codecs.open(sys.argv[i], "r", encoding="utf-8")
|
||||
for line in input_file:
|
||||
all_lines += line
|
||||
input_file.close()
|
||||
all_lines += '\n'
|
||||
|
||||
output_filename = sys.argv[-1]
|
||||
output_file = open(output_filename, "wb")
|
||||
for line in all_lines:
|
||||
output_file.write(line.encode('utf-8'))
|
||||
output_file.close()
|
||||
|
||||
sort_items(output_filename, output_filename)
|
|
@ -1,13 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
|
||||
from common import reverse_items
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print("Reverse key and value of all pairs")
|
||||
print(("Usage: ", sys.argv[0], "[input] [output]"))
|
||||
exit(1)
|
||||
|
||||
reverse_items(sys.argv[1], sys.argv[2])
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
|
||||
from common import sort_items
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Sort the dictionary")
|
||||
print(("Usage: ", sys.argv[0], "[inputVal] ([outputVal])"))
|
||||
exit(1)
|
||||
|
||||
inputVal = sys.argv[1]
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
outputVal = inputVal
|
||||
else:
|
||||
outputVal = sys.argv[2]
|
||||
|
||||
sort_items(inputVal, outputVal)
|
|
@ -1,17 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import glob
|
||||
import sys
|
||||
|
||||
from common import sort_items
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Sort the dictionary")
|
||||
print(("Usage: ", sys.argv[0], "[directory]"))
|
||||
exit(1)
|
||||
|
||||
dirtectory = sys.argv[1]
|
||||
files = glob.glob(dirtectory + "/*")
|
||||
for filename in files:
|
||||
print(filename)
|
||||
sort_items(filename, filename)
|
File diff suppressed because it is too large
Load Diff
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**System**
|
||||
Which OS, compiler, and compiler version are you using:
|
||||
- OS:
|
||||
- Compiler and version:
|
||||
|
||||
**To reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. sync to commit ...
|
||||
2. cmake/bazel...
|
||||
3. make ...
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FR]"
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
|
@ -1,62 +0,0 @@
|
|||
*.a
|
||||
*.so
|
||||
*.so.?*
|
||||
*.dll
|
||||
*.exe
|
||||
*.dylib
|
||||
*.cmake
|
||||
!/cmake/*.cmake
|
||||
!/test/AssemblyTests.cmake
|
||||
*~
|
||||
*.swp
|
||||
*.pyc
|
||||
__pycache__
|
||||
|
||||
# lcov
|
||||
*.lcov
|
||||
/lcov
|
||||
|
||||
# cmake files.
|
||||
/Testing
|
||||
CMakeCache.txt
|
||||
CMakeFiles/
|
||||
cmake_install.cmake
|
||||
|
||||
# makefiles.
|
||||
Makefile
|
||||
|
||||
# in-source build.
|
||||
bin/
|
||||
lib/
|
||||
/test/*_test
|
||||
|
||||
# exuberant ctags.
|
||||
tags
|
||||
|
||||
# YouCompleteMe configuration.
|
||||
.ycm_extra_conf.pyc
|
||||
|
||||
# ninja generated files.
|
||||
.ninja_deps
|
||||
.ninja_log
|
||||
build.ninja
|
||||
install_manifest.txt
|
||||
rules.ninja
|
||||
|
||||
# bazel output symlinks.
|
||||
bazel-*
|
||||
|
||||
# out-of-source build top-level folders.
|
||||
build/
|
||||
_build/
|
||||
build*/
|
||||
|
||||
# in-source dependencies
|
||||
/googletest/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
CMakeSettings.json
|
||||
|
||||
# Visual Studio Code cache/options directory
|
||||
.vscode/
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Install a newer CMake version
|
||||
curl -sSL https://cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.sh -o install-cmake.sh
|
||||
chmod +x install-cmake.sh
|
||||
sudo ./install-cmake.sh --prefix=/usr/local --skip-license
|
||||
|
||||
# Checkout LLVM sources
|
||||
git clone --depth=1 https://github.com/llvm-mirror/llvm.git llvm-source
|
||||
git clone --depth=1 https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx
|
||||
git clone --depth=1 https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi
|
||||
|
||||
# Setup libc++ options
|
||||
if [ -z "$BUILD_32_BITS" ]; then
|
||||
export BUILD_32_BITS=OFF && echo disabling 32 bit build
|
||||
fi
|
||||
|
||||
# Build and install libc++ (Use unstable ABI for better sanitizer coverage)
|
||||
mkdir llvm-build && cd llvm-build
|
||||
cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DLIBCXX_ABI_UNSTABLE=ON \
|
||||
-DLLVM_USE_SANITIZER=${LIBCXX_SANITIZER} \
|
||||
-DLLVM_BUILD_32_BITS=${BUILD_32_BITS} \
|
||||
../llvm-source
|
||||
make cxx -j2
|
||||
sudo make install-cxxabi install-cxx
|
||||
cd ../
|
|
@ -1,231 +0,0 @@
|
|||
sudo: required
|
||||
dist: trusty
|
||||
language: cpp
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- lcov
|
||||
env: COMPILER=g++ C_COMPILER=gcc BUILD_TYPE=Coverage
|
||||
- compiler: gcc
|
||||
env: COMPILER=g++ C_COMPILER=gcc BUILD_TYPE=Debug
|
||||
- compiler: gcc
|
||||
env: COMPILER=g++ C_COMPILER=gcc BUILD_TYPE=Release
|
||||
- compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-multilib
|
||||
- libc6:i386
|
||||
env:
|
||||
- COMPILER=g++
|
||||
- C_COMPILER=gcc
|
||||
- BUILD_TYPE=Debug
|
||||
- BUILD_32_BITS=ON
|
||||
- EXTRA_FLAGS="-m32"
|
||||
- compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-multilib
|
||||
- libc6:i386
|
||||
env:
|
||||
- COMPILER=g++
|
||||
- C_COMPILER=gcc
|
||||
- BUILD_TYPE=Release
|
||||
- BUILD_32_BITS=ON
|
||||
- EXTRA_FLAGS="-m32"
|
||||
- compiler: gcc
|
||||
env:
|
||||
- INSTALL_GCC6_FROM_PPA=1
|
||||
- COMPILER=g++-6 C_COMPILER=gcc-6 BUILD_TYPE=Debug
|
||||
- ENABLE_SANITIZER=1
|
||||
- EXTRA_FLAGS="-fno-omit-frame-pointer -g -O2 -fsanitize=undefined,address -fuse-ld=gold"
|
||||
- compiler: clang
|
||||
env: COMPILER=clang++ C_COMPILER=clang BUILD_TYPE=Debug
|
||||
- compiler: clang
|
||||
env: COMPILER=clang++ C_COMPILER=clang BUILD_TYPE=Release
|
||||
# Clang w/ libc++
|
||||
- compiler: clang
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
clang-3.8
|
||||
env:
|
||||
- INSTALL_GCC6_FROM_PPA=1
|
||||
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
|
||||
- LIBCXX_BUILD=1
|
||||
- EXTRA_CXX_FLAGS="-stdlib=libc++"
|
||||
- compiler: clang
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
clang-3.8
|
||||
env:
|
||||
- INSTALL_GCC6_FROM_PPA=1
|
||||
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Release
|
||||
- LIBCXX_BUILD=1
|
||||
- EXTRA_CXX_FLAGS="-stdlib=libc++"
|
||||
# Clang w/ 32bit libc++
|
||||
- compiler: clang
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
- g++-multilib
|
||||
- libc6:i386
|
||||
env:
|
||||
- INSTALL_GCC6_FROM_PPA=1
|
||||
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
|
||||
- LIBCXX_BUILD=1
|
||||
- BUILD_32_BITS=ON
|
||||
- EXTRA_FLAGS="-m32"
|
||||
- EXTRA_CXX_FLAGS="-stdlib=libc++"
|
||||
# Clang w/ 32bit libc++
|
||||
- compiler: clang
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
- g++-multilib
|
||||
- libc6:i386
|
||||
env:
|
||||
- INSTALL_GCC6_FROM_PPA=1
|
||||
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Release
|
||||
- LIBCXX_BUILD=1
|
||||
- BUILD_32_BITS=ON
|
||||
- EXTRA_FLAGS="-m32"
|
||||
- EXTRA_CXX_FLAGS="-stdlib=libc++"
|
||||
# Clang w/ libc++, ASAN, UBSAN
|
||||
- compiler: clang
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
clang-3.8
|
||||
env:
|
||||
- INSTALL_GCC6_FROM_PPA=1
|
||||
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
|
||||
- LIBCXX_BUILD=1 LIBCXX_SANITIZER="Undefined;Address"
|
||||
- ENABLE_SANITIZER=1
|
||||
- EXTRA_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=undefined,address -fno-sanitize-recover=all"
|
||||
- EXTRA_CXX_FLAGS="-stdlib=libc++"
|
||||
- UBSAN_OPTIONS=print_stacktrace=1
|
||||
# Clang w/ libc++ and MSAN
|
||||
- compiler: clang
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
clang-3.8
|
||||
env:
|
||||
- INSTALL_GCC6_FROM_PPA=1
|
||||
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
|
||||
- LIBCXX_BUILD=1 LIBCXX_SANITIZER=MemoryWithOrigins
|
||||
- ENABLE_SANITIZER=1
|
||||
- EXTRA_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=memory -fsanitize-memory-track-origins"
|
||||
- EXTRA_CXX_FLAGS="-stdlib=libc++"
|
||||
# Clang w/ libc++ and MSAN
|
||||
- compiler: clang
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
clang-3.8
|
||||
env:
|
||||
- INSTALL_GCC6_FROM_PPA=1
|
||||
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=RelWithDebInfo
|
||||
- LIBCXX_BUILD=1 LIBCXX_SANITIZER=Thread
|
||||
- ENABLE_SANITIZER=1
|
||||
- EXTRA_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all"
|
||||
- EXTRA_CXX_FLAGS="-stdlib=libc++"
|
||||
- os: osx
|
||||
osx_image: xcode8.3
|
||||
compiler: clang
|
||||
env:
|
||||
- COMPILER=clang++ BUILD_TYPE=Debug
|
||||
- os: osx
|
||||
osx_image: xcode8.3
|
||||
compiler: clang
|
||||
env:
|
||||
- COMPILER=clang++ BUILD_TYPE=Release
|
||||
- os: osx
|
||||
osx_image: xcode8.3
|
||||
compiler: clang
|
||||
env:
|
||||
- COMPILER=clang++
|
||||
- BUILD_TYPE=Release
|
||||
- BUILD_32_BITS=ON
|
||||
- EXTRA_FLAGS="-m32"
|
||||
- os: osx
|
||||
osx_image: xcode9.4
|
||||
compiler: gcc
|
||||
env:
|
||||
- COMPILER=g++-7 C_COMPILER=gcc-7 BUILD_TYPE=Debug
|
||||
|
||||
before_script:
|
||||
- if [ -n "${LIBCXX_BUILD}" ]; then
|
||||
source .travis-libcxx-setup.sh;
|
||||
fi
|
||||
- if [ -n "${ENABLE_SANITIZER}" ]; then
|
||||
export EXTRA_OPTIONS="-DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF";
|
||||
else
|
||||
export EXTRA_OPTIONS="";
|
||||
fi
|
||||
- mkdir -p build && cd build
|
||||
|
||||
before_install:
|
||||
- if [ -z "$BUILD_32_BITS" ]; then
|
||||
export BUILD_32_BITS=OFF && echo disabling 32 bit build;
|
||||
fi
|
||||
- if [ -n "${INSTALL_GCC6_FROM_PPA}" ]; then
|
||||
sudo add-apt-repository -y "ppa:ubuntu-toolchain-r/test";
|
||||
sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="60";
|
||||
fi
|
||||
|
||||
install:
|
||||
- if [ -n "${INSTALL_GCC6_FROM_PPA}" ]; then
|
||||
travis_wait sudo -E apt-get -yq --no-install-suggests --no-install-recommends install g++-6;
|
||||
fi
|
||||
- if [ "${TRAVIS_OS_NAME}" == "linux" -a "${BUILD_32_BITS}" == "OFF" ]; then
|
||||
travis_wait sudo -E apt-get -y --no-install-suggests --no-install-recommends install llvm-3.9-tools;
|
||||
sudo cp /usr/lib/llvm-3.9/bin/FileCheck /usr/local/bin/;
|
||||
fi
|
||||
- if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
|
||||
PATH=~/.local/bin:${PATH};
|
||||
pip install --user --upgrade pip;
|
||||
travis_wait pip install --user cpp-coveralls;
|
||||
fi
|
||||
- if [ "${C_COMPILER}" == "gcc-7" -a "${TRAVIS_OS_NAME}" == "osx" ]; then
|
||||
rm -f /usr/local/include/c++;
|
||||
brew update;
|
||||
travis_wait brew install gcc@7;
|
||||
fi
|
||||
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
|
||||
sudo apt-get update -qq;
|
||||
sudo apt-get install -qq unzip cmake3;
|
||||
wget https://github.com/bazelbuild/bazel/releases/download/0.10.1/bazel-0.10.1-installer-linux-x86_64.sh --output-document bazel-installer.sh;
|
||||
travis_wait sudo bash bazel-installer.sh;
|
||||
fi
|
||||
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
|
||||
curl -L -o bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/0.10.1/bazel-0.10.1-installer-darwin-x86_64.sh;
|
||||
travis_wait sudo bash bazel-installer.sh;
|
||||
fi
|
||||
|
||||
script:
|
||||
- cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_C_FLAGS="${EXTRA_FLAGS}" -DCMAKE_CXX_FLAGS="${EXTRA_FLAGS} ${EXTRA_CXX_FLAGS}" -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON -DBENCHMARK_BUILD_32_BITS=${BUILD_32_BITS} ${EXTRA_OPTIONS} ..
|
||||
- make
|
||||
- ctest -C ${BUILD_TYPE} --output-on-failure
|
||||
- bazel test -c dbg --define google_benchmark.have_regex=posix --announce_rc --verbose_failures --test_output=errors --keep_going //test/...
|
||||
|
||||
after_success:
|
||||
- if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
|
||||
coveralls --include src --include include --gcov-options '\-lp' --root .. --build-root .;
|
||||
fi
|
|
@ -1,115 +0,0 @@
|
|||
import os
|
||||
import ycm_core
|
||||
|
||||
# These are the compilation flags that will be used in case there's no
|
||||
# compilation database set (by default, one is not set).
|
||||
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
|
||||
flags = [
|
||||
'-Wall',
|
||||
'-Werror',
|
||||
'-pedantic-errors',
|
||||
'-std=c++0x',
|
||||
'-fno-strict-aliasing',
|
||||
'-O3',
|
||||
'-DNDEBUG',
|
||||
# ...and the same thing goes for the magic -x option which specifies the
|
||||
# language that the files to be compiled are written in. This is mostly
|
||||
# relevant for c++ headers.
|
||||
# For a C project, you would set this to 'c' instead of 'c++'.
|
||||
'-x', 'c++',
|
||||
'-I', 'include',
|
||||
'-isystem', '/usr/include',
|
||||
'-isystem', '/usr/local/include',
|
||||
]
|
||||
|
||||
|
||||
# Set this to the absolute path to the folder (NOT the file!) containing the
|
||||
# compile_commands.json file to use that instead of 'flags'. See here for
|
||||
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
||||
#
|
||||
# Most projects will NOT need to set this to anything; you can just change the
|
||||
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
|
||||
compilation_database_folder = ''
|
||||
|
||||
if os.path.exists( compilation_database_folder ):
|
||||
database = ycm_core.CompilationDatabase( compilation_database_folder )
|
||||
else:
|
||||
database = None
|
||||
|
||||
SOURCE_EXTENSIONS = [ '.cc' ]
|
||||
|
||||
def DirectoryOfThisScript():
|
||||
return os.path.dirname( os.path.abspath( __file__ ) )
|
||||
|
||||
|
||||
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
|
||||
if not working_directory:
|
||||
return list( flags )
|
||||
new_flags = []
|
||||
make_next_absolute = False
|
||||
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
|
||||
for flag in flags:
|
||||
new_flag = flag
|
||||
|
||||
if make_next_absolute:
|
||||
make_next_absolute = False
|
||||
if not flag.startswith( '/' ):
|
||||
new_flag = os.path.join( working_directory, flag )
|
||||
|
||||
for path_flag in path_flags:
|
||||
if flag == path_flag:
|
||||
make_next_absolute = True
|
||||
break
|
||||
|
||||
if flag.startswith( path_flag ):
|
||||
path = flag[ len( path_flag ): ]
|
||||
new_flag = path_flag + os.path.join( working_directory, path )
|
||||
break
|
||||
|
||||
if new_flag:
|
||||
new_flags.append( new_flag )
|
||||
return new_flags
|
||||
|
||||
|
||||
def IsHeaderFile( filename ):
|
||||
extension = os.path.splitext( filename )[ 1 ]
|
||||
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
|
||||
|
||||
|
||||
def GetCompilationInfoForFile( filename ):
|
||||
# The compilation_commands.json file generated by CMake does not have entries
|
||||
# for header files. So we do our best by asking the db for flags for a
|
||||
# corresponding source file, if any. If one exists, the flags for that file
|
||||
# should be good enough.
|
||||
if IsHeaderFile( filename ):
|
||||
basename = os.path.splitext( filename )[ 0 ]
|
||||
for extension in SOURCE_EXTENSIONS:
|
||||
replacement_file = basename + extension
|
||||
if os.path.exists( replacement_file ):
|
||||
compilation_info = database.GetCompilationInfoForFile(
|
||||
replacement_file )
|
||||
if compilation_info.compiler_flags_:
|
||||
return compilation_info
|
||||
return None
|
||||
return database.GetCompilationInfoForFile( filename )
|
||||
|
||||
|
||||
def FlagsForFile( filename, **kwargs ):
|
||||
if database:
|
||||
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
|
||||
# python list, but a "list-like" StringVec object
|
||||
compilation_info = GetCompilationInfoForFile( filename )
|
||||
if not compilation_info:
|
||||
return None
|
||||
|
||||
final_flags = MakeRelativePathsInFlagsAbsolute(
|
||||
compilation_info.compiler_flags_,
|
||||
compilation_info.compiler_working_dir_ )
|
||||
else:
|
||||
relative_to = DirectoryOfThisScript()
|
||||
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
|
||||
|
||||
return {
|
||||
'flags': final_flags,
|
||||
'do_cache': True
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Susumu Yata <susumu.yata@gmail.com>
|
|
@ -1,19 +0,0 @@
|
|||
include_directories(include)
|
||||
include_directories(lib)
|
||||
|
||||
set(
|
||||
LIBMARISA_SOURCES
|
||||
lib/marisa/trie.cc
|
||||
lib/marisa/agent.cc
|
||||
lib/marisa/grimoire/io/reader.cc
|
||||
lib/marisa/grimoire/io/writer.cc
|
||||
lib/marisa/grimoire/io/mapper.cc
|
||||
lib/marisa/grimoire/trie/louds-trie.cc
|
||||
lib/marisa/grimoire/trie/tail.cc
|
||||
lib/marisa/grimoire/vector/bit-vector.cc
|
||||
lib/marisa/keyset.cc
|
||||
)
|
||||
|
||||
add_library(marisa STATIC ${LIBMARISA_SOURCES})
|
||||
set_target_properties(marisa PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
source_group(marisa FILES ${LIBMARISA_SOURCES})
|
|
@ -1,34 +0,0 @@
|
|||
### COPYING
|
||||
|
||||
libmarisa and its command line tools are dual-licensed under the BSD 2-clause license and the LGPL.
|
||||
|
||||
#### The BSD 2-clause license
|
||||
|
||||
Copyright (c) 2010-2019, Susumu Yata
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#### The LGPL 2.1 or any later version
|
||||
|
||||
marisa-trie - A static and space-efficient trie data structure.
|
||||
Copyright (C) 2010-2019 Susumu Yata
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
@ -1,61 +0,0 @@
|
|||
### README
|
||||
|
||||
#### Project name
|
||||
|
||||
marisa-trie
|
||||
|
||||
#### Project summary
|
||||
|
||||
MARISA: Matching Algorithm with Recursively Implemented StorAge
|
||||
|
||||
#### Latest version
|
||||
|
||||
0.2.6
|
||||
|
||||
#### Description
|
||||
|
||||
Matching Algorithm with Recursively Implemented StorAge (MARISA) is a static and space-efficient trie data structure. And libmarisa is a C++ library to provide an implementation of MARISA. Also, the package of libmarisa contains a set of command line tools for building and operating a MARISA-based dictionary.
|
||||
|
||||
A MARISA-based dictionary supports not only lookup but also reverse lookup, common prefix search and predictive search.
|
||||
|
||||
* Lookup is to check whether or not a given string exists in a dictionary.
|
||||
* Reverse lookup is to restore a key from its ID.
|
||||
* Common prefix search is to find keys from prefixes of a given string.
|
||||
* Predictive search is to find keys starting with a given string.
|
||||
|
||||
The biggest advantage of libmarisa is that its dictionary size is considerably more compact than others. See below for the dictionary size of other implementations.
|
||||
|
||||
* Input
|
||||
* Source: enwiki-20121101-all-titles-in-ns0.gz
|
||||
* Contents: all page titles of English Wikipedia (Nov. 2012)
|
||||
* Number of keys: 9,805,576
|
||||
* Total size: 200,435,403 bytes (plain) / 54,933,690 bytes (gzipped)
|
||||
|
||||
|Implementation|Size (bytes)|Remarks |
|
||||
|:-------------|-----------:|--------------------------:|
|
||||
|darts-clone | 376,613,888|Compacted double-array trie|
|
||||
|tx-trie | 127,727,058|LOUDS-based trie |
|
||||
|marisa-trie | 50,753,560|MARISA trie |
|
||||
|
||||
#### Documentation
|
||||
|
||||
* README (English): https://s-yata.github.io/marisa-trie/docs/readme.en.html
|
||||
* README (Japanese): https://s-yata.github.io/marisa-trie/docs/readme.ja.html
|
||||
|
||||
#### Build instructions
|
||||
|
||||
You can get the latest version via `git clone`. Then, you can generate a `configure` script via `autoreconf -i`. After that, you can build and install libmarisa and its command line tools via `configure` and `make`. For details, see also documentation in `docs`.
|
||||
|
||||
```
|
||||
$ git clone https://github.com/s-yata/marisa-trie.git
|
||||
$ cd marisa-trie
|
||||
$ autoreconf -i
|
||||
$ ./configure --enable-native-code
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
#### Source code license
|
||||
|
||||
* The BSD 2-clause License
|
||||
* The LGPL 2.1 or any later version
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef MARISA_H_
|
||||
#define MARISA_H_
|
||||
|
||||
// "marisa/stdio.h" includes <cstdio> for I/O using std::FILE.
|
||||
#include "marisa/stdio.h"
|
||||
|
||||
// "marisa/iostream.h" includes <iosfwd> for I/O using std::iostream.
|
||||
#include "marisa/iostream.h"
|
||||
|
||||
// You can use <marisa/trie.h> instead of <marisa.h> if you don't need the
|
||||
// above I/O interfaces and don't want to include the above I/O headers.
|
||||
#include "marisa/trie.h"
|
||||
|
||||
#endif // MARISA_H_
|
|
@ -1,85 +0,0 @@
|
|||
#ifndef MARISA_AGENT_H_
|
||||
#define MARISA_AGENT_H_
|
||||
|
||||
#include "marisa/key.h"
|
||||
#include "marisa/query.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace trie
|
||||
{
|
||||
|
||||
class State;
|
||||
|
||||
} // namespace trie
|
||||
} // namespace grimoire
|
||||
|
||||
class Agent
|
||||
{
|
||||
public:
|
||||
Agent();
|
||||
~Agent();
|
||||
|
||||
const Query &query() const
|
||||
{
|
||||
return query_;
|
||||
}
|
||||
const Key &key() const
|
||||
{
|
||||
return key_;
|
||||
}
|
||||
|
||||
void set_query(const char *str);
|
||||
void set_query(const char *ptr, std::size_t length);
|
||||
void set_query(std::size_t key_id);
|
||||
|
||||
const grimoire::trie::State &state() const
|
||||
{
|
||||
return *state_;
|
||||
}
|
||||
grimoire::trie::State &state()
|
||||
{
|
||||
return *state_;
|
||||
}
|
||||
|
||||
void set_key(const char *str)
|
||||
{
|
||||
MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
|
||||
key_.set_str(str);
|
||||
}
|
||||
void set_key(const char *ptr, std::size_t length)
|
||||
{
|
||||
MARISA_DEBUG_IF((ptr == NULL) && (length != 0), MARISA_NULL_ERROR);
|
||||
MARISA_DEBUG_IF(length > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
key_.set_str(ptr, length);
|
||||
}
|
||||
void set_key(std::size_t id)
|
||||
{
|
||||
MARISA_DEBUG_IF(id > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
key_.set_id(id);
|
||||
}
|
||||
|
||||
bool has_state() const
|
||||
{
|
||||
return state_.get() != NULL;
|
||||
}
|
||||
void init_state();
|
||||
|
||||
void clear();
|
||||
void swap(Agent &rhs);
|
||||
|
||||
private:
|
||||
Query query_;
|
||||
Key key_;
|
||||
scoped_ptr<grimoire::trie::State> state_;
|
||||
|
||||
// Disallows copy and assignment.
|
||||
Agent(const Agent &);
|
||||
Agent &operator=(const Agent &);
|
||||
};
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_AGENT_H_
|
|
@ -1,203 +0,0 @@
|
|||
#ifndef MARISA_BASE_H_
|
||||
#define MARISA_BASE_H_
|
||||
|
||||
// Old Visual C++ does not provide stdint.h.
|
||||
#ifndef _MSC_VER
|
||||
#include <stdint.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#else // __cplusplus
|
||||
#include <stddef.h>
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int8 marisa_uint8;
|
||||
typedef unsigned __int16 marisa_uint16;
|
||||
typedef unsigned __int32 marisa_uint32;
|
||||
typedef unsigned __int64 marisa_uint64;
|
||||
#else // _MSC_VER
|
||||
typedef uint8_t marisa_uint8;
|
||||
typedef uint16_t marisa_uint16;
|
||||
typedef uint32_t marisa_uint32;
|
||||
typedef uint64_t marisa_uint64;
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) || defined(__ia64__) || defined(__ppc64__) || \
|
||||
defined(__powerpc64__) || defined(__sparc64__) || defined(__mips64__) || defined(__aarch64__) || \
|
||||
defined(__s390x__)
|
||||
#define MARISA_WORD_SIZE 64
|
||||
#else // defined(_WIN64), etc.
|
||||
#define MARISA_WORD_SIZE 32
|
||||
#endif // defined(_WIN64), etc.
|
||||
|
||||
//#define MARISA_WORD_SIZE (sizeof(void *) * 8)
|
||||
|
||||
#define MARISA_UINT8_MAX ((marisa_uint8) ~(marisa_uint8)0)
|
||||
#define MARISA_UINT16_MAX ((marisa_uint16) ~(marisa_uint16)0)
|
||||
#define MARISA_UINT32_MAX ((marisa_uint32) ~(marisa_uint32)0)
|
||||
#define MARISA_UINT64_MAX ((marisa_uint64) ~(marisa_uint64)0)
|
||||
#define MARISA_SIZE_MAX ((size_t) ~(size_t)0)
|
||||
|
||||
#define MARISA_INVALID_LINK_ID MARISA_UINT32_MAX
|
||||
#define MARISA_INVALID_KEY_ID MARISA_UINT32_MAX
|
||||
#define MARISA_INVALID_EXTRA (MARISA_UINT32_MAX >> 8)
|
||||
|
||||
// Error codes are defined as members of marisa_error_code. This library throws
|
||||
// an exception with one of the error codes when an error occurs.
|
||||
typedef enum marisa_error_code_
|
||||
{
|
||||
// MARISA_OK means that a requested operation has succeeded. In practice, an
|
||||
// exception never has MARISA_OK because it is not an error.
|
||||
MARISA_OK = 0,
|
||||
|
||||
// MARISA_STATE_ERROR means that an object was not ready for a requested
|
||||
// operation. For example, an operation to modify a fixed vector throws an
|
||||
// exception with MARISA_STATE_ERROR.
|
||||
MARISA_STATE_ERROR = 1,
|
||||
|
||||
// MARISA_NULL_ERROR means that an invalid NULL pointer has been given.
|
||||
MARISA_NULL_ERROR = 2,
|
||||
|
||||
// MARISA_BOUND_ERROR means that an operation has tried to access an out of
|
||||
// range address.
|
||||
MARISA_BOUND_ERROR = 3,
|
||||
|
||||
// MARISA_RANGE_ERROR means that an out of range value has appeared in
|
||||
// operation.
|
||||
MARISA_RANGE_ERROR = 4,
|
||||
|
||||
// MARISA_CODE_ERROR means that an undefined code has appeared in operation.
|
||||
MARISA_CODE_ERROR = 5,
|
||||
|
||||
// MARISA_RESET_ERROR means that a smart pointer has tried to reset itself.
|
||||
MARISA_RESET_ERROR = 6,
|
||||
|
||||
// MARISA_SIZE_ERROR means that a size has exceeded a library limitation.
|
||||
MARISA_SIZE_ERROR = 7,
|
||||
|
||||
// MARISA_MEMORY_ERROR means that a memory allocation has failed.
|
||||
MARISA_MEMORY_ERROR = 8,
|
||||
|
||||
// MARISA_IO_ERROR means that an I/O operation has failed.
|
||||
MARISA_IO_ERROR = 9,
|
||||
|
||||
// MARISA_FORMAT_ERROR means that input was in invalid format.
|
||||
MARISA_FORMAT_ERROR = 10,
|
||||
} marisa_error_code;
|
||||
|
||||
// Min/max values, flags and masks for dictionary settings are defined below.
|
||||
// Please note that unspecified settings will be replaced with the default
|
||||
// settings. For example, 0 is equivalent to (MARISA_DEFAULT_NUM_TRIES |
|
||||
// MARISA_DEFAULT_TRIE | MARISA_DEFAULT_TAIL | MARISA_DEFAULT_ORDER).
|
||||
|
||||
// A dictionary consists of 3 tries in default. Usually more tries make a
|
||||
// dictionary space-efficient but time-inefficient.
|
||||
typedef enum marisa_num_tries_
|
||||
{
|
||||
MARISA_MIN_NUM_TRIES = 0x00001,
|
||||
MARISA_MAX_NUM_TRIES = 0x0007F,
|
||||
MARISA_DEFAULT_NUM_TRIES = 0x00003,
|
||||
} marisa_num_tries;
|
||||
|
||||
// This library uses a cache technique to accelerate search functions. The
|
||||
// following enumerated type marisa_cache_level gives a list of available cache
|
||||
// size options. A larger cache enables faster search but takes a more space.
|
||||
typedef enum marisa_cache_level_
|
||||
{
|
||||
MARISA_HUGE_CACHE = 0x00080,
|
||||
MARISA_LARGE_CACHE = 0x00100,
|
||||
MARISA_NORMAL_CACHE = 0x00200,
|
||||
MARISA_SMALL_CACHE = 0x00400,
|
||||
MARISA_TINY_CACHE = 0x00800,
|
||||
MARISA_DEFAULT_CACHE = MARISA_NORMAL_CACHE
|
||||
} marisa_cache_level;
|
||||
|
||||
// This library provides 2 kinds of TAIL implementations.
|
||||
typedef enum marisa_tail_mode_
|
||||
{
|
||||
// MARISA_TEXT_TAIL merges last labels as zero-terminated strings. So, it is
|
||||
// available if and only if the last labels do not contain a NULL character.
|
||||
// If MARISA_TEXT_TAIL is specified and a NULL character exists in the last
|
||||
// labels, the setting is automatically switched to MARISA_BINARY_TAIL.
|
||||
MARISA_TEXT_TAIL = 0x01000,
|
||||
|
||||
// MARISA_BINARY_TAIL also merges last labels but as byte sequences. It uses
|
||||
// a bit vector to detect the end of a sequence, instead of NULL characters.
|
||||
// So, MARISA_BINARY_TAIL requires a larger space if the average length of
|
||||
// labels is greater than 8.
|
||||
MARISA_BINARY_TAIL = 0x02000,
|
||||
|
||||
MARISA_DEFAULT_TAIL = MARISA_TEXT_TAIL,
|
||||
} marisa_tail_mode;
|
||||
|
||||
// The arrangement of nodes affects the time cost of matching and the order of
|
||||
// predictive search.
|
||||
typedef enum marisa_node_order_
|
||||
{
|
||||
// MARISA_LABEL_ORDER arranges nodes in ascending label order.
|
||||
// MARISA_LABEL_ORDER is useful if an application needs to predict keys in
|
||||
// label order.
|
||||
MARISA_LABEL_ORDER = 0x10000,
|
||||
|
||||
// MARISA_WEIGHT_ORDER arranges nodes in descending weight order.
|
||||
// MARISA_WEIGHT_ORDER is generally a better choice because it enables faster
|
||||
// matching.
|
||||
MARISA_WEIGHT_ORDER = 0x20000,
|
||||
|
||||
MARISA_DEFAULT_ORDER = MARISA_WEIGHT_ORDER,
|
||||
} marisa_node_order;
|
||||
|
||||
typedef enum marisa_config_mask_
|
||||
{
|
||||
MARISA_NUM_TRIES_MASK = 0x0007F,
|
||||
MARISA_CACHE_LEVEL_MASK = 0x00F80,
|
||||
MARISA_TAIL_MODE_MASK = 0x0F000,
|
||||
MARISA_NODE_ORDER_MASK = 0xF0000,
|
||||
MARISA_CONFIG_MASK = 0xFFFFF
|
||||
} marisa_config_mask;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// `std::swap` is in <utility> since C++ 11 but in <algorithm> in C++ 98:
|
||||
#if __cplusplus >= 201103L
|
||||
#include <utility>
|
||||
#else
|
||||
#include <algorithm>
|
||||
#endif
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
typedef ::marisa_uint8 UInt8;
|
||||
typedef ::marisa_uint16 UInt16;
|
||||
typedef ::marisa_uint32 UInt32;
|
||||
typedef ::marisa_uint64 UInt64;
|
||||
|
||||
typedef ::marisa_error_code ErrorCode;
|
||||
|
||||
typedef ::marisa_cache_level CacheLevel;
|
||||
typedef ::marisa_tail_mode TailMode;
|
||||
typedef ::marisa_node_order NodeOrder;
|
||||
|
||||
using std::swap;
|
||||
|
||||
} // namespace marisa
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "marisa/exception.h"
|
||||
#include "marisa/scoped-array.h"
|
||||
#include "marisa/scoped-ptr.h"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // MARISA_BASE_H_
|
|
@ -1,93 +0,0 @@
|
|||
#ifndef MARISA_EXCEPTION_H_
|
||||
#define MARISA_EXCEPTION_H_
|
||||
|
||||
#include <exception>
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
// An exception object keeps a filename, a line number, an error code and an
|
||||
// error message. The message format is as follows:
|
||||
// "__FILE__:__LINE__: error_code: error_message"
|
||||
class Exception : public std::exception
|
||||
{
|
||||
public:
|
||||
Exception(const char *filename, int line, ErrorCode error_code, const char *error_message)
|
||||
: std::exception(), filename_(filename), line_(line), error_code_(error_code), error_message_(error_message)
|
||||
{
|
||||
}
|
||||
Exception(const Exception &ex)
|
||||
: std::exception(), filename_(ex.filename_), line_(ex.line_), error_code_(ex.error_code_),
|
||||
error_message_(ex.error_message_)
|
||||
{
|
||||
}
|
||||
virtual ~Exception() throw()
|
||||
{
|
||||
}
|
||||
|
||||
Exception &operator=(const Exception &rhs)
|
||||
{
|
||||
filename_ = rhs.filename_;
|
||||
line_ = rhs.line_;
|
||||
error_code_ = rhs.error_code_;
|
||||
error_message_ = rhs.error_message_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const char *filename() const
|
||||
{
|
||||
return filename_;
|
||||
}
|
||||
int line() const
|
||||
{
|
||||
return line_;
|
||||
}
|
||||
ErrorCode error_code() const
|
||||
{
|
||||
return error_code_;
|
||||
}
|
||||
const char *error_message() const
|
||||
{
|
||||
return error_message_;
|
||||
}
|
||||
|
||||
virtual const char *what() const throw()
|
||||
{
|
||||
return error_message_;
|
||||
}
|
||||
|
||||
private:
|
||||
const char *filename_;
|
||||
int line_;
|
||||
ErrorCode error_code_;
|
||||
const char *error_message_;
|
||||
};
|
||||
|
||||
// These macros are used to convert a line number to a string constant.
|
||||
#define MARISA_INT_TO_STR(value) #value
|
||||
#define MARISA_LINE_TO_STR(line) MARISA_INT_TO_STR(line)
|
||||
#define MARISA_LINE_STR MARISA_LINE_TO_STR(__LINE__)
|
||||
|
||||
// MARISA_THROW throws an exception with a filename, a line number, an error
|
||||
// code and an error message. The message format is as follows:
|
||||
// "__FILE__:__LINE__: error_code: error_message"
|
||||
#define MARISA_THROW(error_code, error_message) \
|
||||
(throw marisa::Exception(__FILE__, __LINE__, error_code, \
|
||||
__FILE__ ":" MARISA_LINE_STR ": " #error_code ": " error_message))
|
||||
|
||||
// MARISA_THROW_IF throws an exception if `condition' is true.
|
||||
#define MARISA_THROW_IF(condition, error_code) (void)((!(condition)) || (MARISA_THROW(error_code, #condition), 0))
|
||||
|
||||
// MARISA_DEBUG_IF is ignored if _DEBUG is undefined. So, it is useful for
|
||||
// debugging time-critical codes.
|
||||
#ifdef _DEBUG
|
||||
#define MARISA_DEBUG_IF(cond, error_code) MARISA_THROW_IF(cond, error_code)
|
||||
#else
|
||||
#define MARISA_DEBUG_IF(cond, error_code)
|
||||
#endif
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_EXCEPTION_H_
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef MARISA_IOSTREAM_H_
|
||||
#define MARISA_IOSTREAM_H_
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
class Trie;
|
||||
|
||||
std::istream &read(std::istream &stream, Trie *trie);
|
||||
std::ostream &write(std::ostream &stream, const Trie &trie);
|
||||
|
||||
std::istream &operator>>(std::istream &stream, Trie &trie);
|
||||
std::ostream &operator<<(std::ostream &stream, const Trie &trie);
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_IOSTREAM_H_
|
|
@ -1,102 +0,0 @@
|
|||
#ifndef MARISA_KEY_H_
|
||||
#define MARISA_KEY_H_
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
class Key
|
||||
{
|
||||
public:
|
||||
Key() : ptr_(NULL), length_(0), union_()
|
||||
{
|
||||
union_.id = 0;
|
||||
}
|
||||
Key(const Key &key) : ptr_(key.ptr_), length_(key.length_), union_(key.union_)
|
||||
{
|
||||
}
|
||||
|
||||
Key &operator=(const Key &key)
|
||||
{
|
||||
ptr_ = key.ptr_;
|
||||
length_ = key.length_;
|
||||
union_ = key.union_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
char operator[](std::size_t i) const
|
||||
{
|
||||
MARISA_DEBUG_IF(i >= length_, MARISA_BOUND_ERROR);
|
||||
return ptr_[i];
|
||||
}
|
||||
|
||||
void set_str(const char *str)
|
||||
{
|
||||
MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
|
||||
std::size_t length = 0;
|
||||
while (str[length] != '\0')
|
||||
{
|
||||
++length;
|
||||
}
|
||||
MARISA_DEBUG_IF(length > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
ptr_ = str;
|
||||
length_ = (UInt32)length;
|
||||
}
|
||||
void set_str(const char *ptr, std::size_t length)
|
||||
{
|
||||
MARISA_DEBUG_IF((ptr == NULL) && (length != 0), MARISA_NULL_ERROR);
|
||||
MARISA_DEBUG_IF(length > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
ptr_ = ptr;
|
||||
length_ = (UInt32)length;
|
||||
}
|
||||
void set_id(std::size_t id)
|
||||
{
|
||||
MARISA_DEBUG_IF(id > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
union_.id = (UInt32)id;
|
||||
}
|
||||
void set_weight(float weight)
|
||||
{
|
||||
union_.weight = weight;
|
||||
}
|
||||
|
||||
const char *ptr() const
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
std::size_t length() const
|
||||
{
|
||||
return length_;
|
||||
}
|
||||
std::size_t id() const
|
||||
{
|
||||
return union_.id;
|
||||
}
|
||||
float weight() const
|
||||
{
|
||||
return union_.weight;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
Key().swap(*this);
|
||||
}
|
||||
void swap(Key &rhs)
|
||||
{
|
||||
marisa::swap(ptr_, rhs.ptr_);
|
||||
marisa::swap(length_, rhs.length_);
|
||||
marisa::swap(union_.id, rhs.union_.id);
|
||||
}
|
||||
|
||||
private:
|
||||
const char *ptr_;
|
||||
UInt32 length_;
|
||||
union Union {
|
||||
UInt32 id;
|
||||
float weight;
|
||||
} union_;
|
||||
};
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_KEY_H_
|
|
@ -1,89 +0,0 @@
|
|||
#ifndef MARISA_KEYSET_H_
|
||||
#define MARISA_KEYSET_H_
|
||||
|
||||
#include "marisa/key.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
class Keyset
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
BASE_BLOCK_SIZE = 4096,
|
||||
EXTRA_BLOCK_SIZE = 1024,
|
||||
KEY_BLOCK_SIZE = 256
|
||||
};
|
||||
|
||||
Keyset();
|
||||
|
||||
void push_back(const Key &key);
|
||||
void push_back(const Key &key, char end_marker);
|
||||
|
||||
void push_back(const char *str);
|
||||
void push_back(const char *ptr, std::size_t length, float weight = 1.0);
|
||||
|
||||
const Key &operator[](std::size_t i) const
|
||||
{
|
||||
MARISA_DEBUG_IF(i >= size_, MARISA_BOUND_ERROR);
|
||||
return key_blocks_[i / KEY_BLOCK_SIZE][i % KEY_BLOCK_SIZE];
|
||||
}
|
||||
Key &operator[](std::size_t i)
|
||||
{
|
||||
MARISA_DEBUG_IF(i >= size_, MARISA_BOUND_ERROR);
|
||||
return key_blocks_[i / KEY_BLOCK_SIZE][i % KEY_BLOCK_SIZE];
|
||||
}
|
||||
|
||||
std::size_t num_keys() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return size_ == 0;
|
||||
}
|
||||
std::size_t size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
std::size_t total_length() const
|
||||
{
|
||||
return total_length_;
|
||||
}
|
||||
|
||||
void reset();
|
||||
|
||||
void clear();
|
||||
void swap(Keyset &rhs);
|
||||
|
||||
private:
|
||||
scoped_array<scoped_array<char>> base_blocks_;
|
||||
std::size_t base_blocks_size_;
|
||||
std::size_t base_blocks_capacity_;
|
||||
scoped_array<scoped_array<char>> extra_blocks_;
|
||||
std::size_t extra_blocks_size_;
|
||||
std::size_t extra_blocks_capacity_;
|
||||
scoped_array<scoped_array<Key>> key_blocks_;
|
||||
std::size_t key_blocks_size_;
|
||||
std::size_t key_blocks_capacity_;
|
||||
char *ptr_;
|
||||
std::size_t avail_;
|
||||
std::size_t size_;
|
||||
std::size_t total_length_;
|
||||
|
||||
char *reserve(std::size_t size);
|
||||
|
||||
void append_base_block();
|
||||
void append_extra_block(std::size_t size);
|
||||
void append_key_block();
|
||||
|
||||
// Disallows copy and assignment.
|
||||
Keyset(const Keyset &);
|
||||
Keyset &operator=(const Keyset &);
|
||||
};
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_KEYSET_H_
|
|
@ -1,87 +0,0 @@
|
|||
#ifndef MARISA_QUERY_H_
|
||||
#define MARISA_QUERY_H_
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
class Query
|
||||
{
|
||||
public:
|
||||
Query() : ptr_(NULL), length_(0), id_(0)
|
||||
{
|
||||
}
|
||||
Query(const Query &query) : ptr_(query.ptr_), length_(query.length_), id_(query.id_)
|
||||
{
|
||||
}
|
||||
|
||||
Query &operator=(const Query &query)
|
||||
{
|
||||
ptr_ = query.ptr_;
|
||||
length_ = query.length_;
|
||||
id_ = query.id_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
char operator[](std::size_t i) const
|
||||
{
|
||||
MARISA_DEBUG_IF(i >= length_, MARISA_BOUND_ERROR);
|
||||
return ptr_[i];
|
||||
}
|
||||
|
||||
void set_str(const char *str)
|
||||
{
|
||||
MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
|
||||
std::size_t length = 0;
|
||||
while (str[length] != '\0')
|
||||
{
|
||||
++length;
|
||||
}
|
||||
ptr_ = str;
|
||||
length_ = length;
|
||||
}
|
||||
void set_str(const char *ptr, std::size_t length)
|
||||
{
|
||||
MARISA_DEBUG_IF((ptr == NULL) && (length != 0), MARISA_NULL_ERROR);
|
||||
ptr_ = ptr;
|
||||
length_ = length;
|
||||
}
|
||||
void set_id(std::size_t id)
|
||||
{
|
||||
id_ = id;
|
||||
}
|
||||
|
||||
const char *ptr() const
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
std::size_t length() const
|
||||
{
|
||||
return length_;
|
||||
}
|
||||
std::size_t id() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
Query().swap(*this);
|
||||
}
|
||||
void swap(Query &rhs)
|
||||
{
|
||||
marisa::swap(ptr_, rhs.ptr_);
|
||||
marisa::swap(length_, rhs.length_);
|
||||
marisa::swap(id_, rhs.id_);
|
||||
}
|
||||
|
||||
private:
|
||||
const char *ptr_;
|
||||
std::size_t length_;
|
||||
std::size_t id_;
|
||||
};
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_QUERY_H_
|
|
@ -1,59 +0,0 @@
|
|||
#ifndef MARISA_SCOPED_ARRAY_H_
|
||||
#define MARISA_SCOPED_ARRAY_H_
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
template <typename T> class scoped_array
|
||||
{
|
||||
public:
|
||||
scoped_array() : array_(NULL)
|
||||
{
|
||||
}
|
||||
explicit scoped_array(T *array) : array_(array)
|
||||
{
|
||||
}
|
||||
|
||||
~scoped_array()
|
||||
{
|
||||
delete[] array_;
|
||||
}
|
||||
|
||||
void reset(T *array = NULL)
|
||||
{
|
||||
MARISA_THROW_IF((array != NULL) && (array == array_), MARISA_RESET_ERROR);
|
||||
scoped_array(array).swap(*this);
|
||||
}
|
||||
|
||||
T &operator[](std::size_t i) const
|
||||
{
|
||||
MARISA_DEBUG_IF(array_ == NULL, MARISA_STATE_ERROR);
|
||||
return array_[i];
|
||||
}
|
||||
T *get() const
|
||||
{
|
||||
return array_;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
scoped_array().swap(*this);
|
||||
}
|
||||
void swap(scoped_array &rhs)
|
||||
{
|
||||
marisa::swap(array_, rhs.array_);
|
||||
}
|
||||
|
||||
private:
|
||||
T *array_;
|
||||
|
||||
// Disallows copy and assignment.
|
||||
scoped_array(const scoped_array &);
|
||||
scoped_array &operator=(const scoped_array &);
|
||||
};
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_SCOPED_ARRAY_H_
|
|
@ -1,64 +0,0 @@
|
|||
#ifndef MARISA_SCOPED_PTR_H_
|
||||
#define MARISA_SCOPED_PTR_H_
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
template <typename T> class scoped_ptr
|
||||
{
|
||||
public:
|
||||
scoped_ptr() : ptr_(NULL)
|
||||
{
|
||||
}
|
||||
explicit scoped_ptr(T *ptr) : ptr_(ptr)
|
||||
{
|
||||
}
|
||||
|
||||
~scoped_ptr()
|
||||
{
|
||||
delete ptr_;
|
||||
}
|
||||
|
||||
void reset(T *ptr = NULL)
|
||||
{
|
||||
MARISA_THROW_IF((ptr != NULL) && (ptr == ptr_), MARISA_RESET_ERROR);
|
||||
scoped_ptr(ptr).swap(*this);
|
||||
}
|
||||
|
||||
T &operator*() const
|
||||
{
|
||||
MARISA_DEBUG_IF(ptr_ == NULL, MARISA_STATE_ERROR);
|
||||
return *ptr_;
|
||||
}
|
||||
T *operator->() const
|
||||
{
|
||||
MARISA_DEBUG_IF(ptr_ == NULL, MARISA_STATE_ERROR);
|
||||
return ptr_;
|
||||
}
|
||||
T *get() const
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
scoped_ptr().swap(*this);
|
||||
}
|
||||
void swap(scoped_ptr &rhs)
|
||||
{
|
||||
marisa::swap(ptr_, rhs.ptr_);
|
||||
}
|
||||
|
||||
private:
|
||||
T *ptr_;
|
||||
|
||||
// Disallows copy and assignment.
|
||||
scoped_ptr(const scoped_ptr &);
|
||||
scoped_ptr &operator=(const scoped_ptr &);
|
||||
};
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_SCOPED_PTR_H_
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef MARISA_MYSTDIO_H_
|
||||
#define MARISA_MYSTDIO_H_
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
class Trie;
|
||||
|
||||
void fread(std::FILE *file, Trie *trie);
|
||||
void fwrite(std::FILE *file, const Trie &trie);
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_MYSTDIO_H_
|
|
@ -1,68 +0,0 @@
|
|||
#ifndef MARISA_TRIE_H_
|
||||
#define MARISA_TRIE_H_
|
||||
|
||||
#include "marisa/agent.h"
|
||||
#include "marisa/keyset.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace trie
|
||||
{
|
||||
|
||||
class LoudsTrie;
|
||||
|
||||
} // namespace trie
|
||||
} // namespace grimoire
|
||||
|
||||
class Trie
|
||||
{
|
||||
friend class TrieIO;
|
||||
|
||||
public:
|
||||
Trie();
|
||||
~Trie();
|
||||
|
||||
void build(Keyset &keyset, int config_flags = 0);
|
||||
|
||||
void mmap(const char *filename);
|
||||
void map(const void *ptr, std::size_t size);
|
||||
|
||||
void load(const char *filename);
|
||||
void read(int fd);
|
||||
|
||||
void save(const char *filename) const;
|
||||
void write(int fd) const;
|
||||
|
||||
bool lookup(Agent &agent) const;
|
||||
void reverse_lookup(Agent &agent) const;
|
||||
bool common_prefix_search(Agent &agent) const;
|
||||
bool predictive_search(Agent &agent) const;
|
||||
|
||||
std::size_t num_tries() const;
|
||||
std::size_t num_keys() const;
|
||||
std::size_t num_nodes() const;
|
||||
|
||||
TailMode tail_mode() const;
|
||||
NodeOrder node_order() const;
|
||||
|
||||
bool empty() const;
|
||||
std::size_t size() const;
|
||||
std::size_t total_size() const;
|
||||
std::size_t io_size() const;
|
||||
|
||||
void clear();
|
||||
void swap(Trie &rhs);
|
||||
|
||||
private:
|
||||
scoped_ptr<grimoire::trie::LoudsTrie> trie_;
|
||||
|
||||
// Disallows copy and assignment.
|
||||
Trie(const Trie &);
|
||||
Trie &operator=(const Trie &);
|
||||
};
|
||||
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_TRIE_H_
|
|
@ -1,65 +0,0 @@
|
|||
#include <new>
|
||||
|
||||
#include "marisa/agent.h"
|
||||
#include "marisa/grimoire/trie.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
|
||||
Agent::Agent() : query_(), key_(), state_()
|
||||
{
|
||||
}
|
||||
|
||||
Agent::~Agent()
|
||||
{
|
||||
}
|
||||
|
||||
void Agent::set_query(const char *str)
|
||||
{
|
||||
MARISA_THROW_IF(str == NULL, MARISA_NULL_ERROR);
|
||||
if (state_.get() != NULL)
|
||||
{
|
||||
state_->reset();
|
||||
}
|
||||
query_.set_str(str);
|
||||
}
|
||||
|
||||
void Agent::set_query(const char *ptr, std::size_t length)
|
||||
{
|
||||
MARISA_THROW_IF((ptr == NULL) && (length != 0), MARISA_NULL_ERROR);
|
||||
if (state_.get() != NULL)
|
||||
{
|
||||
state_->reset();
|
||||
}
|
||||
query_.set_str(ptr, length);
|
||||
}
|
||||
|
||||
void Agent::set_query(std::size_t key_id)
|
||||
{
|
||||
if (state_.get() != NULL)
|
||||
{
|
||||
state_->reset();
|
||||
}
|
||||
query_.set_id(key_id);
|
||||
}
|
||||
|
||||
void Agent::init_state()
|
||||
{
|
||||
MARISA_THROW_IF(state_.get() != NULL, MARISA_STATE_ERROR);
|
||||
state_.reset(new (std::nothrow) grimoire::State);
|
||||
MARISA_THROW_IF(state_.get() == NULL, MARISA_MEMORY_ERROR);
|
||||
}
|
||||
|
||||
void Agent::clear()
|
||||
{
|
||||
Agent().swap(*this);
|
||||
}
|
||||
|
||||
void Agent::swap(Agent &rhs)
|
||||
{
|
||||
query_.swap(rhs.query_);
|
||||
key_.swap(rhs.key_);
|
||||
state_.swap(rhs.state_);
|
||||
}
|
||||
|
||||
} // namespace marisa
|
|
@ -1,31 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_ALGORITHM_H_
|
||||
#define MARISA_GRIMOIRE_ALGORITHM_H_
|
||||
|
||||
#include "marisa/grimoire/algorithm/sort.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
|
||||
class Algorithm
|
||||
{
|
||||
public:
|
||||
Algorithm()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Iterator> std::size_t sort(Iterator begin, Iterator end) const
|
||||
{
|
||||
return algorithm::sort(begin, end);
|
||||
}
|
||||
|
||||
private:
|
||||
Algorithm(const Algorithm &);
|
||||
Algorithm &operator=(const Algorithm &);
|
||||
};
|
||||
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_ALGORITHM_H_
|
|
@ -1,261 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_ALGORITHM_SORT_H_
|
||||
#define MARISA_GRIMOIRE_ALGORITHM_SORT_H_
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace algorithm
|
||||
{
|
||||
namespace details
|
||||
{
|
||||
|
||||
enum
|
||||
{
|
||||
MARISA_INSERTION_SORT_THRESHOLD = 10
|
||||
};
|
||||
|
||||
template <typename T> int get_label(const T &unit, std::size_t depth)
|
||||
{
|
||||
MARISA_DEBUG_IF(depth > unit.length(), MARISA_BOUND_ERROR);
|
||||
|
||||
return (depth < unit.length()) ? (int)(UInt8)unit[depth] : -1;
|
||||
}
|
||||
|
||||
template <typename T> int median(const T &a, const T &b, const T &c, std::size_t depth)
|
||||
{
|
||||
const int x = get_label(a, depth);
|
||||
const int y = get_label(b, depth);
|
||||
const int z = get_label(c, depth);
|
||||
if (x < y)
|
||||
{
|
||||
if (y < z)
|
||||
{
|
||||
return y;
|
||||
}
|
||||
else if (x < z)
|
||||
{
|
||||
return z;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
else if (x < z)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
else if (y < z)
|
||||
{
|
||||
return z;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
template <typename T> int compare(const T &lhs, const T &rhs, std::size_t depth)
|
||||
{
|
||||
for (std::size_t i = depth; i < lhs.length(); ++i)
|
||||
{
|
||||
if (i == rhs.length())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (lhs[i] != rhs[i])
|
||||
{
|
||||
return (UInt8)lhs[i] - (UInt8)rhs[i];
|
||||
}
|
||||
}
|
||||
if (lhs.length() == rhs.length())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return (lhs.length() < rhs.length()) ? -1 : 1;
|
||||
}
|
||||
|
||||
template <typename Iterator> std::size_t insertion_sort(Iterator l, Iterator r, std::size_t depth)
|
||||
{
|
||||
MARISA_DEBUG_IF(l > r, MARISA_BOUND_ERROR);
|
||||
|
||||
std::size_t count = 1;
|
||||
for (Iterator i = l + 1; i < r; ++i)
|
||||
{
|
||||
int result = 0;
|
||||
for (Iterator j = i; j > l; --j)
|
||||
{
|
||||
result = compare(*(j - 1), *j, depth);
|
||||
if (result <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
marisa::swap(*(j - 1), *j);
|
||||
}
|
||||
if (result != 0)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
template <typename Iterator> std::size_t sort(Iterator l, Iterator r, std::size_t depth)
|
||||
{
|
||||
MARISA_DEBUG_IF(l > r, MARISA_BOUND_ERROR);
|
||||
|
||||
std::size_t count = 0;
|
||||
while ((r - l) > MARISA_INSERTION_SORT_THRESHOLD)
|
||||
{
|
||||
Iterator pl = l;
|
||||
Iterator pr = r;
|
||||
Iterator pivot_l = l;
|
||||
Iterator pivot_r = r;
|
||||
|
||||
const int pivot = median(*l, *(l + (r - l) / 2), *(r - 1), depth);
|
||||
for (;;)
|
||||
{
|
||||
while (pl < pr)
|
||||
{
|
||||
const int label = get_label(*pl, depth);
|
||||
if (label > pivot)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (label == pivot)
|
||||
{
|
||||
marisa::swap(*pl, *pivot_l);
|
||||
++pivot_l;
|
||||
}
|
||||
++pl;
|
||||
}
|
||||
while (pl < pr)
|
||||
{
|
||||
const int label = get_label(*--pr, depth);
|
||||
if (label < pivot)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (label == pivot)
|
||||
{
|
||||
marisa::swap(*pr, *--pivot_r);
|
||||
}
|
||||
}
|
||||
if (pl >= pr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
marisa::swap(*pl, *pr);
|
||||
++pl;
|
||||
}
|
||||
while (pivot_l > l)
|
||||
{
|
||||
marisa::swap(*--pivot_l, *--pl);
|
||||
}
|
||||
while (pivot_r < r)
|
||||
{
|
||||
marisa::swap(*pivot_r, *pr);
|
||||
++pivot_r;
|
||||
++pr;
|
||||
}
|
||||
|
||||
if (((pl - l) > (pr - pl)) || ((r - pr) > (pr - pl)))
|
||||
{
|
||||
if ((pr - pl) == 1)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
else if ((pr - pl) > 1)
|
||||
{
|
||||
if (pivot == -1)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
else
|
||||
{
|
||||
count += sort(pl, pr, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((pl - l) < (r - pr))
|
||||
{
|
||||
if ((pl - l) == 1)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
else if ((pl - l) > 1)
|
||||
{
|
||||
count += sort(l, pl, depth);
|
||||
}
|
||||
l = pr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((r - pr) == 1)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
else if ((r - pr) > 1)
|
||||
{
|
||||
count += sort(pr, r, depth);
|
||||
}
|
||||
r = pl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((pl - l) == 1)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
else if ((pl - l) > 1)
|
||||
{
|
||||
count += sort(l, pl, depth);
|
||||
}
|
||||
|
||||
if ((r - pr) == 1)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
else if ((r - pr) > 1)
|
||||
{
|
||||
count += sort(pr, r, depth);
|
||||
}
|
||||
|
||||
l = pl, r = pr;
|
||||
if ((pr - pl) == 1)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
else if ((pr - pl) > 1)
|
||||
{
|
||||
if (pivot == -1)
|
||||
{
|
||||
l = r;
|
||||
++count;
|
||||
}
|
||||
else
|
||||
{
|
||||
++depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((r - l) > 1)
|
||||
{
|
||||
count += insertion_sort(l, r, depth);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
} // namespace details
|
||||
|
||||
template <typename Iterator> std::size_t sort(Iterator begin, Iterator end)
|
||||
{
|
||||
MARISA_DEBUG_IF(begin > end, MARISA_BOUND_ERROR);
|
||||
return details::sort(begin, end, 0);
|
||||
};
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_ALGORITHM_SORT_H_
|
|
@ -1,138 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_INTRIN_H_
|
||||
#define MARISA_GRIMOIRE_INTRIN_H_
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
#define MARISA_X64
|
||||
#elif defined(__i386__) || defined(_M_IX86)
|
||||
#define MARISA_X86
|
||||
#else // defined(__i386__) || defined(_M_IX86)
|
||||
#ifdef MARISA_USE_BMI2
|
||||
#undef MARISA_USE_BMI2
|
||||
#endif // MARISA_USE_BMI2
|
||||
#ifdef MARISA_USE_BMI
|
||||
#undef MARISA_USE_BMI
|
||||
#endif // MARISA_USE_BMI
|
||||
#ifdef MARISA_USE_POPCNT
|
||||
#undef MARISA_USE_POPCNT
|
||||
#endif // MARISA_USE_POPCNT
|
||||
#ifdef MARISA_USE_SSE4A
|
||||
#undef MARISA_USE_SSE4A
|
||||
#endif // MARISA_USE_SSE4A
|
||||
#ifdef MARISA_USE_SSE4
|
||||
#undef MARISA_USE_SSE4
|
||||
#endif // MARISA_USE_SSE4
|
||||
#ifdef MARISA_USE_SSE4_2
|
||||
#undef MARISA_USE_SSE4_2
|
||||
#endif // MARISA_USE_SSE4_2
|
||||
#ifdef MARISA_USE_SSE4_1
|
||||
#undef MARISA_USE_SSE4_1
|
||||
#endif // MARISA_USE_SSE4_1
|
||||
#ifdef MARISA_USE_SSSE3
|
||||
#undef MARISA_USE_SSSE3
|
||||
#endif // MARISA_USE_SSSE3
|
||||
#ifdef MARISA_USE_SSE3
|
||||
#undef MARISA_USE_SSE3
|
||||
#endif // MARISA_USE_SSE3
|
||||
#ifdef MARISA_USE_SSE2
|
||||
#undef MARISA_USE_SSE2
|
||||
#endif // MARISA_USE_SSE2
|
||||
#endif // defined(__i386__) || defined(_M_IX86)
|
||||
|
||||
#ifdef MARISA_USE_BMI2
|
||||
#ifndef MARISA_USE_BMI
|
||||
#define MARISA_USE_BMI
|
||||
#endif // MARISA_USE_BMI
|
||||
#ifdef _MSC_VER
|
||||
#include <immintrin.h>
|
||||
#else // _MSC_VER
|
||||
#include <x86intrin.h>
|
||||
#endif // _MSC_VER
|
||||
#endif // MARISA_USE_BMI2
|
||||
|
||||
#ifdef MARISA_USE_BMI
|
||||
#ifndef MARISA_USE_SSE4
|
||||
#define MARISA_USE_SSE4
|
||||
#endif // MARISA_USE_SSE4
|
||||
#endif // MARISA_USE_BMI
|
||||
|
||||
#ifdef MARISA_USE_SSE4A
|
||||
#ifndef MARISA_USE_SSE3
|
||||
#define MARISA_USE_SSE3
|
||||
#endif // MARISA_USE_SSE3
|
||||
#ifndef MARISA_USE_POPCNT
|
||||
#define MARISA_USE_POPCNT
|
||||
#endif // MARISA_USE_POPCNT
|
||||
#endif // MARISA_USE_SSE4A
|
||||
|
||||
#ifdef MARISA_USE_SSE4
|
||||
#ifndef MARISA_USE_SSE4_2
|
||||
#define MARISA_USE_SSE4_2
|
||||
#endif // MARISA_USE_SSE4_2
|
||||
#endif // MARISA_USE_SSE4
|
||||
|
||||
#ifdef MARISA_USE_SSE4_2
|
||||
#ifndef MARISA_USE_SSE4_1
|
||||
#define MARISA_USE_SSE4_1
|
||||
#endif // MARISA_USE_SSE4_1
|
||||
#ifndef MARISA_USE_POPCNT
|
||||
#define MARISA_USE_POPCNT
|
||||
#endif // MARISA_USE_POPCNT
|
||||
#endif // MARISA_USE_SSE4_2
|
||||
|
||||
#ifdef MARISA_USE_SSE4_1
|
||||
#ifndef MARISA_USE_SSSE3
|
||||
#define MARISA_USE_SSSE3
|
||||
#endif // MARISA_USE_SSSE3
|
||||
#endif // MARISA_USE_SSE4_1
|
||||
|
||||
#ifdef MARISA_USE_POPCNT
|
||||
#ifndef MARISA_USE_SSE3
|
||||
#define MARISA_USE_SSE3
|
||||
#endif // MARISA_USE_SSE3
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#else // _MSC_VER
|
||||
#include <popcntintrin.h>
|
||||
#endif // _MSC_VER
|
||||
#endif // MARISA_USE_POPCNT
|
||||
|
||||
#ifdef MARISA_USE_SSSE3
|
||||
#ifndef MARISA_USE_SSE3
|
||||
#define MARISA_USE_SSE3
|
||||
#endif // MARISA_USE_SSE3
|
||||
#ifdef MARISA_X64
|
||||
#define MARISA_X64_SSSE3
|
||||
#else // MARISA_X64
|
||||
#define MARISA_X86_SSSE3
|
||||
#endif // MAIRSA_X64
|
||||
#include <tmmintrin.h>
|
||||
#endif // MARISA_USE_SSSE3
|
||||
|
||||
#ifdef MARISA_USE_SSE3
|
||||
#ifndef MARISA_USE_SSE2
|
||||
#define MARISA_USE_SSE2
|
||||
#endif // MARISA_USE_SSE2
|
||||
#endif // MARISA_USE_SSE3
|
||||
|
||||
#ifdef MARISA_USE_SSE2
|
||||
#ifdef MARISA_X64
|
||||
#define MARISA_X64_SSE2
|
||||
#else // MARISA_X64
|
||||
#define MARISA_X86_SSE2
|
||||
#endif // MAIRSA_X64
|
||||
#include <emmintrin.h>
|
||||
#endif // MARISA_USE_SSE2
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if MARISA_WORD_SIZE == 64
|
||||
#include <intrin.h>
|
||||
#pragma intrinsic(_BitScanForward64)
|
||||
#else // MARISA_WORD_SIZE == 64
|
||||
#include <intrin.h>
|
||||
#pragma intrinsic(_BitScanForward)
|
||||
#endif // MARISA_WORD_SIZE == 64
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // MARISA_GRIMOIRE_INTRIN_H_
|
|
@ -1,20 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_IO_H_
|
||||
#define MARISA_GRIMOIRE_IO_H_
|
||||
|
||||
#include "marisa/grimoire/io/mapper.h"
|
||||
#include "marisa/grimoire/io/reader.h"
|
||||
#include "marisa/grimoire/io/writer.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
|
||||
using io::Mapper;
|
||||
using io::Reader;
|
||||
using io::Writer;
|
||||
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_IO_H_
|
|
@ -1,183 +0,0 @@
|
|||
#if (defined _WIN32) || (defined _WIN64)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <windows.h>
|
||||
#else // (defined _WIN32) || (defined _WIN64)
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#endif // (defined _WIN32) || (defined _WIN64)
|
||||
|
||||
#include "marisa/grimoire/io/mapper.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
#if (defined _WIN32) || (defined _WIN64)
|
||||
Mapper::Mapper() : ptr_(NULL), origin_(NULL), avail_(0), size_(0), file_(NULL), map_(NULL)
|
||||
{
|
||||
}
|
||||
#else // (defined _WIN32) || (defined _WIN64)
|
||||
Mapper::Mapper() : ptr_(NULL), origin_(MAP_FAILED), avail_(0), size_(0), fd_(-1)
|
||||
{
|
||||
}
|
||||
#endif // (defined _WIN32) || (defined _WIN64)
|
||||
|
||||
#if (defined _WIN32) || (defined _WIN64)
|
||||
Mapper::~Mapper()
|
||||
{
|
||||
if (origin_ != NULL)
|
||||
{
|
||||
::UnmapViewOfFile(origin_);
|
||||
}
|
||||
|
||||
if (map_ != NULL)
|
||||
{
|
||||
::CloseHandle(map_);
|
||||
}
|
||||
|
||||
if (file_ != NULL)
|
||||
{
|
||||
::CloseHandle(file_);
|
||||
}
|
||||
}
|
||||
#else // (defined _WIN32) || (defined _WIN64)
|
||||
Mapper::~Mapper()
|
||||
{
|
||||
if (origin_ != MAP_FAILED)
|
||||
{
|
||||
::munmap(origin_, size_);
|
||||
}
|
||||
|
||||
if (fd_ != -1)
|
||||
{
|
||||
::close(fd_);
|
||||
}
|
||||
}
|
||||
#endif // (defined _WIN32) || (defined _WIN64)
|
||||
|
||||
void Mapper::open(const char *filename)
|
||||
{
|
||||
MARISA_THROW_IF(filename == NULL, MARISA_NULL_ERROR);
|
||||
|
||||
Mapper temp;
|
||||
temp.open_(filename);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Mapper::open(const void *ptr, std::size_t size)
|
||||
{
|
||||
MARISA_THROW_IF((ptr == NULL) && (size != 0), MARISA_NULL_ERROR);
|
||||
|
||||
Mapper temp;
|
||||
temp.open_(ptr, size);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Mapper::seek(std::size_t size)
|
||||
{
|
||||
MARISA_THROW_IF(!is_open(), MARISA_STATE_ERROR);
|
||||
MARISA_THROW_IF(size > avail_, MARISA_IO_ERROR);
|
||||
|
||||
map_data(size);
|
||||
}
|
||||
|
||||
bool Mapper::is_open() const
|
||||
{
|
||||
return ptr_ != NULL;
|
||||
}
|
||||
|
||||
void Mapper::clear()
|
||||
{
|
||||
Mapper().swap(*this);
|
||||
}
|
||||
|
||||
void Mapper::swap(Mapper &rhs)
|
||||
{
|
||||
marisa::swap(ptr_, rhs.ptr_);
|
||||
marisa::swap(avail_, rhs.avail_);
|
||||
marisa::swap(origin_, rhs.origin_);
|
||||
marisa::swap(size_, rhs.size_);
|
||||
#if (defined _WIN32) || (defined _WIN64)
|
||||
marisa::swap(file_, rhs.file_);
|
||||
marisa::swap(map_, rhs.map_);
|
||||
#else // (defined _WIN32) || (defined _WIN64)
|
||||
marisa::swap(fd_, rhs.fd_);
|
||||
#endif // (defined _WIN32) || (defined _WIN64)
|
||||
}
|
||||
|
||||
const void *Mapper::map_data(std::size_t size)
|
||||
{
|
||||
MARISA_THROW_IF(!is_open(), MARISA_STATE_ERROR);
|
||||
MARISA_THROW_IF(size > avail_, MARISA_IO_ERROR);
|
||||
|
||||
const char *const data = static_cast<const char *>(ptr_);
|
||||
ptr_ = data + size;
|
||||
avail_ -= size;
|
||||
return data;
|
||||
}
|
||||
|
||||
#if (defined _WIN32) || (defined _WIN64)
|
||||
#ifdef __MSVCRT_VERSION__
|
||||
#if __MSVCRT_VERSION__ >= 0x0601
|
||||
#define MARISA_HAS_STAT64
|
||||
#endif // __MSVCRT_VERSION__ >= 0x0601
|
||||
#endif // __MSVCRT_VERSION__
|
||||
void Mapper::open_(const char *filename)
|
||||
{
|
||||
#ifdef MARISA_HAS_STAT64
|
||||
struct __stat64 st;
|
||||
MARISA_THROW_IF(::_stat64(filename, &st) != 0, MARISA_IO_ERROR);
|
||||
#else // MARISA_HAS_STAT64
|
||||
struct _stat st;
|
||||
MARISA_THROW_IF(::_stat(filename, &st) != 0, MARISA_IO_ERROR);
|
||||
#endif // MARISA_HAS_STAT64
|
||||
MARISA_THROW_IF((UInt64)st.st_size > MARISA_SIZE_MAX, MARISA_SIZE_ERROR);
|
||||
size_ = (std::size_t)st.st_size;
|
||||
|
||||
file_ = ::CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
MARISA_THROW_IF(file_ == INVALID_HANDLE_VALUE, MARISA_IO_ERROR);
|
||||
|
||||
map_ = ::CreateFileMapping(file_, NULL, PAGE_READONLY, 0, 0, NULL);
|
||||
MARISA_THROW_IF(map_ == NULL, MARISA_IO_ERROR);
|
||||
|
||||
origin_ = ::MapViewOfFile(map_, FILE_MAP_READ, 0, 0, 0);
|
||||
MARISA_THROW_IF(origin_ == NULL, MARISA_IO_ERROR);
|
||||
|
||||
ptr_ = static_cast<const char *>(origin_);
|
||||
avail_ = size_;
|
||||
}
|
||||
#else // (defined _WIN32) || (defined _WIN64)
|
||||
void Mapper::open_(const char *filename)
|
||||
{
|
||||
struct stat st;
|
||||
MARISA_THROW_IF(::stat(filename, &st) != 0, MARISA_IO_ERROR);
|
||||
MARISA_THROW_IF((UInt64)st.st_size > MARISA_SIZE_MAX, MARISA_SIZE_ERROR);
|
||||
size_ = (std::size_t)st.st_size;
|
||||
|
||||
fd_ = ::open(filename, O_RDONLY);
|
||||
MARISA_THROW_IF(fd_ == -1, MARISA_IO_ERROR);
|
||||
|
||||
origin_ = ::mmap(NULL, size_, PROT_READ, MAP_SHARED, fd_, 0);
|
||||
MARISA_THROW_IF(origin_ == MAP_FAILED, MARISA_IO_ERROR);
|
||||
|
||||
ptr_ = static_cast<const char *>(origin_);
|
||||
avail_ = size_;
|
||||
}
|
||||
#endif // (defined _WIN32) || (defined _WIN64)
|
||||
|
||||
void Mapper::open_(const void *ptr, std::size_t size)
|
||||
{
|
||||
ptr_ = ptr;
|
||||
avail_ = size;
|
||||
}
|
||||
|
||||
} // namespace io
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
|
@ -1,70 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_IO_MAPPER_H_
|
||||
#define MARISA_GRIMOIRE_IO_MAPPER_H_
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
class Mapper
|
||||
{
|
||||
public:
|
||||
Mapper();
|
||||
~Mapper();
|
||||
|
||||
void open(const char *filename);
|
||||
void open(const void *ptr, std::size_t size);
|
||||
|
||||
template <typename T> void map(T *obj)
|
||||
{
|
||||
MARISA_THROW_IF(obj == NULL, MARISA_NULL_ERROR);
|
||||
*obj = *static_cast<const T *>(map_data(sizeof(T)));
|
||||
}
|
||||
|
||||
template <typename T> void map(const T **objs, std::size_t num_objs)
|
||||
{
|
||||
MARISA_THROW_IF((objs == NULL) && (num_objs != 0), MARISA_NULL_ERROR);
|
||||
MARISA_THROW_IF(num_objs > (MARISA_SIZE_MAX / sizeof(T)), MARISA_SIZE_ERROR);
|
||||
*objs = static_cast<const T *>(map_data(sizeof(T) * num_objs));
|
||||
}
|
||||
|
||||
void seek(std::size_t size);
|
||||
|
||||
bool is_open() const;
|
||||
|
||||
void clear();
|
||||
void swap(Mapper &rhs);
|
||||
|
||||
private:
|
||||
const void *ptr_;
|
||||
void *origin_;
|
||||
std::size_t avail_;
|
||||
std::size_t size_;
|
||||
#if (defined _WIN32) || (defined _WIN64)
|
||||
void *file_;
|
||||
void *map_;
|
||||
#else // (defined _WIN32) || (defined _WIN64)
|
||||
int fd_;
|
||||
#endif // (defined _WIN32) || (defined _WIN64)
|
||||
|
||||
void open_(const char *filename);
|
||||
void open_(const void *ptr, std::size_t size);
|
||||
|
||||
const void *map_data(std::size_t size);
|
||||
|
||||
// Disallows copy and assignment.
|
||||
Mapper(const Mapper &);
|
||||
Mapper &operator=(const Mapper &);
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_IO_MAPPER_H_
|
|
@ -1,181 +0,0 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#else // _WIN32
|
||||
#include <unistd.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "marisa/grimoire/io/reader.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
Reader::Reader() : file_(NULL), fd_(-1), stream_(NULL), needs_fclose_(false)
|
||||
{
|
||||
}
|
||||
|
||||
Reader::~Reader()
|
||||
{
|
||||
if (needs_fclose_)
|
||||
{
|
||||
::fclose(file_);
|
||||
}
|
||||
}
|
||||
|
||||
void Reader::open(const char *filename)
|
||||
{
|
||||
MARISA_THROW_IF(filename == NULL, MARISA_NULL_ERROR);
|
||||
|
||||
Reader temp;
|
||||
temp.open_(filename);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Reader::open(std::FILE *file)
|
||||
{
|
||||
MARISA_THROW_IF(file == NULL, MARISA_NULL_ERROR);
|
||||
|
||||
Reader temp;
|
||||
temp.open_(file);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Reader::open(int fd)
|
||||
{
|
||||
MARISA_THROW_IF(fd == -1, MARISA_CODE_ERROR);
|
||||
|
||||
Reader temp;
|
||||
temp.open_(fd);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Reader::open(std::istream &stream)
|
||||
{
|
||||
Reader temp;
|
||||
temp.open_(stream);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Reader::clear()
|
||||
{
|
||||
Reader().swap(*this);
|
||||
}
|
||||
|
||||
void Reader::swap(Reader &rhs)
|
||||
{
|
||||
marisa::swap(file_, rhs.file_);
|
||||
marisa::swap(fd_, rhs.fd_);
|
||||
marisa::swap(stream_, rhs.stream_);
|
||||
marisa::swap(needs_fclose_, rhs.needs_fclose_);
|
||||
}
|
||||
|
||||
void Reader::seek(std::size_t size)
|
||||
{
|
||||
MARISA_THROW_IF(!is_open(), MARISA_STATE_ERROR);
|
||||
if (size == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (size <= 16)
|
||||
{
|
||||
char buf[16];
|
||||
read_data(buf, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[1024];
|
||||
while (size != 0)
|
||||
{
|
||||
const std::size_t count = (size < sizeof(buf)) ? size : sizeof(buf);
|
||||
read_data(buf, count);
|
||||
size -= count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Reader::is_open() const
|
||||
{
|
||||
return (file_ != NULL) || (fd_ != -1) || (stream_ != NULL);
|
||||
}
|
||||
|
||||
void Reader::open_(const char *filename)
|
||||
{
|
||||
std::FILE *file = NULL;
|
||||
#ifdef _MSC_VER
|
||||
MARISA_THROW_IF(::fopen_s(&file, filename, "rb") != 0, MARISA_IO_ERROR);
|
||||
#else // _MSC_VER
|
||||
file = ::fopen(filename, "rb");
|
||||
MARISA_THROW_IF(file == NULL, MARISA_IO_ERROR);
|
||||
#endif // _MSC_VER
|
||||
file_ = file;
|
||||
needs_fclose_ = true;
|
||||
}
|
||||
|
||||
void Reader::open_(std::FILE *file)
|
||||
{
|
||||
file_ = file;
|
||||
}
|
||||
|
||||
void Reader::open_(int fd)
|
||||
{
|
||||
fd_ = fd;
|
||||
}
|
||||
|
||||
void Reader::open_(std::istream &stream)
|
||||
{
|
||||
stream_ = &stream;
|
||||
}
|
||||
|
||||
void Reader::read_data(void *buf, std::size_t size)
|
||||
{
|
||||
MARISA_THROW_IF(!is_open(), MARISA_STATE_ERROR);
|
||||
if (size == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (fd_ != -1)
|
||||
{
|
||||
while (size != 0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
static const std::size_t CHUNK_SIZE = std::numeric_limits<int>::max();
|
||||
const unsigned int count = (size < CHUNK_SIZE) ? size : CHUNK_SIZE;
|
||||
const int size_read = ::_read(fd_, buf, count);
|
||||
#else // _WIN32
|
||||
static const std::size_t CHUNK_SIZE = std::numeric_limits<::ssize_t>::max();
|
||||
const ::size_t count = (size < CHUNK_SIZE) ? size : CHUNK_SIZE;
|
||||
const ::ssize_t size_read = ::read(fd_, buf, count);
|
||||
#endif // _WIN32
|
||||
MARISA_THROW_IF(size_read <= 0, MARISA_IO_ERROR);
|
||||
buf = static_cast<char *>(buf) + size_read;
|
||||
size -= static_cast<std::size_t>(size_read);
|
||||
}
|
||||
}
|
||||
else if (file_ != NULL)
|
||||
{
|
||||
MARISA_THROW_IF(::fread(buf, 1, size, file_) != size, MARISA_IO_ERROR);
|
||||
}
|
||||
else if (stream_ != NULL)
|
||||
{
|
||||
try
|
||||
{
|
||||
MARISA_THROW_IF(!stream_->read(static_cast<char *>(buf), static_cast<std::streamsize>(size)),
|
||||
MARISA_IO_ERROR);
|
||||
}
|
||||
catch (const std::ios_base::failure &)
|
||||
{
|
||||
MARISA_THROW(MARISA_IO_ERROR, "std::ios_base::failure");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace io
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
|
@ -1,69 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_IO_READER_H_
|
||||
#define MARISA_GRIMOIRE_IO_READER_H_
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
class Reader
|
||||
{
|
||||
public:
|
||||
Reader();
|
||||
~Reader();
|
||||
|
||||
void open(const char *filename);
|
||||
void open(std::FILE *file);
|
||||
void open(int fd);
|
||||
void open(std::istream &stream);
|
||||
|
||||
template <typename T> void read(T *obj)
|
||||
{
|
||||
MARISA_THROW_IF(obj == NULL, MARISA_NULL_ERROR);
|
||||
read_data(obj, sizeof(T));
|
||||
}
|
||||
|
||||
template <typename T> void read(T *objs, std::size_t num_objs)
|
||||
{
|
||||
MARISA_THROW_IF((objs == NULL) && (num_objs != 0), MARISA_NULL_ERROR);
|
||||
MARISA_THROW_IF(num_objs > (MARISA_SIZE_MAX / sizeof(T)), MARISA_SIZE_ERROR);
|
||||
read_data(objs, sizeof(T) * num_objs);
|
||||
}
|
||||
|
||||
void seek(std::size_t size);
|
||||
|
||||
bool is_open() const;
|
||||
|
||||
void clear();
|
||||
void swap(Reader &rhs);
|
||||
|
||||
private:
|
||||
std::FILE *file_;
|
||||
int fd_;
|
||||
std::istream *stream_;
|
||||
bool needs_fclose_;
|
||||
|
||||
void open_(const char *filename);
|
||||
void open_(std::FILE *file);
|
||||
void open_(int fd);
|
||||
void open_(std::istream &stream);
|
||||
|
||||
void read_data(void *buf, std::size_t size);
|
||||
|
||||
// Disallows copy and assignment.
|
||||
Reader(const Reader &);
|
||||
Reader &operator=(const Reader &);
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_IO_READER_H_
|
|
@ -1,182 +0,0 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#else // _WIN32
|
||||
#include <unistd.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "marisa/grimoire/io/writer.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
Writer::Writer() : file_(NULL), fd_(-1), stream_(NULL), needs_fclose_(false)
|
||||
{
|
||||
}
|
||||
|
||||
Writer::~Writer()
|
||||
{
|
||||
if (needs_fclose_)
|
||||
{
|
||||
::fclose(file_);
|
||||
}
|
||||
}
|
||||
|
||||
void Writer::open(const char *filename)
|
||||
{
|
||||
MARISA_THROW_IF(filename == NULL, MARISA_NULL_ERROR);
|
||||
|
||||
Writer temp;
|
||||
temp.open_(filename);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Writer::open(std::FILE *file)
|
||||
{
|
||||
MARISA_THROW_IF(file == NULL, MARISA_NULL_ERROR);
|
||||
|
||||
Writer temp;
|
||||
temp.open_(file);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Writer::open(int fd)
|
||||
{
|
||||
MARISA_THROW_IF(fd == -1, MARISA_CODE_ERROR);
|
||||
|
||||
Writer temp;
|
||||
temp.open_(fd);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Writer::open(std::ostream &stream)
|
||||
{
|
||||
Writer temp;
|
||||
temp.open_(stream);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
void Writer::clear()
|
||||
{
|
||||
Writer().swap(*this);
|
||||
}
|
||||
|
||||
void Writer::swap(Writer &rhs)
|
||||
{
|
||||
marisa::swap(file_, rhs.file_);
|
||||
marisa::swap(fd_, rhs.fd_);
|
||||
marisa::swap(stream_, rhs.stream_);
|
||||
marisa::swap(needs_fclose_, rhs.needs_fclose_);
|
||||
}
|
||||
|
||||
void Writer::seek(std::size_t size)
|
||||
{
|
||||
MARISA_THROW_IF(!is_open(), MARISA_STATE_ERROR);
|
||||
if (size == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (size <= 16)
|
||||
{
|
||||
const char buf[16] = {};
|
||||
write_data(buf, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char buf[1024] = {};
|
||||
do
|
||||
{
|
||||
const std::size_t count = (size < sizeof(buf)) ? size : sizeof(buf);
|
||||
write_data(buf, count);
|
||||
size -= count;
|
||||
} while (size != 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool Writer::is_open() const
|
||||
{
|
||||
return (file_ != NULL) || (fd_ != -1) || (stream_ != NULL);
|
||||
}
|
||||
|
||||
void Writer::open_(const char *filename)
|
||||
{
|
||||
std::FILE *file = NULL;
|
||||
#ifdef _MSC_VER
|
||||
MARISA_THROW_IF(::fopen_s(&file, filename, "wb") != 0, MARISA_IO_ERROR);
|
||||
#else // _MSC_VER
|
||||
file = ::fopen(filename, "wb");
|
||||
MARISA_THROW_IF(file == NULL, MARISA_IO_ERROR);
|
||||
#endif // _MSC_VER
|
||||
file_ = file;
|
||||
needs_fclose_ = true;
|
||||
}
|
||||
|
||||
void Writer::open_(std::FILE *file)
|
||||
{
|
||||
file_ = file;
|
||||
}
|
||||
|
||||
void Writer::open_(int fd)
|
||||
{
|
||||
fd_ = fd;
|
||||
}
|
||||
|
||||
void Writer::open_(std::ostream &stream)
|
||||
{
|
||||
stream_ = &stream;
|
||||
}
|
||||
|
||||
void Writer::write_data(const void *data, std::size_t size)
|
||||
{
|
||||
MARISA_THROW_IF(!is_open(), MARISA_STATE_ERROR);
|
||||
if (size == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (fd_ != -1)
|
||||
{
|
||||
while (size != 0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
static const std::size_t CHUNK_SIZE = std::numeric_limits<int>::max();
|
||||
const unsigned int count = (size < CHUNK_SIZE) ? size : CHUNK_SIZE;
|
||||
const int size_written = ::_write(fd_, data, count);
|
||||
#else // _WIN32
|
||||
static const std::size_t CHUNK_SIZE = std::numeric_limits<::ssize_t>::max();
|
||||
const ::size_t count = (size < CHUNK_SIZE) ? size : CHUNK_SIZE;
|
||||
const ::ssize_t size_written = ::write(fd_, data, count);
|
||||
#endif // _WIN32
|
||||
MARISA_THROW_IF(size_written <= 0, MARISA_IO_ERROR);
|
||||
data = static_cast<const char *>(data) + size_written;
|
||||
size -= static_cast<std::size_t>(size_written);
|
||||
}
|
||||
}
|
||||
else if (file_ != NULL)
|
||||
{
|
||||
MARISA_THROW_IF(::fwrite(data, 1, size, file_) != size, MARISA_IO_ERROR);
|
||||
MARISA_THROW_IF(::fflush(file_) != 0, MARISA_IO_ERROR);
|
||||
}
|
||||
else if (stream_ != NULL)
|
||||
{
|
||||
try
|
||||
{
|
||||
MARISA_THROW_IF(!stream_->write(static_cast<const char *>(data), static_cast<std::streamsize>(size)),
|
||||
MARISA_IO_ERROR);
|
||||
}
|
||||
catch (const std::ios_base::failure &)
|
||||
{
|
||||
MARISA_THROW(MARISA_IO_ERROR, "std::ios_base::failure");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace io
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
|
@ -1,68 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_IO_WRITER_H_
|
||||
#define MARISA_GRIMOIRE_IO_WRITER_H_
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
class Writer
|
||||
{
|
||||
public:
|
||||
Writer();
|
||||
~Writer();
|
||||
|
||||
void open(const char *filename);
|
||||
void open(std::FILE *file);
|
||||
void open(int fd);
|
||||
void open(std::ostream &stream);
|
||||
|
||||
template <typename T> void write(const T &obj)
|
||||
{
|
||||
write_data(&obj, sizeof(T));
|
||||
}
|
||||
|
||||
template <typename T> void write(const T *objs, std::size_t num_objs)
|
||||
{
|
||||
MARISA_THROW_IF((objs == NULL) && (num_objs != 0), MARISA_NULL_ERROR);
|
||||
MARISA_THROW_IF(num_objs > (MARISA_SIZE_MAX / sizeof(T)), MARISA_SIZE_ERROR);
|
||||
write_data(objs, sizeof(T) * num_objs);
|
||||
}
|
||||
|
||||
void seek(std::size_t size);
|
||||
|
||||
bool is_open() const;
|
||||
|
||||
void clear();
|
||||
void swap(Writer &rhs);
|
||||
|
||||
private:
|
||||
std::FILE *file_;
|
||||
int fd_;
|
||||
std::ostream *stream_;
|
||||
bool needs_fclose_;
|
||||
|
||||
void open_(const char *filename);
|
||||
void open_(std::FILE *file);
|
||||
void open_(int fd);
|
||||
void open_(std::ostream &stream);
|
||||
|
||||
void write_data(const void *data, std::size_t size);
|
||||
|
||||
// Disallows copy and assignment.
|
||||
Writer(const Writer &);
|
||||
Writer &operator=(const Writer &);
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_IO_WRITER_H_
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_TRIE_H_
|
||||
#define MARISA_GRIMOIRE_TRIE_H_
|
||||
|
||||
#include "marisa/grimoire/trie/louds-trie.h"
|
||||
#include "marisa/grimoire/trie/state.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
|
||||
using trie::LoudsTrie;
|
||||
using trie::State;
|
||||
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_TRIE_H_
|
|
@ -1,100 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_TRIE_CACHE_H_
|
||||
#define MARISA_GRIMOIRE_TRIE_CACHE_H_
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace trie
|
||||
{
|
||||
|
||||
class Cache
|
||||
{
|
||||
public:
|
||||
Cache() : parent_(0), child_(0), union_()
|
||||
{
|
||||
union_.weight = FLT_MIN;
|
||||
}
|
||||
Cache(const Cache &cache) : parent_(cache.parent_), child_(cache.child_), union_(cache.union_)
|
||||
{
|
||||
}
|
||||
|
||||
Cache &operator=(const Cache &cache)
|
||||
{
|
||||
parent_ = cache.parent_;
|
||||
child_ = cache.child_;
|
||||
union_ = cache.union_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void set_parent(std::size_t parent)
|
||||
{
|
||||
MARISA_DEBUG_IF(parent > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
parent_ = (UInt32)parent;
|
||||
}
|
||||
void set_child(std::size_t child)
|
||||
{
|
||||
MARISA_DEBUG_IF(child > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
child_ = (UInt32)child;
|
||||
}
|
||||
void set_base(UInt8 base)
|
||||
{
|
||||
union_.link = (union_.link & ~0xFFU) | base;
|
||||
}
|
||||
void set_extra(std::size_t extra)
|
||||
{
|
||||
MARISA_DEBUG_IF(extra > (MARISA_UINT32_MAX >> 8), MARISA_SIZE_ERROR);
|
||||
union_.link = (UInt32)((union_.link & 0xFFU) | (extra << 8));
|
||||
}
|
||||
void set_weight(float weight)
|
||||
{
|
||||
union_.weight = weight;
|
||||
}
|
||||
|
||||
std::size_t parent() const
|
||||
{
|
||||
return parent_;
|
||||
}
|
||||
std::size_t child() const
|
||||
{
|
||||
return child_;
|
||||
}
|
||||
UInt8 base() const
|
||||
{
|
||||
return (UInt8)(union_.link & 0xFFU);
|
||||
}
|
||||
std::size_t extra() const
|
||||
{
|
||||
return union_.link >> 8;
|
||||
}
|
||||
char label() const
|
||||
{
|
||||
return (char)base();
|
||||
}
|
||||
std::size_t link() const
|
||||
{
|
||||
return union_.link;
|
||||
}
|
||||
float weight() const
|
||||
{
|
||||
return union_.weight;
|
||||
}
|
||||
|
||||
private:
|
||||
UInt32 parent_;
|
||||
UInt32 child_;
|
||||
union Union {
|
||||
UInt32 link;
|
||||
float weight;
|
||||
} union_;
|
||||
};
|
||||
|
||||
} // namespace trie
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_TRIE_CACHE_H_
|
|
@ -1,175 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_TRIE_CONFIG_H_
|
||||
#define MARISA_GRIMOIRE_TRIE_CONFIG_H_
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace trie
|
||||
{
|
||||
|
||||
class Config
|
||||
{
|
||||
public:
|
||||
Config()
|
||||
: num_tries_(MARISA_DEFAULT_NUM_TRIES), cache_level_(MARISA_DEFAULT_CACHE), tail_mode_(MARISA_DEFAULT_TAIL),
|
||||
node_order_(MARISA_DEFAULT_ORDER)
|
||||
{
|
||||
}
|
||||
|
||||
void parse(int config_flags)
|
||||
{
|
||||
Config temp;
|
||||
temp.parse_(config_flags);
|
||||
swap(temp);
|
||||
}
|
||||
|
||||
int flags() const
|
||||
{
|
||||
return (int)num_tries_ | tail_mode_ | node_order_;
|
||||
}
|
||||
|
||||
std::size_t num_tries() const
|
||||
{
|
||||
return num_tries_;
|
||||
}
|
||||
CacheLevel cache_level() const
|
||||
{
|
||||
return cache_level_;
|
||||
}
|
||||
TailMode tail_mode() const
|
||||
{
|
||||
return tail_mode_;
|
||||
}
|
||||
NodeOrder node_order() const
|
||||
{
|
||||
return node_order_;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
Config().swap(*this);
|
||||
}
|
||||
void swap(Config &rhs)
|
||||
{
|
||||
marisa::swap(num_tries_, rhs.num_tries_);
|
||||
marisa::swap(cache_level_, rhs.cache_level_);
|
||||
marisa::swap(tail_mode_, rhs.tail_mode_);
|
||||
marisa::swap(node_order_, rhs.node_order_);
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t num_tries_;
|
||||
CacheLevel cache_level_;
|
||||
TailMode tail_mode_;
|
||||
NodeOrder node_order_;
|
||||
|
||||
void parse_(int config_flags)
|
||||
{
|
||||
MARISA_THROW_IF((config_flags & ~MARISA_CONFIG_MASK) != 0, MARISA_CODE_ERROR);
|
||||
|
||||
parse_num_tries(config_flags);
|
||||
parse_cache_level(config_flags);
|
||||
parse_tail_mode(config_flags);
|
||||
parse_node_order(config_flags);
|
||||
}
|
||||
|
||||
void parse_num_tries(int config_flags)
|
||||
{
|
||||
const int num_tries = config_flags & MARISA_NUM_TRIES_MASK;
|
||||
if (num_tries != 0)
|
||||
{
|
||||
num_tries_ = static_cast<std::size_t>(num_tries);
|
||||
}
|
||||
}
|
||||
|
||||
void parse_cache_level(int config_flags)
|
||||
{
|
||||
switch (config_flags & MARISA_CACHE_LEVEL_MASK)
|
||||
{
|
||||
case 0: {
|
||||
cache_level_ = MARISA_DEFAULT_CACHE;
|
||||
break;
|
||||
}
|
||||
case MARISA_HUGE_CACHE: {
|
||||
cache_level_ = MARISA_HUGE_CACHE;
|
||||
break;
|
||||
}
|
||||
case MARISA_LARGE_CACHE: {
|
||||
cache_level_ = MARISA_LARGE_CACHE;
|
||||
break;
|
||||
}
|
||||
case MARISA_NORMAL_CACHE: {
|
||||
cache_level_ = MARISA_NORMAL_CACHE;
|
||||
break;
|
||||
}
|
||||
case MARISA_SMALL_CACHE: {
|
||||
cache_level_ = MARISA_SMALL_CACHE;
|
||||
break;
|
||||
}
|
||||
case MARISA_TINY_CACHE: {
|
||||
cache_level_ = MARISA_TINY_CACHE;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
MARISA_THROW(MARISA_CODE_ERROR, "undefined cache level");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parse_tail_mode(int config_flags)
|
||||
{
|
||||
switch (config_flags & MARISA_TAIL_MODE_MASK)
|
||||
{
|
||||
case 0: {
|
||||
tail_mode_ = MARISA_DEFAULT_TAIL;
|
||||
break;
|
||||
}
|
||||
case MARISA_TEXT_TAIL: {
|
||||
tail_mode_ = MARISA_TEXT_TAIL;
|
||||
break;
|
||||
}
|
||||
case MARISA_BINARY_TAIL: {
|
||||
tail_mode_ = MARISA_BINARY_TAIL;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
MARISA_THROW(MARISA_CODE_ERROR, "undefined tail mode");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parse_node_order(int config_flags)
|
||||
{
|
||||
switch (config_flags & MARISA_NODE_ORDER_MASK)
|
||||
{
|
||||
case 0: {
|
||||
node_order_ = MARISA_DEFAULT_ORDER;
|
||||
break;
|
||||
}
|
||||
case MARISA_LABEL_ORDER: {
|
||||
node_order_ = MARISA_LABEL_ORDER;
|
||||
break;
|
||||
}
|
||||
case MARISA_WEIGHT_ORDER: {
|
||||
node_order_ = MARISA_WEIGHT_ORDER;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
MARISA_THROW(MARISA_CODE_ERROR, "undefined node order");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Disallows copy and assignment.
|
||||
Config(const Config &);
|
||||
Config &operator=(const Config &);
|
||||
};
|
||||
|
||||
} // namespace trie
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_TRIE_CONFIG_H_
|
|
@ -1,102 +0,0 @@
|
|||
#ifndef MARISA_GRIMOIRE_TRIE_ENTRY_H_
|
||||
#define MARISA_GRIMOIRE_TRIE_ENTRY_H_
|
||||
|
||||
#include "marisa/base.h"
|
||||
|
||||
namespace marisa
|
||||
{
|
||||
namespace grimoire
|
||||
{
|
||||
namespace trie
|
||||
{
|
||||
|
||||
class Entry
|
||||
{
|
||||
public:
|
||||
Entry() : ptr_(NULL), length_(0), id_(0)
|
||||
{
|
||||
}
|
||||
Entry(const Entry &entry) : ptr_(entry.ptr_), length_(entry.length_), id_(entry.id_)
|
||||
{
|
||||
}
|
||||
|
||||
Entry &operator=(const Entry &entry)
|
||||
{
|
||||
ptr_ = entry.ptr_;
|
||||
length_ = entry.length_;
|
||||
id_ = entry.id_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
char operator[](std::size_t i) const
|
||||
{
|
||||
MARISA_DEBUG_IF(i >= length_, MARISA_BOUND_ERROR);
|
||||
return *(ptr_ - i);
|
||||
}
|
||||
|
||||
void set_str(const char *ptr, std::size_t length)
|
||||
{
|
||||
MARISA_DEBUG_IF((ptr == NULL) && (length != 0), MARISA_NULL_ERROR);
|
||||
MARISA_DEBUG_IF(length > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
ptr_ = ptr + length - 1;
|
||||
length_ = (UInt32)length;
|
||||
}
|
||||
void set_id(std::size_t id)
|
||||
{
|
||||
MARISA_DEBUG_IF(id > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
|
||||
id_ = (UInt32)id;
|
||||
}
|
||||
|
||||
const char *ptr() const
|
||||
{
|
||||
return ptr_ - length_ + 1;
|
||||
}
|
||||
std::size_t length() const
|
||||
{
|
||||
return length_;
|
||||
}
|
||||
std::size_t id() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
class StringComparer
|
||||
{
|
||||
public:
|
||||
bool operator()(const Entry &lhs, const Entry &rhs) const
|
||||
{
|
||||
for (std::size_t i = 0; i < lhs.length(); ++i)
|
||||
{
|
||||
if (i == rhs.length())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (lhs[i] != rhs[i])
|
||||
{
|
||||
return (UInt8)lhs[i] > (UInt8)rhs[i];
|
||||
}
|
||||
}
|
||||
return lhs.length() > rhs.length();
|
||||
}
|
||||
};
|
||||
|
||||
class IDComparer
|
||||
{
|
||||
public:
|
||||
bool operator()(const Entry &lhs, const Entry &rhs) const
|
||||
{
|
||||
return lhs.id_ < rhs.id_;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
const char *ptr_;
|
||||
UInt32 length_;
|
||||
UInt32 id_;
|
||||
};
|
||||
|
||||
} // namespace trie
|
||||
} // namespace grimoire
|
||||
} // namespace marisa
|
||||
|
||||
#endif // MARISA_GRIMOIRE_TRIE_ENTRY_H_
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue