Commit 52a458aa authored by Aron Xu's avatar Aron Xu

Imported Upstream version 1.3.0

parent 3a606447
configure
Makefile
Makefile.in
aclocal.m4
config.log
INSTALL
autom4te.cache
config.guess
config.h
config.h.in
config.status
config.sub
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1
libltdl
*~
*.o
*.lo
*.pyc
.deps
.libs
tags
TAGS
cscope.*
*.la
libpinyin.pc
libpinyin.spec
libpinyin.so*
src/lookup/liblookup.a
src/storage/libstorage.a
tests/include/test_memory_chunk
tests/lookup/test_phrase_lookup
tests/storage/test_flexible_ngram
tests/storage/test_ngram
tests/storage/test_parser
tests/storage/test_parser2
tests/storage/test_phrase_index
tests/storage/test_phrase_index_logger
tests/storage/test_phrase_table
tests/test_chewing
tests/test_phrase
tests/test_pinyin
tests/lookup/test_pinyin_lookup
tests/storage/test_chewing_table
tests/storage/test_pinyin_table
utils/segment/ngseg
utils/segment/spseg
utils/storage/export_interpolation
utils/storage/gen_binary_files
utils/storage/gen_pinyin_table
utils/storage/gen_chewing_table
utils/storage/gen_zhuyin_map
utils/storage/import_interpolation
utils/training/estimate_interpolation
utils/training/estimate_k_mixture_model
utils/training/eval_correction_rate
utils/training/export_k_mixture_model
utils/training/gen_deleted_ngram
utils/training/gen_k_mixture_model
utils/training/gen_ngram
utils/training/gen_unigram
utils/training/import_k_mixture_model
utils/training/k_mixture_model_to_interpolation
utils/training/merge_k_mixture_model
utils/training/prune_k_mixture_model
utils/training/validate_k_mixture_model
data/bigram.db
data/gb_char.bin
data/gb_char.dbin
data/gb_char.table
data/gbk_char.bin
data/gbk_char.dbin
data/gbk_char.table
data/interpolation.text
data/phrase_index.bin
data/pinyin_index.bin
data/user.db
CMakeFiles
CMakeCache.txt
cmake_install.cmake
CTestTestfile.cmake
## Copyright (C) 2011 BYVoid
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This program 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
######## Project settings
cmake_minimum_required(VERSION 2.8)
set (PACKAGE_NAME libpinyin)
project (${PACKAGE_NAME} CXX C)
enable_testing()
######## Package information
set (PACKAGE_URL https://github.com/libpinyin/libpinyin)
set (PACKAGE_BUGREPORT https://github.com/libpinyin/libpinyin/issues)
set (LIBPINYIN_VERSION_MAJOR 0)
set (LIBPINYIN_VERSION_MINOR 7)
set (LIBPINYIN_VERSION_REVISION 0)
set (LIBPINYIN_BINARY_VERSION 2.0)
if (CMAKE_BUILD_TYPE MATCHES Debug)
set (version_suffix .Debug)
endif (CMAKE_BUILD_TYPE MATCHES Debug)
set (
LIBPINYIN_VERSION
${LIBPINYIN_VERSION_MAJOR}.${LIBPINYIN_VERSION_MINOR}.${LIBPINYIN_VERSION_REVISION}${version_suffix}
)
set (VERSION ${LIBPINYIN_VERSION})
######## Validation
include(CheckIncludeFileCXX)
check_include_file_cxx(locale.h HAVE_LOCALE_H)
check_include_file_cxx(libintl.h HAVE_LIBINTL_H)
check_include_file_cxx(stdlib.h HAVE_STDLIB_H)
check_include_file_cxx(string.h HAVE_STRING_H)
check_include_file_cxx(sys/time.h HAVE_SYS_TIME_H)
check_include_file_cxx(unistd.h HAVE_UNISTD_H)
include(CheckFunctionExists)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_function_exists(malloc HAVE_MALLOC)
check_function_exists(memcmp HAVE_MEMCMP)
check_function_exists(memmove HAVE_MEMMOVE)
check_function_exists(memset HAVE_MEMSET)
check_function_exists(realloc HAVE_REALLOC)
check_function_exists(setlocale HAVE_SETLOCALE)
check_function_exists(stat HAVE_STAT)
include(CheckTypeSize)
check_type_size(size_t SIZE_OF_SIZE_T)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(GLIB2 REQUIRED)
find_package(BerkeleyDB REQUIRED)
######## Windows
if (WIN32)
set(CMAKE_SHARED_LIBRARY_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CMAKE_STATIC_LIBRARY_PREFIX ${CMAKE_INSTALL_PREFIX})
endif (WIN32)
######## Directory
set (DIR_PREFIX ${CMAKE_INSTALL_PREFIX})
set (DIR_LIBRARY ${DIR_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX})
set (DIR_LIBRARY_STATIC ${DIR_PREFIX}/${CMAKE_STATIC_LIBRARY_PREFIX})
set (DIR_INCLUDE ${DIR_PREFIX}/include)
set (DIR_SHARE ${DIR_PREFIX}/share)
set (DIR_BIN ${DIR_PREFIX}/bin)
set (DIR_ETC ${DIR_PREFIX}/etc)
if (DEFINED CMAKE_INSTALL_LIBDIR)
set (DIR_LIBRARY ${CMAKE_INSTALL_LIBDIR})
set (DIR_LIBRARY_STATIC ${CMAKE_INSTALL_LIBDIR})
endif (DEFINED CMAKE_INSTALL_LIBDIR)
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)
set (DIR_SHARE_LIBPINYIN ${DIR_SHARE}/libpinyin)
set (DIR_INCLUDE_LIBPINYIN ${DIR_INCLUDE}/libpinyin-${LIBPINYIN_BINARY_VERSION})
######## Configuration
set (prefix ${DIR_PREFIX})
set (exec_prefix ${DIR_PREFIX})
set (libdir ${DIR_LIBRARY})
set (includedir ${DIR_INCLUDE})
set (datadir ${DIR_SHARE})
configure_file(
libpinyin.pc.in
libpinyin.pc
@ONLY
)
install(
FILES
${CMAKE_BINARY_DIR}/libpinyin.pc
DESTINATION
${DIR_LIBRARY}/pkgconfig
)
######## Definition
if (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(
-O0
-g3
)
endif (CMAKE_BUILD_TYPE MATCHES Debug)
include_directories(
${GLIB2_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/include
${PROJECT_SOURCE_DIR}/src/storage
${PROJECT_SOURCE_DIR}/src/lookup
${PROJECT_SOURCE_DIR}/utils
${PROJECT_SOURCE_DIR}/tests
)
######## Subdirectories
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(utils)
add_subdirectory(data)
version 1.2.0
* bug fixes.
version 1.1.91
* support Kyoto Cabinet as alternative to Berkeley DB.
* improve multiple dictionaries support feature.
version 1.1.0
* support to export user phrases.
version 1.0.0
* the first official release of 1.0.x.
version 0.9.94
* bug fixes.
version 0.9.93
* fixes libpinyin issues from coverity scan report.
version 0.9.92
* bug fixes.
version 0.9.91
* code re-factor.
version 0.9.0
* the first official release of 0.9.x.
* fixes import dictionary.
version 0.8.93
* add back pinyin_clear_constraint.
version 0.8.92
* fixes model data.
version 0.8.91
* multiple dictioniares and user dictionary support.
version 0.8.1
* bug fixes.
version 0.8.0
* the first official release of 0.8.x.
version 0.7.92
* re-factor PhraseLookup class.
* all tests passed simple valgrind memory check.
version 0.7.91
* simplify PinyinLookup class.
version 0.7.1
* add API to lookup pinyin for characters.
version 0.7.0
* the first official release of 0.7.x.
version 0.6.92
* draft support for multiple professional phrase libraries.
version 0.6.91
* support ucs4 characters;
* support guess sentence with prefix;
* support ucs4 characters.
* support guess sentence with prefix.
* initially support fuzzy pinyin segment.
version 0.6.0
* the first official release of 0.6.x.
version 0.5.92
* fixes new parsers and chewing large table;
* fixes new parsers and chewing large table.
* improves pinyin_save.
version 0.5.91
* some code re-factor and simplify;
* some code re-factor and simplify.
* fixes the self-learning work around.
version 0.5.0
......@@ -25,8 +85,8 @@ version 0.4.92
version 0.4.91
* New parsers for full pinyin/double pinyin/chewing.
* libpinyin now fully supports all pinyin auto corrections in
ibus-pinyin;
* libpinyin now fully supports all pinyin auto corrections of
ibus-pinyin.
* libpinyin now better supports an/ang, en/eng, in/ing fuzzy
pinyin match.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="libpinyin"
(test -f $srcdir/configure.ac \
&& test -f $srcdir/README ) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME CVS"
exit 1
}
(test -f $srcdir/ChangeLog) || {
touch $srcdir/ChangeLog
}
CFLAGS=${CFLAGS-"-Wall -Werror"}
ACLOCAL_FLAGS="$ACLOCAL_FLAGS"
REQUIRED_AUTOMAKE_VERSION=1.8
. gnome-autogen.sh "$@"
# - Try to find Berkeley DB
# Once done this will define
#
# BERKELEY_DB_FOUND - system has Berkeley DB
# BERKELEY_DB_INCLUDE_DIR - the Berkeley DB include directory
# BERKELEY_DB_LIBRARIES - Link these to use Berkeley DB
# BERKELEY_DB_DEFINITIONS - Compiler switches required for using Berkeley DB
# Copyright (c) 2006, Alexander Dymo, <adymo@kdevelop.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
FIND_PATH(BERKELEY_DB_INCLUDE_DIR db.h
/usr/include/db4
/usr/local/include/db4
)
FIND_LIBRARY(BERKELEY_DB_LIBRARIES NAMES db )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Berkeley "Could not find Berkeley DB >= 4.1" BERKELEY_DB_INCLUDE_DIR BERKELEY_DB_LIBRARIES)
# show the BERKELEY_DB_INCLUDE_DIR and BERKELEY_DB_LIBRARIES variables only in the advanced view
MARK_AS_ADVANCED(BERKELEY_DB_INCLUDE_DIR BERKELEY_DB_LIBRARIES )
# - Try to find the GLIB2 libraries
# Once done this will define
#
# GLIB2_FOUND - system has glib2
# GLIB2_INCLUDE_DIR - the glib2 include directory
# GLIB2_LIBRARIES - glib2 library
# Copyright (c) 2008 Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
# Already in cache, be silent
set(GLIB2_FIND_QUIETLY TRUE)
endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
find_package(PkgConfig)
pkg_check_modules(PC_LibGLIB2 QUIET glib-2.0)
find_path(GLIB2_MAIN_INCLUDE_DIR
NAMES glib.h
HINTS ${PC_LibGLIB2_INCLUDEDIR}
PATH_SUFFIXES glib-2.0)
find_library(GLIB2_LIBRARY
NAMES glib-2.0
HINTS ${PC_LibGLIB2_LIBDIR}
)
set(GLIB2_LIBRARIES ${GLIB2_LIBRARY})
# search the glibconfig.h include dir under the same root where the library is found
get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH)
find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
PATH_SUFFIXES glib-2.0/include
HINTS ${PC_LibGLIB2_INCLUDEDIR} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH})
set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}")
# not sure if this include dir is optional or required
# for now it is optional
if(GLIB2_INTERNAL_INCLUDE_DIR)
set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}")
endif(GLIB2_INTERNAL_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES)
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then