Commit 2553dafa authored by Aron Xu's avatar Aron Xu

Imported Upstream version 0.5.0

parents
James Su 2002,2003,2006 <suzhe@tsinghua.edu.cn>
Peng Wu 2006-2007 2010-2011 <alexepico@gmail.com>
This diff is collapsed.
version 0.5.0
* the first official release of 0.5.x.
version 0.4.93
* fixes some bugs in new parsers
version 0.4.92
* enable parallel make
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 better supports an/ang, en/eng, in/ing fuzzy
pinyin match.
version 0.3.0
* the first official release of 0.3.x.
version 0.2.99
* import from pinyin.
This diff is collapsed.
## Makefile.am -- Process this file with automake to produce Makefile.in
## Copyright (C) 2007 Peng Wu
##
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
EXTRA_DIST = COPYING
AUTOMAKE_OPTIONS = gnu
SUBDIRS = src utils tests data
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *.bak
ACLOCAL = aclocal -I .
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libpinyin.pc
This diff is collapsed.
libpinyin
Library to deal with pinyin.
The libpinyin project aims to provide the algorithms core for intelligent sentence-based Chinese pinyin input methods.
This diff is collapsed.
This diff is collapsed.
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `argz_add' function. */
#undef HAVE_ARGZ_ADD
/* Define to 1 if you have the `argz_append' function. */
#undef HAVE_ARGZ_APPEND
/* Define to 1 if you have the `argz_count' function. */
#undef HAVE_ARGZ_COUNT
/* Define to 1 if you have the `argz_create_sep' function. */
#undef HAVE_ARGZ_CREATE_SEP
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define to 1 if you have the `argz_insert' function. */
#undef HAVE_ARGZ_INSERT
/* Define to 1 if you have the `argz_next' function. */
#undef HAVE_ARGZ_NEXT
/* Define to 1 if you have the `argz_stringify' function. */
#undef HAVE_ARGZ_STRINGIFY
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
/* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if
you don't. */
#undef HAVE_DECL_CYGWIN_CONV_PATH
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define if you have the GNU dld library. */
#undef HAVE_DLD
/* Define to 1 if you have the <dld.h> header file. */
#undef HAVE_DLD_H
/* Define to 1 if you have the `dlerror' function. */
#undef HAVE_DLERROR
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <dl.h> header file. */
#undef HAVE_DL_H
/* Define if you have the _dyld_func_lookup function. */
#undef HAVE_DYLD
/* Define to 1 if the system has the type `error_t'. */
#undef HAVE_ERROR_T
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the libdl library or equivalent. */
#undef HAVE_LIBDL
/* Define if libdlloader will be built on this platform */
#undef HAVE_LIBDLLOADER
/* Define to 1 if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define this if a modern libltdl is already installed */
#undef HAVE_LTDL
/* Define to 1 if you have the <mach-o/dyld.h> header file. */
#undef HAVE_MACH_O_DYLD_H
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the `opendir' function. */
#undef HAVE_OPENDIR
/* Define if libtool can extract symbol lists from object files. */
#undef HAVE_PRELOADED_SYMBOLS
/* Define to 1 if you have the `readdir' function. */
#undef HAVE_READDIR
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define if you have the shl_load function. */
#undef HAVE_SHL_LOAD
/* Define to 1 if `stat' has the bug that it succeeds when given the
zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG
/* Define to 1 if stdbool.h conforms to C99. */
#undef HAVE_STDBOOL_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the <sys/dl.h> header file. */
#undef HAVE_SYS_DL_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* This value is set to 1 to indicate that the system argz facility works */
#undef HAVE_WORKING_ARGZ
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
/* Define if the OS needs help to load dependent libraries for dlopen(). */
#undef LTDL_DLOPEN_DEPLIBS
/* Define to the system default library search path. */
#undef LT_DLSEARCH_PATH
/* The archive extension */
#undef LT_LIBEXT
/* The archive prefix */
#undef LT_LIBPREFIX
/* Define to the extension used for runtime loadable modules, say, ".so". */
#undef LT_MODULE_EXT
/* Define to the name of the environment variable that determines the run-time
module search path. */
#undef LT_MODULE_PATH_VAR
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define if dlsym() requires a leading underscore in symbol names. */
#undef NEED_USCORE
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define so that glibc/gnulib argp.h does not typedef error_t. */
#undef __error_t_defined
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to a type to use for `error_t' if it is not otherwise available. */
#undef error_t
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
This diff is collapsed.
This diff is collapsed.
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT(libpinyin, 0.5.0, alexepico@gmail.com)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADER([config.h])
# Define a string for binary compatibility
LIBPINYIN_BINARY_VERSION=0.3
AC_SUBST(LIBPINYIN_BINARY_VERSION)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_GNU_SOURCE
# Init libtool
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_LIB_LTDL
AC_SUBST(LIBTOOL_DEPS)
# libtool option to control which symbols are exported
# right now, symbols starting with _ are not exported
LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
# Checks for libraries.
PKG_CHECK_MODULES(GLIB2, [glib-2.0 >= 2.4.0])
GLIB2_CPPFLAGS=`$PKG_CONFIG --cflags glib-2.0`
AC_SUBST(GLIB2_CPPFLAGS)
GLIB2_LDFLAGS=`$PKG_CONFIG --libs glib-2.0`
AC_SUBST(GLIB2_LDFLAGS)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_CHECK_FUNCS([gettimeofday memmove memset setlocale])
AC_CHECK_HEADERS([libintl.h string.h])
AC_CHECK_HEADER([db.h], [], AC_MSG_ERROR([Cannot find Berkeley DB library version 4]))
AC_SEARCH_LIBS([db_create], [db], [], AC_MSG_ERROR([Cannot find Berkeley DB library version 4]))
AC_CONFIG_FILES([libpinyin.pc
libpinyin.spec
Makefile
data/Makefile
src/Makefile
src/include/Makefile
src/storage/Makefile
src/lookup/Makefile
tests/Makefile
tests/include/Makefile
tests/storage/Makefile
tests/lookup/Makefile
utils/Makefile
utils/storage/Makefile
utils/segment/Makefile
utils/training/Makefile
])
AC_OUTPUT
AC_MSG_RESULT([
Build options:
Version $VERSION
Install prefix $prefix
])
## Makefile.am -- Process this file with automake to produce Makefile.in
## Copyright (C) 2011 Peng Wu
##
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
textual_model_data = interpolation.text \
gb_char.table gbk_char.table
binary_model_data = gb_char.bin gbk_char.bin \
phrase_index.bin pinyin_index.bin \
bigram.db
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = $(textual_model_data)
libpinyin_db_DATA = $(binary_model_data)
libpinyin_dbdir = $(pkgdatadir)/data
CLEANFILES = $(binary_model_data)
interpolation.text:
wget https://github.com/downloads/libpinyin/libpinyin/model.text.tar.gz
tar xvf model.text.tar.gz
gb_char.table gbk_char.table: interpolation.text
bigram.db: $(textual_model_data)
$(RM) $(binary_model_data)
../utils/storage/gen_binary_files --table-dir $(top_srcdir)/data
../utils/storage/import_interpolation < $(top_srcdir)/data/interpolation.text
../utils/training/gen_unigram
gb_char.bin gbk_char.bin phrase_index.bin pinyin_index.bin: bigram.db
rebuild:
git reset --hard
sed -i -e "s/#define LAMBDA_PARAMETER 0.330642/#define LAMBDA_PARAMETER $(LAMBDA_PARAMETER)/" ../src/include/novel_types.h
make -C .. >/dev/null 2>/dev/null
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
datadir=@datadir@
pkgdatadir=@datadir@/libpinyin
libpinyinincludedir=${includedir}/libpinyin-@LIBPINYIN_BINARY_VERSION@
libpinyin_binary_version=@LIBPINYIN_BINARY_VERSION@
Name: libpinyin
Description: Library to deal with pinyin
Version: @VERSION@
Requires: glib-2.0
Libs: -L${libdir} -lpinyin
Cflags: -I${libpinyinincludedir}
Name: libpinyin
Version: @VERSION@
Release: 1%{?dist}
Summary: Library to deal with pinyin
License: GPLv2+
URL: https://github.com/libpinyin/libpinyin
Source0: https://github.com/downloads/libpinyin/libpinyin/%{name}-%{version}.tar.gz
BuildRequires: db4-devel, glib2-devel
Requires: %{name}-data = %{version}-%{release}
%description
The libpinyin project aims to provide the algorithms core
for intelligent sentence-based Chinese pinyin input methods.
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package data
Summary: Data files for %{name}
Requires: %{name} = %{version}-%{release}
%description data
The %{name}-data package contains data files.
%package tools
Summary: Tools for %{name}
Requires: %{name} = %{version}-%{release}
%description tools
The %{name}-tools package contains tools.
%prep
%setup -q
%build
%configure --disable-static
make %{?_smp_mflags}
%install
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc AUTHORS COPYING README
%{_libdir}/*.so.*
%dir %{_datadir}/libpinyin
%files devel
%doc
%dir %{_includedir}/libpinyin-0.3
%{_includedir}/libpinyin-0.3/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/libpinyin.pc
%files data
%doc
%{_datadir}/libpinyin/data
%files tools
%{_bindir}/gen_binary_files
%{_bindir}/import_interpolation
%{_bindir}/gen_unigram
%changelog
* Mon Jan 09 2012 Peng Wu <pwu@redhat.com> - 0.4.92-2
- Split tools sub package
* Thu Dec 29 2011 Peng Wu <pwu@redhat.com> - 0.4.92-1
- Update to 0.4.92
* Tue Dec 27 2011 Peng Wu <pwu@redhat.com> - 0.4.91-1
- Update to 0.4.91
* Fri Nov 18 2011 Peng Wu <pwu@redhat.com> - 0.3.0-1
- Update to 0.3.0
* Thu Nov 03 2011 Peng Wu <pwu@redhat.com> - 0.2.99.3-1
- Update to 0.2.99.3
* Tue Oct 11 2011 Peng Wu <pwu@redhat.com> - 0.2.99.2-1
- Update to 0.2.99.2
* Wed Sep 28 2011 Peng Wu <pwu@redhat.com> - 0.2.99.1-1
- Update to 0.2.99.1
* Thu Sep 08 2011 Peng Wu <pwu@redhat.com> - 0.2.99-2
- Split data sub package
* Wed Aug 31 2011 Peng Wu <alexepico@gmail.com> - 0.2.99-1
- Initial version
This diff is collapsed.
This diff is collapsed.
## Makefile.am -- Process this file with automake to produce Makefile.in
## Copyright (C) 2007 Peng Wu
##
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
AUTOMAKE_OPTIONS = gnu
SUBDIRS = include storage lookup
EXTRA_DIST = libpinyin.ver
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *.bak
ACLOCAL = aclocal -I $(ac_aux_dir)
INCLUDES = -I$(top_srcdir)/src \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/storage \
-I$(top_srcdir)/src/lookup \
@GLIB2_CPPFLAGS@
libpinyinincludedir = $(includedir)/libpinyin-@LIBPINYIN_BINARY_VERSION@
libpinyininclude_HEADERS= pinyin.h
noinst_HEADERS = pinyin_internal.h
lib_LTLIBRARIES = libpinyin.la
noinst_LTLIBRARIES = libpinyin_internal.la
libpinyin_la_SOURCES = pinyin.cpp
libpinyin_la_LIBADD = storage/libstorage.la lookup/liblookup.la
libpinyin_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libpinyin.ver \
-version-info "0:3:0"
libpinyin_internal_la_SOURCES = pinyin_internal.cpp
libpinyin_internal_la_LIBADD = storage/libstorage.la lookup/liblookup.la
## Note:
## As libpinyin internal interface will change, only provides static library
## to catch errors when compiling instead of running.
\ No newline at end of file
This diff is collapsed.
## Makefile.am -- Process this file with automake to produce Makefile.in
## Copyright (C) 2007 Peng Wu
##
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
MAINTAINERCLEANFILES = Makefile.in
libpinyinincludedir = $(includedir)/libpinyin-@LIBPINYIN_BINARY_VERSION@
libpinyininclude_HEADERS= novel_types.h
noinst_HEADERS = memory_chunk.h \
stl_lite.h
This diff is collapsed.
This diff is collapsed.
/*
* libpinyin
* Library to deal with pinyin.