├── .gitignore ├── ChangeLog.md ├── README.md ├── mecab ├── .gitignore ├── CREDITS ├── LICENSE ├── README ├── config.m4 ├── config.w32 ├── examples │ ├── allmorphs-func.php │ ├── allmorphs-ns.php │ ├── allmorphs-oo.php │ ├── common.inc.php │ ├── dicinfo-func.php │ ├── dicinfo-ns.php │ ├── dicinfo-oo.php │ ├── dumpall-func.php │ ├── dumpall-ns.php │ ├── dumpall-ns2.php │ ├── dumpall-oo.php │ ├── dumpall-oo2.php │ ├── format-func.php │ ├── format-ns.php │ ├── format-ns2.php │ ├── format-oo.php │ ├── format-oo2.php │ ├── nbest-func.php │ ├── nbest-ns.php │ ├── nbest-oo.php │ ├── parse-func.php │ ├── parse-ns.php │ ├── parse-oo.php │ ├── provides-r.php │ ├── provides.php │ ├── split-func.php │ ├── split-ns.php │ ├── split-oo.php │ ├── test-func.php │ ├── test-ns.php │ ├── test-oo.php │ ├── wakati-func.php │ ├── wakati-ns.php │ └── wakati-oo.php ├── mecab.dsp ├── mecab5.c ├── mecab7.c ├── package.php ├── package.xml ├── php_mecab.h ├── php_mecab_compat5.h ├── php_mecab_compat7.h └── tests │ ├── .gitignore │ ├── MeCab_Node__getAlpha.phpt │ ├── MeCab_Node__getBNext.phpt │ ├── MeCab_Node__getBeta.phpt │ ├── MeCab_Node__getCharType.phpt │ ├── MeCab_Node__getCost.phpt │ ├── MeCab_Node__getENext.phpt │ ├── MeCab_Node__getFeature.phpt │ ├── MeCab_Node__getId.phpt │ ├── MeCab_Node__getIterator.phpt │ ├── MeCab_Node__getLPath.phpt │ ├── MeCab_Node__getLcAttr.phpt │ ├── MeCab_Node__getLength.phpt │ ├── MeCab_Node__getNext.phpt │ ├── MeCab_Node__getPosId.phpt │ ├── MeCab_Node__getPrev.phpt │ ├── MeCab_Node__getProb.phpt │ ├── MeCab_Node__getRLength.phpt │ ├── MeCab_Node__getRPath.phpt │ ├── MeCab_Node__getRcAttr.phpt │ ├── MeCab_Node__getStat.phpt │ ├── MeCab_Node__getSurface.phpt │ ├── MeCab_Node__getWCost.phpt │ ├── MeCab_Node__isBest.phpt │ ├── MeCab_Node__setTraverse.phpt │ ├── MeCab_Node__toArray.phpt │ ├── MeCab_Node__toString.phpt │ ├── MeCab_Path__getCost.phpt │ ├── MeCab_Path__getLNext.phpt │ ├── MeCab_Path__getLNode.phpt │ ├── MeCab_Path__getProb.phpt │ ├── MeCab_Path__getRNext.phpt │ ├── MeCab_Path__getRNode.phpt │ ├── MeCab_Tagger__dictionaryInfo.phpt │ ├── MeCab_Tagger__formatNode.phpt │ ├── MeCab_Tagger__new.phpt │ ├── MeCab_Tagger__next.phpt │ ├── MeCab_Tagger__nextNode.phpt │ ├── MeCab_Tagger__parse.phpt │ ├── MeCab_Tagger__parseNBest.phpt │ ├── MeCab_Tagger__parseNBestInit.phpt │ ├── MeCab_Tagger__parseToNode.phpt │ ├── MeCab_Tagger__parseToString.phpt │ ├── MeCab__split.phpt │ ├── MeCab__version.phpt │ ├── mecab_dictionary_info.phpt │ ├── mecab_format_node.phpt │ ├── mecab_nbest_init.phpt │ ├── mecab_nbest_next_tonode.phpt │ ├── mecab_nbest_next_tostr.phpt │ ├── mecab_nbest_sparse_tostr.phpt │ ├── mecab_new.phpt │ ├── mecab_node_alpha.phpt │ ├── mecab_node_beta.phpt │ ├── mecab_node_bnext.phpt │ ├── mecab_node_char_type.phpt │ ├── mecab_node_cost.phpt │ ├── mecab_node_enext.phpt │ ├── mecab_node_feature.phpt │ ├── mecab_node_id.phpt │ ├── mecab_node_isbest.phpt │ ├── mecab_node_lcattr.phpt │ ├── mecab_node_length.phpt │ ├── mecab_node_lpath.phpt │ ├── mecab_node_next.phpt │ ├── mecab_node_posid.phpt │ ├── mecab_node_prev.phpt │ ├── mecab_node_prob.phpt │ ├── mecab_node_rcattr.phpt │ ├── mecab_node_rlength.phpt │ ├── mecab_node_rpath.phpt │ ├── mecab_node_stat.phpt │ ├── mecab_node_surface.phpt │ ├── mecab_node_toarray.phpt │ ├── mecab_node_tostring.phpt │ ├── mecab_node_wcost.phpt │ ├── mecab_path_cost.phpt │ ├── mecab_path_lnext.phpt │ ├── mecab_path_lnode.phpt │ ├── mecab_path_prob.phpt │ ├── mecab_path_rnext.phpt │ ├── mecab_path_rnode.phpt │ ├── mecab_sparse_tonode.phpt │ ├── mecab_sparse_tostr.phpt │ ├── mecab_split.phpt │ ├── mecab_version.phpt │ └── test.txt.eucjp └── packages ├── debian ├── .gitignore ├── README.md └── debian-control.diff └── ubuntu ├── .gitignore ├── README.md └── debian-control.diff /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | *.pyc 10 | *.dylib 11 | *.bundle 12 | *.la 13 | *.lo 14 | 15 | # Numerous always-ignore extensions 16 | ################### 17 | *.diff 18 | *.err 19 | *.orig 20 | *.log 21 | *.rej 22 | *.swo 23 | *.swp 24 | *.vi 25 | *.loT 26 | *~ 27 | *.sass-cache 28 | 29 | # Folders to ignore 30 | ################### 31 | .hg 32 | .svn 33 | .CVS 34 | 35 | # OS or Editor folders 36 | ################### 37 | .DS_Store 38 | Icon? 39 | Thumbs.db 40 | ehthumbs.db 41 | nbproject 42 | .cache 43 | .idea 44 | .project 45 | .settings 46 | .tmproj 47 | *.esproj 48 | *.sublime-project 49 | *.sublime-workspace 50 | 51 | # Dreamweaver added files 52 | ################### 53 | _notes 54 | dwsync.xml 55 | 56 | # Komodo 57 | ################### 58 | *.komodoproject 59 | .komodotools 60 | 61 | # phpenv 62 | .php-version 63 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | 2015-12-05: php-mecab 0.6.0 2 | =========================== 3 | 4 | * Add support for PHP 7. 5 | * Add `MeCab` namespace classes and constants. 6 | * Non-namespace classes are not supported on PHP 7. 7 | * Non-namespace constants are not supported on PHP 7. 8 | * Procedural APIs (`mecab_*` functions) are not supported on PHP 7. 9 | * Non-namespace classes are deprecated on PHP 5. 10 | * PHP versions earlier than 5.3 are no longer supported. 11 | * MeCab versions earlier than 0.99 are no longer supported. 12 | * Removed features: 13 | * `$filter` callback argument of `mecab_split()` function. 14 | * The persistent resource. 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | php-mecab: MeCab binding for PHP 2 | ================================ 3 | 4 | 5 | INSTALL 6 | ------- 7 | 8 | To compile your new extension, you will have to execute the following steps: 9 | 10 | 1. `phpize` 11 | 2. `./configure` 12 | * You cah specify mecab `--with-mecab=/path/to/mecab-config`. 13 | * For developers: `CFLAGS="-Wall -Wextra -Wno-unused-parameter" ./configure` 14 | 3. `make` 15 | 4. `make test` 16 | 5. `[sudo] make install` 17 | 18 | 19 | LICENSE 20 | ------- 21 | ``` 22 | Copyright (c) 2006-2015 Ryusuke SEKIYAMA. All rights reserved. 23 | 24 | Permission is hereby granted, free of charge, to any person obtaining a 25 | copy of this software and associated documentation files (the "Software"), 26 | to deal in the Software without restriction, including without limitation 27 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 28 | and/or sell copies of the Software, and to permit persons to whom the 29 | Software is furnished to do so, subject to the following conditions: 30 | 31 | The above copyright notice and this permission notice shall be included 32 | in all copies or substantial portions of the Software. 33 | 34 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 35 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 36 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 37 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 38 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 39 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 40 | DEALINGS IN THE SOFTWARE. 41 | ``` 42 | -------------------------------------------------------------------------------- /mecab/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs/ 3 | Makefile* 4 | acinclude.m4 5 | aclocal.m4 6 | autom4te.cache/ 7 | build/ 8 | config.* 9 | configure* 10 | install-sh 11 | libtool 12 | ltmain.sh 13 | missing 14 | mkinstalldirs 15 | php_test_results_*.txt 16 | run-tests.php 17 | -------------------------------------------------------------------------------- /mecab/CREDITS: -------------------------------------------------------------------------------- 1 | mecab 2 | rsk 3 | -------------------------------------------------------------------------------- /mecab/LICENSE: -------------------------------------------------------------------------------- 1 | All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included 11 | in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /mecab/README: -------------------------------------------------------------------------------- 1 | This is a standalone PHP extension created using CodeGen_PECL 1.0.0 2 | 3 | HACKING 4 | ======= 5 | 6 | There are two ways to modify an extension created using CodeGen_PECL: 7 | 8 | 1) you can modify the generated code as with any other PHP extension 9 | 10 | 2) you can add custom code to the CodeGen_PECL XML source and re-run pecl-gen 11 | 12 | The 2nd approach may look a bit complicated but you have be aware that any 13 | manual changes to the generated code will be lost if you ever change the 14 | XML specs and re-run PECL-Gen. All changes done before have to be applied 15 | to the newly generated code again. 16 | Adding code snippets to the XML source itself on the other hand may be a 17 | bit more complicated but this way your custom code will always be in the 18 | generated code no matter how often you rerun CodeGen_PECL. 19 | 20 | 21 | BUILDING ON UNIX etc. 22 | ===================== 23 | 24 | To compile your new extension, you will have to execute the following steps: 25 | 26 | 1. $ ./phpize 27 | 2. $ ./configure [--with-mecab] 28 | 3. $ make 29 | [4. $ make test ] # NOTE: this doesn't work right now *) 30 | 5. $ [sudo] make install 31 | 32 | *) this is a general problem with "make test" and standalone extensions 33 | (that is being worked on) so please don't blame CodeGen_PECL for this 34 | 35 | 36 | 37 | BUILDING ON WINDOWS 38 | =================== 39 | 40 | The extension provides the VisualStudio V6 project file 41 | 42 | mecab.dsp 43 | To compile the extension you open this file using VisualStudio, 44 | select the apropriate configuration for your installation 45 | (either "Release_TS" or "Debug_TS") and create "php_mecab.dll" 46 | 47 | After successfull compilation you have to copy the newly 48 | created "php_mecab.dll" to the PHP 49 | extension directory (default: C:\PHP\extensions). 50 | 51 | 52 | TESTING 53 | ======= 54 | 55 | You can now load the extension using a php.ini directive 56 | 57 | extension="php_mecab.[so|dll]" 58 | 59 | or load it at runtime using the dl() function 60 | 61 | dl("php_mecab.[so|dll]"); 62 | 63 | The extension should now be available, you can test this 64 | using the extension_loaded() function: 65 | 66 | if (extension_loaded(mecab)) 67 | echo "mecab loaded :)"; 68 | else 69 | echo "something is wrong :("; 70 | 71 | The extension will also add its own block to the output 72 | of phpinfo(); 73 | 74 | -------------------------------------------------------------------------------- /mecab/config.m4: -------------------------------------------------------------------------------- 1 | dnl 2 | dnl $ Id: $ 3 | dnl 4 | 5 | PHP_ARG_WITH(mecab, [whether to enable MeCab support], 6 | [ --with-mecab[[=PATH]] Enable MeCab support. 7 | PATH is the optional pathname to mecab-config], yes, yes) 8 | 9 | if test "$PHP_MECAB" != "no"; then 10 | 11 | if test -z "$AWK"; then 12 | AC_PATH_PROGS(AWK, awk gawk nawk, [no]) 13 | fi 14 | if test -z "$SED"; then 15 | AC_PATH_PROGS(SED, sed gsed, [no]) 16 | fi 17 | 18 | dnl 19 | dnl Check the location of mecab-config 20 | dnl 21 | if test "$PHP_MECAB" != "yes"; then 22 | AC_MSG_CHECKING([for mecab-config]) 23 | if test -f "$PHP_MECAB"; then 24 | MECAB_CONFIG="$PHP_MECAB" 25 | elif test -f "$PHP_MECAB/mecab-config"; then 26 | MECAB_CONFIG="$PHP_MECAB/mecab-config" 27 | elif test -f "$PHP_MECAB/bin/mecab-config"; then 28 | MECAB_CONFIG="$PHP_MECAB/bin/mecab-config" 29 | else 30 | AC_MSG_ERROR([not found]) 31 | fi 32 | AC_MSG_RESULT([$MECAB_CONFIG]) 33 | else 34 | AC_PATH_PROGS(MECAB_CONFIG, mecab-config, []) 35 | if test -z "$MECAB_CONFIG"; then 36 | AC_MSG_ERROR([mecab-config not found]) 37 | fi 38 | fi 39 | 40 | dnl 41 | dnl Get the version number, CFLAGS and LIBS by mecab-config 42 | dnl 43 | AC_MSG_CHECKING([for MeCab library version]) 44 | 45 | MECAB_VERSION_STRING=`$MECAB_CONFIG --version 2> /dev/null` 46 | MECAB_CFLAGS=`$MECAB_CONFIG --cflags 2> /dev/null` 47 | MECAB_LIBS=`$MECAB_CONFIG --libs 2> /dev/null` 48 | 49 | if test -z "$MECAB_VERSION_STRING"; then 50 | AC_MSG_ERROR([invalid mecab-config passed to --with-mecab]) 51 | fi 52 | 53 | MECAB_VERSION_NUMBER=`echo $MECAB_VERSION_STRING | $AWK -F. '{ printf "%d", $1 * 1000 + $2 }'` 54 | 55 | if test "$MECAB_VERSION_NUMBER" -ne 99 -a "$MECAB_VERSION_NUMBER" -lt 99; then 56 | AC_MSG_RESULT([$MECAB_VERSION_STRING]) 57 | AC_MSG_ERROR([MeCab version 0.99 or later is required to compile php with MeCab support]) 58 | fi 59 | 60 | AC_DEFINE_UNQUOTED(PHP_MECAB_VERSION_NUMBER, $MECAB_VERSION_NUMBER, [MeCab library version number]) 61 | AC_DEFINE_UNQUOTED(PHP_MECAB_VERSION_STRING, "$MECAB_VERSION_STRING", [MeCab library version string]) 62 | AC_MSG_RESULT([$MECAB_VERSION_STRING (ok)]) 63 | 64 | dnl 65 | dnl Check the headers and types 66 | dnl 67 | export OLD_CPPFLAGS="$CPPFLAGS" 68 | export CPPFLAGS="$CPPFLAGS $MECAB_CFLAGS" 69 | AC_CHECK_HEADER([mecab.h], [], AC_MSG_ERROR([mecab.h header not found])) 70 | export CPPFLAGS="$OLD_CPPFLAGS" 71 | 72 | dnl 73 | dnl Check the library 74 | dnl 75 | export OLD_LIBS="$LIBS" 76 | export LIBS="$OLD_LIBS -lpthread" 77 | PHP_CHECK_LIBRARY(mecab, mecab_new2, 78 | [ 79 | PHP_EVAL_INCLINE($MECAB_CFLAGS) 80 | PHP_EVAL_LIBLINE($MECAB_LIBS, MECAB_SHARED_LIBADD) 81 | ],[ 82 | AC_MSG_ERROR([wrong MeCab library version or lib not found. Check config.log for more information]) 83 | ],[ 84 | $MECAB_LIBS 85 | ]) 86 | export LIBS="$OLD_LIBS" 87 | 88 | PHP_SUBST(MECAB_SHARED_LIBADD) 89 | PHP_MECAB_PHP_VERSION=`$PHP_CONFIG --version 2>/dev/null` 90 | PHP_MECAB_PHP_VERNUM=`$PHP_CONFIG --vernum 2>/dev/null` 91 | AC_MSG_CHECKING([for PHP version]) 92 | AC_MSG_RESULT([build for $PHP_MECAB_PHP_VERSION]) 93 | if test "$PHP_MECAB_PHP_VERNUM" -ge 70000; then 94 | PHP_NEW_EXTENSION(mecab, mecab7.c , $ext_shared) 95 | else 96 | PHP_NEW_EXTENSION(mecab, mecab5.c , $ext_shared) 97 | fi 98 | fi 99 | -------------------------------------------------------------------------------- /mecab/config.w32: -------------------------------------------------------------------------------- 1 | // $ Id: $ 2 | // vim:ft=javascript 3 | 4 | // TODO: check for MeCab version 5 | 6 | ARG_WITH('mecab', 'MeCab support', 'yes,shared'); 7 | 8 | if (PHP_MECAB != "no") { 9 | 10 | if (!CHECK_LIB("mecab.lib", "mecab", PHP_MECAB)) { 11 | ERROR("mecab: library 'mecab' not found"); 12 | } 13 | 14 | if (!CHECK_LIB("stdc++.lib", "mecab", PHP_MECAB)) { 15 | ERROR("mecab: library 'stdc++' not found"); 16 | } 17 | 18 | if (!CHECK_HEADER_ADD_INCLUDE("mecab.h", "CFLAGS_MECAB")) { 19 | ERROR("mecab: header 'mecab.h' not found"); 20 | } 21 | 22 | EXTENSION("mecab", "mecab.c"); 23 | } 24 | -------------------------------------------------------------------------------- /mecab/examples/allmorphs-func.php: -------------------------------------------------------------------------------- 1 | parse($str); 15 | 16 | border(); 17 | -------------------------------------------------------------------------------- /mecab/examples/allmorphs-oo.php: -------------------------------------------------------------------------------- 1 | parse($str); 15 | 16 | border(); 17 | -------------------------------------------------------------------------------- /mecab/examples/common.inc.php: -------------------------------------------------------------------------------- 1 | '値' の連想配列でも良い) 44 | * また、パスを指定するオプション (-r, -d, -u) は safe_mode と open_basedir の 45 | * 影響を受け、一部のオプション (-o, -v, -h) は利用できない。 46 | */ 47 | $arg = array(); 48 | $arg['-N'] = NBEST_MAX_RESULT; 49 | $arg['-l'] = 1; 50 | 51 | $arg_all_morphs = $arg; 52 | $arg_all_morphs[] = '-a'; 53 | 54 | $arg_format = array(); 55 | $arg_format['--node-format'] = 'Node (%pi): %m' . PHP_EOL; 56 | $arg_format['--bos-format'] = 'BOS (%pi)' . PHP_EOL; 57 | $arg_format['--eos-format'] = 'EOS (%pi)' . PHP_EOL; 58 | $arg_format['--unk-format'] = 'Unknown (%pi): %m' . PHP_EOL; 59 | 60 | $arg_wakati = array('-O' => 'wakati'); 61 | 62 | // 解析用文字列 63 | $str = '太郎は次郎が持っている本を花子に渡した。'; 64 | $str_long = <<dictionaryInfo()); 20 | 21 | border(); 22 | -------------------------------------------------------------------------------- /mecab/examples/dicinfo-oo.php: -------------------------------------------------------------------------------- 1 | dictionaryInfo()); 20 | 21 | border(); 22 | -------------------------------------------------------------------------------- /mecab/examples/dumpall-func.php: -------------------------------------------------------------------------------- 1 | mecab_node_toarray($node), 23 | 'prev' => '-', 24 | 'next' => '-', 25 | 'enext' => '-', 26 | 'bnext' => '-', 27 | 'rpath' => '-', 28 | 'lpath' => '-', 29 | ); 30 | if ($prev = mecab_node_prev($node)) { 31 | $ar['prev'] = call_format($prev); 32 | } 33 | if ($next = mecab_node_next($node)) { 34 | $ar['next'] = call_format($next); 35 | } 36 | if ($enext = mecab_node_enext($node)) { 37 | $ar['enext'] = call_format($enext); 38 | } 39 | if ($bnext = mecab_node_bnext($node)) { 40 | $ar['bnext'] = call_format($bnext); 41 | } 42 | if ($rpath = mecab_node_rpath($node)) { 43 | $ar['rpath'] = array( 44 | 'prob' => mecab_path_prob($rpath), 45 | 'cost' => mecab_path_cost($rpath), 46 | 'rnode' => '-', 47 | 'lnode' => '-', 48 | ); 49 | if ($rpath_rnode = mecab_path_rnode($rpath)) { 50 | $ar['rpath']['rnode'] = call_format($rpath_rnode); 51 | } 52 | if ($rpath_lnode = mecab_path_lnode($rpath)) { 53 | $ar['rpath']['lnode'] = call_format($rpath_lnode); 54 | } 55 | } 56 | if ($lpath = mecab_node_lpath($node)) { 57 | $ar['lpath'] = array( 58 | 'prob' => mecab_path_prob($lpath), 59 | 'cost' => mecab_path_cost($lpath), 60 | 'rnode' => '-', 61 | 'lnode' => '-', 62 | ); 63 | if ($lpath_rnode = mecab_path_rnode($lpath)) { 64 | $ar['lpath']['rnode'] = call_format($lpath_rnode); 65 | } 66 | if ($lpath_lnode = mecab_path_lnode($lpath)) { 67 | $ar['lpath']['lnode'] = call_format($lpath_lnode); 68 | } 69 | } 70 | print_r($ar); 71 | border(); 72 | $node = mecab_node_next($node); 73 | } 74 | } 75 | 76 | mecab_destroy($mecab); 77 | -------------------------------------------------------------------------------- /mecab/examples/dumpall-ns.php: -------------------------------------------------------------------------------- 1 | getSurface(), $node->getFeature(), $node->getId(), $node->getStat()); 15 | } 16 | 17 | if ($node = $mecab->parseToNode($str)) { 18 | border(); 19 | while ($node) { 20 | $ar = array( 21 | 'node' => $node->toArray(), 22 | 'prev' => '-', 23 | 'next' => '-', 24 | 'enext' => '-', 25 | 'bnext' => '-', 26 | 'rpath' => '-', 27 | 'lpath' => '-', 28 | ); 29 | if ($prev = $node->getPrev()) { 30 | $ar['prev'] = call_format($prev); 31 | } 32 | if ($next = $node->getNext()) { 33 | $ar['next'] = call_format($next); 34 | } 35 | if ($enext = $node->getENext()) { 36 | $ar['enext'] = call_format($enext); 37 | } 38 | if ($bnext = $node->getBNext()) { 39 | $ar['bnext'] = call_format($bnext); 40 | } 41 | if ($rpath = $node->getRPath()) { 42 | $ar['rpath'] = array( 43 | 'prob' => $rpath->getProb(), 44 | 'cost' => $rpath->getCost(), 45 | 'rnode' => '-', 46 | 'lnode' => '-', 47 | ); 48 | if ($rpath_rnode = $rpath->getRNode()) { 49 | $ar['rpath']['rnode'] = call_format($rpath_rnode); 50 | } 51 | if ($rpath_lnode = $rpath->getLNode()) { 52 | $ar['rpath']['lnode'] = call_format($rpath_lnode); 53 | } 54 | } 55 | if ($lpath = $node->getLPath()) { 56 | $ar['lpath'] = array( 57 | 'prob' => $lpath->getProb(), 58 | 'cost' => $lpath->getCost(), 59 | 'rnode' => '-', 60 | 'lnode' => '-', 61 | ); 62 | if ($lpath_rnode = $lpath->getRNode()) { 63 | $ar['lpath']['rnode'] = call_format($lpath_rnode); 64 | } 65 | if ($lpath_lnode = $lpath->getLNode()) { 66 | $ar['lpath']['lnode'] = call_format($lpath_lnode); 67 | } 68 | } 69 | print_r($ar); 70 | border(); 71 | $node = $node->getNext(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /mecab/examples/dumpall-ns2.php: -------------------------------------------------------------------------------- 1 | surface, $node->feature, $node->id, $node->stat); 15 | } 16 | 17 | if ($iter = $mecab->parseToNode($str)) { 18 | border(); 19 | foreach ($iter as $node) { 20 | $ar = array( 21 | 'node' => $node->toArray(), 22 | 'prev' => '-', 23 | 'next' => '-', 24 | 'enext' => '-', 25 | 'bnext' => '-', 26 | 'rpath' => '-', 27 | 'lpath' => '-', 28 | ); 29 | if ($node->prev) { 30 | $ar['prev'] = call_format($node->prev); 31 | } 32 | if ($node->next) { 33 | $ar['next'] = call_format($node->next); 34 | } 35 | if ($node->enext) { 36 | $ar['enext'] = call_format($node->enext); 37 | } 38 | if ($node->bnext) { 39 | $ar['bnext'] = call_format($node->bnext); 40 | } 41 | if ($rpath = $node->rpath) { 42 | $ar['rpath'] = array( 43 | 'prob' => $rpath->prob, 44 | 'cost' => $rpath->cost, 45 | 'rnode' => '-', 46 | 'lnode' => '-', 47 | ); 48 | if ($rpath->rnode) { 49 | $ar['rpath']['rnode'] = call_format($rpath->rnode); 50 | } 51 | if ($rpath->lnode) { 52 | $ar['rpath']['lnode'] = call_format($rpath->lnode); 53 | } 54 | } 55 | if ($lpath = $node->lpath) { 56 | $ar['lpath'] = array( 57 | 'prob' => $lpath->prob, 58 | 'cost' => $lpath->cost, 59 | 'rnode' => '-', 60 | 'lnode' => '-', 61 | ); 62 | if ($lpath->rnode) { 63 | $ar['lpath']['rnode'] = call_format($lpath->rnode); 64 | } 65 | if ($lpath->lnode) { 66 | $ar['lpath']['lnode'] = call_format($lpath->lnode); 67 | } 68 | } 69 | print_r($ar); 70 | border(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /mecab/examples/dumpall-oo.php: -------------------------------------------------------------------------------- 1 | getSurface(), $node->getFeature(), $node->getId(), $node->getStat()); 15 | } 16 | 17 | if ($node = $mecab->parseToNode($str)) { 18 | border(); 19 | while ($node) { 20 | $ar = array( 21 | 'node' => $node->toArray(), 22 | 'prev' => '-', 23 | 'next' => '-', 24 | 'enext' => '-', 25 | 'bnext' => '-', 26 | 'rpath' => '-', 27 | 'lpath' => '-', 28 | ); 29 | if ($prev = $node->getPrev()) { 30 | $ar['prev'] = call_format($prev); 31 | } 32 | if ($next = $node->getNext()) { 33 | $ar['next'] = call_format($next); 34 | } 35 | if ($enext = $node->getENext()) { 36 | $ar['enext'] = call_format($enext); 37 | } 38 | if ($bnext = $node->getBNext()) { 39 | $ar['bnext'] = call_format($bnext); 40 | } 41 | if ($rpath = $node->getRPath()) { 42 | $ar['rpath'] = array( 43 | 'prob' => $rpath->getProb(), 44 | 'cost' => $rpath->getCost(), 45 | 'rnode' => '-', 46 | 'lnode' => '-', 47 | ); 48 | if ($rpath_rnode = $rpath->getRNode()) { 49 | $ar['rpath']['rnode'] = call_format($rpath_rnode); 50 | } 51 | if ($rpath_lnode = $rpath->getLNode()) { 52 | $ar['rpath']['lnode'] = call_format($rpath_lnode); 53 | } 54 | } 55 | if ($lpath = $node->getLPath()) { 56 | $ar['lpath'] = array( 57 | 'prob' => $lpath->getProb(), 58 | 'cost' => $lpath->getCost(), 59 | 'rnode' => '-', 60 | 'lnode' => '-', 61 | ); 62 | if ($lpath_rnode = $lpath->getRNode()) { 63 | $ar['lpath']['rnode'] = call_format($lpath_rnode); 64 | } 65 | if ($lpath_lnode = $lpath->getLNode()) { 66 | $ar['lpath']['lnode'] = call_format($lpath_lnode); 67 | } 68 | } 69 | print_r($ar); 70 | border(); 71 | $node = $node->getNext(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /mecab/examples/dumpall-oo2.php: -------------------------------------------------------------------------------- 1 | surface, $node->feature, $node->id, $node->stat); 15 | } 16 | 17 | if ($iter = $mecab->parseToNode($str)) { 18 | border(); 19 | foreach ($iter as $node) { 20 | $ar = array( 21 | 'node' => $node->toArray(), 22 | 'prev' => '-', 23 | 'next' => '-', 24 | 'enext' => '-', 25 | 'bnext' => '-', 26 | 'rpath' => '-', 27 | 'lpath' => '-', 28 | ); 29 | if ($node->prev) { 30 | $ar['prev'] = call_format($node->prev); 31 | } 32 | if ($node->next) { 33 | $ar['next'] = call_format($node->next); 34 | } 35 | if ($node->enext) { 36 | $ar['enext'] = call_format($node->enext); 37 | } 38 | if ($node->bnext) { 39 | $ar['bnext'] = call_format($node->bnext); 40 | } 41 | if ($rpath = $node->rpath) { 42 | $ar['rpath'] = array( 43 | 'prob' => $rpath->prob, 44 | 'cost' => $rpath->cost, 45 | 'rnode' => '-', 46 | 'lnode' => '-', 47 | ); 48 | if ($rpath->rnode) { 49 | $ar['rpath']['rnode'] = call_format($rpath->rnode); 50 | } 51 | if ($rpath->lnode) { 52 | $ar['rpath']['lnode'] = call_format($rpath->lnode); 53 | } 54 | } 55 | if ($lpath = $node->lpath) { 56 | $ar['lpath'] = array( 57 | 'prob' => $lpath->prob, 58 | 'cost' => $lpath->cost, 59 | 'rnode' => '-', 60 | 'lnode' => '-', 61 | ); 62 | if ($lpath->rnode) { 63 | $ar['lpath']['rnode'] = call_format($lpath->rnode); 64 | } 65 | if ($lpath->lnode) { 66 | $ar['lpath']['lnode'] = call_format($lpath->lnode); 67 | } 68 | } 69 | print_r($ar); 70 | border(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /mecab/examples/format-func.php: -------------------------------------------------------------------------------- 1 | parseToNode($str_long); 15 | while ($node) { 16 | echo $mecab->formatNode($node); 17 | $node = $node->getNext(); 18 | } 19 | 20 | border(); 21 | 22 | $node = $mecab->parseToNode($str_long); 23 | while ($node) { 24 | echo $node->toString(); 25 | $node = $node->getNext(); 26 | } 27 | 28 | border(); 29 | -------------------------------------------------------------------------------- /mecab/examples/format-ns2.php: -------------------------------------------------------------------------------- 1 | parseToNode($str_long) as $node) { 15 | echo $mecab->formatNode($node); 16 | } 17 | 18 | border(); 19 | 20 | foreach ($mecab->parseToNode($str_long) as $node) { 21 | echo $node; 22 | } 23 | 24 | border(); 25 | -------------------------------------------------------------------------------- /mecab/examples/format-oo.php: -------------------------------------------------------------------------------- 1 | parseToNode($str_long); 15 | while ($node) { 16 | echo $mecab->formatNode($node); 17 | $node = $node->getNext(); 18 | } 19 | 20 | border(); 21 | 22 | $node = $mecab->parseToNode($str_long); 23 | while ($node) { 24 | echo $node->toString(); 25 | $node = $node->getNext(); 26 | } 27 | 28 | border(); 29 | -------------------------------------------------------------------------------- /mecab/examples/format-oo2.php: -------------------------------------------------------------------------------- 1 | parseToNode($str_long) as $node) { 15 | echo $mecab->formatNode($node); 16 | } 17 | 18 | border(); 19 | 20 | foreach ($mecab->parseToNode($str_long) as $node) { 21 | echo $node; 22 | } 23 | 24 | border(); 25 | -------------------------------------------------------------------------------- /mecab/examples/nbest-func.php: -------------------------------------------------------------------------------- 1 | parseNBestInit($str_long)) { 13 | border(); 14 | for ($i = 0; ($i < NBEST_MAX_RESULT && ($next = $mecab->next())); $i++) { 15 | echo $next; 16 | border(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mecab/examples/nbest-oo.php: -------------------------------------------------------------------------------- 1 | parseNBestInit($str_long)) { 13 | border(); 14 | for ($i = 0; ($i < NBEST_MAX_RESULT && ($next = $mecab->next())); $i++) { 15 | echo $next; 16 | border(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mecab/examples/parse-func.php: -------------------------------------------------------------------------------- 1 | parse($str_long); 15 | 16 | border(); 17 | -------------------------------------------------------------------------------- /mecab/examples/parse-oo.php: -------------------------------------------------------------------------------- 1 | parse($str_long); 15 | 16 | border(); 17 | -------------------------------------------------------------------------------- /mecab/examples/provides-r.php: -------------------------------------------------------------------------------- 1 | getName();'); 15 | 16 | border(); 17 | 18 | echo 'Module dependencies:', $linebreak; 19 | print_r($reflector->getDependencies()); 20 | 21 | border(); 22 | 23 | echo 'INI entries:', $linebreak; 24 | print_r($reflector->getINIEntries()); 25 | 26 | border(); 27 | 28 | echo 'Constants:', $linebreak; 29 | print_r($reflector->getConstants()); 30 | 31 | border(); 32 | 33 | echo 'Functions:', $linebreak; 34 | print_r(array_keys($reflector->getFunctions())); 35 | 36 | border(); 37 | 38 | echo 'Classes:', $linebreak; 39 | $classes = array(); 40 | foreach ($reflector->getClasses() as $className => $class) { 41 | $classes[$className] = array( 42 | 'interfaces' => null, 43 | 'constants' => $class->getConstants(), 44 | 'properties' => $class->getProperties(), 45 | 'methods' => array_map($mapper, $class->getMethods()), 46 | ); 47 | if (method_exists($class, 'getInterfaceNames')) { 48 | $classes[$className]['interfaces'] = $class->getInterfaceNames(); 49 | } else { 50 | $classes[$className]['interfaces'] = array_keys($class->getInterfaces()); 51 | } 52 | } 53 | print_r($classes); 54 | 55 | border(); 56 | -------------------------------------------------------------------------------- /mecab/examples/provides.php: -------------------------------------------------------------------------------- 1 | parse($sentence)); 24 | 25 | foreach ($t->parseToNode($sentence) as $m) { 26 | writeln($m->surface . "\t" . $m->feature); 27 | } 28 | writeln('EOS'); 29 | 30 | $di = $t->dictionaryInfo(); 31 | foreach ($di as $d) { 32 | writefln('filename: %s', $d['filename']); 33 | writefln('charset: %s', $d['charset']); 34 | writefln('size: %d', $d['size']); 35 | writefln('type: %d', $d['type']); 36 | writefln('lsize: %d', $d['lsize']); 37 | writefln('rsize: %d', $d['rsize']); 38 | writefln('version: %d', $d['version']); 39 | } 40 | -------------------------------------------------------------------------------- /mecab/examples/test-oo.php: -------------------------------------------------------------------------------- 1 | parse($sentence)); 24 | 25 | foreach ($t->parseToNode($sentence) as $m) { 26 | writeln($m->surface . "\t" . $m->feature); 27 | } 28 | writeln('EOS'); 29 | 30 | $di = $t->dictionaryInfo(); 31 | foreach ($di as $d) { 32 | writefln('filename: %s', $d['filename']); 33 | writefln('charset: %s', $d['charset']); 34 | writefln('size: %d', $d['size']); 35 | writefln('type: %d', $d['type']); 36 | writefln('lsize: %d', $d['lsize']); 37 | writefln('rsize: %d', $d['rsize']); 38 | writefln('version: %d', $d['version']); 39 | } 40 | -------------------------------------------------------------------------------- /mecab/examples/wakati-func.php: -------------------------------------------------------------------------------- 1 | parse($str_long); 15 | 16 | border(); 17 | 18 | print_r(MeCab\split($str)); 19 | 20 | border(); 21 | -------------------------------------------------------------------------------- /mecab/examples/wakati-oo.php: -------------------------------------------------------------------------------- 1 | parse($str_long); 15 | 16 | border(); 17 | 18 | print_r(MeCab::split($str)); 19 | 20 | border(); 21 | -------------------------------------------------------------------------------- /mecab/mecab.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="mecab" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 6 | 7 | CFG=mecab - Win32 Debug_TS 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "mecab.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "mecab.mak" CFG="mecab - Win32 Debug_TS" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "mecab - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") 21 | !MESSAGE "mecab - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "mecab - Win32 Release_TS" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release_TS" 37 | # PROP BASE Intermediate_Dir "Release_TS" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release_TS" 42 | # PROP Intermediate_Dir "Release_TS" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MECAB_EXPORTS" /YX /FD /c 46 | # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_MECAB" /D ZTS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD BASE RSC /l 0x407 /d "NDEBUG" 50 | # ADD RSC /l 0x407 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mecab.lib stdc++.lib /nologo /dll /machine:I386 56 | # ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mecab.lib stdc++.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_mecab.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" 57 | 58 | !ELSEIF "$(CFG)" == "mecab - Win32 Debug_TS" 59 | 60 | # PROP BASE Use_MFC 0 61 | # PROP BASE Use_Debug_Libraries 1 62 | # PROP BASE Output_Dir "Debug_TS" 63 | # PROP BASE Intermediate_Dir "Debug_TS" 64 | # PROP BASE Target_Dir "" 65 | # PROP Use_MFC 0 66 | # PROP Use_Debug_Libraries 1 67 | # PROP Output_Dir "Debug_TS" 68 | # PROP Intermediate_Dir "Debug_TS" 69 | # PROP Ignore_Export_Lib 0 70 | # PROP Target_Dir "" 71 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MECAB_EXPORTS" /YX /FD /GZ /c 72 | # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_MECAB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /GZ /c 73 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 74 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 75 | # ADD BASE RSC /l 0x407 /d "_DEBUG" 76 | # ADD RSC /l 0x407 /d "_DEBUG" 77 | BSC32=bscmake.exe 78 | # ADD BASE BSC32 /nologo 79 | # ADD BSC32 /nologo 80 | LINK32=link.exe 81 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mecab.lib stdc++.lib /nologo /dll /debug /machine:I386 /pdbtype:sept 82 | # ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mecab.lib stdc++.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_mecab.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" 83 | 84 | !ENDIF 85 | 86 | # Begin Target 87 | 88 | # Name "mecab - Win32 Release_TS" 89 | # Name "mecab - Win32 Debug_TS" 90 | 91 | # Begin Group "Source Files" 92 | 93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 94 | 95 | # Begin Source File 96 | 97 | SOURCE=./mecab.c 98 | # End Source File 99 | 100 | # End Group 101 | 102 | # Begin Group "Header Files" 103 | 104 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 105 | 106 | # Begin Source File 107 | 108 | SOURCE=.\php_mecab.h 109 | # End Source File 110 | # End Group 111 | # End Target 112 | # End Project 113 | -------------------------------------------------------------------------------- /mecab/package.php: -------------------------------------------------------------------------------- 1 | setOptions(array( 36 | 'baseinstalldir' => '/', 37 | 'packagedirectory' => dirname(__FILE__), 38 | 'filelistgenerator' => 'file', 39 | 'ignore' => array( 40 | 'package.php', 41 | 'package.xml', 42 | "{$packagename}-{$version}.tgz"), 43 | 'dir_roles' => array( 44 | 'tests' => 'test', 45 | 'examples' => 'data'), 46 | 'exceptions' => array( 47 | "{$packagename}.dsp" => 'src', 48 | 'CREDITS' => 'doc', 49 | 'EXPERIMENTAL' => 'doc', 50 | 'LICENSE' => 'doc', 51 | 'README' => 'doc'))); 52 | 53 | $packagexml->setPackage($packagename); 54 | $packagexml->setSummary($summary); 55 | $packagexml->setNotes($notes); 56 | $packagexml->setDescription($description); 57 | $packagexml->setLicense('MIT License', 'http://www.opensource.org/licenses/mit-license.php'); 58 | 59 | $packagexml->setReleaseVersion($version); 60 | $packagexml->setAPIVersion($apiversion); 61 | $packagexml->setReleaseStability($stability); 62 | $packagexml->setAPIStability($apistability); 63 | 64 | $packagexml->addMaintainer('lead', 'rsk', 'Ryusuke SEKIYAMA', 'rsky0711@gmail.com'); 65 | 66 | $packagexml->setPackageType('extsrc'); 67 | $packagexml->setProvidesExtension($packagename); 68 | $packagexml->addConfigureOption('with-mecab', 'specify pathname to mecab-config', 'no'); 69 | $packagexml->setPhpDep('5.3.0'); 70 | $packagexml->setPearinstallerDep('1.4.1'); 71 | 72 | $packagexml->setChannel($channel); 73 | $packagexml->generateContents(); 74 | 75 | // generate package.xml 76 | if (php_sapi_name() === 'cli' && $_SERVER['argc'] > 1 && $_SERVER['argv'][1] === 'make') { 77 | $make = true; 78 | } elseif (!empty($_GET['make'])) { 79 | $make = true; 80 | } else { 81 | $make = false; 82 | } 83 | // note use of debugPackageFile() - this is VERY important 84 | if ($make) { 85 | $packagexml->writePackageFile(); 86 | $data = file_get_contents('package.xml'); 87 | } else { 88 | $packagexml->debugPackageFile(); 89 | } 90 | -------------------------------------------------------------------------------- /mecab/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | mecab 7 | pecl.opendogs.org 8 | The PHP bindings of the MeCab. 9 | The PHP bindings of the MeCab. 10 | 11 | Ryusuke SEKIYAMA 12 | rsk 13 | rsky0711@gmail.com 14 | yes 15 | 16 | 2015-12-05 17 | 18 | 19 | 0.6.0 20 | 0.6.0 21 | 22 | 23 | beta 24 | beta 25 | 26 | MIT License 27 | 28 | * Add support for PHP 7. 29 | * Add `MeCab` namespace classes and constants. 30 | * Non-namespace classes are not supported on PHP 7. 31 | * Non-namespace constants are not supported on PHP 7. 32 | * Procedural APIs (`mecab_*` functions) are not supported on PHP 7. 33 | * Non-namespace classes are deprecated on PHP 5. 34 | * PHP versions earlier than 5.3 are no longer supported. 35 | * MeCab versions earlier than 0.99 are no longer supported. 36 | * Removed features: 37 | * `$filter` callback argument of `mecab_split()` function. 38 | * The persistent resource. 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 5.3.0 179 | 180 | 181 | 1.4.1 182 | 183 | 184 | 185 | mecab 186 | 187 | 188 | 189 | 190 | 191 | 192 | 0.4.1 193 | 0.4.0 194 | 195 | 196 | beta 197 | beta 198 | 199 | 2010-06-19 200 | MIT License 201 | 202 | - Initial release on PEAR channel. 203 | 204 | 205 | 206 | 207 | 0.5.0 208 | 0.5.0 209 | 210 | 211 | beta 212 | beta 213 | 214 | 2012-03-04 215 | MIT License 216 | 217 | - Added support for PHP 5.4.0. 218 | - Added support for MeCab 0.99. 219 | 220 | 221 | 222 | 223 | 0.6.0 224 | 0.6.0 225 | 226 | 227 | beta 228 | beta 229 | 230 | 2015-12-05 231 | MIT License 232 | 233 | * Add support for PHP 7. 234 | * Add `MeCab` namespace classes and constants. 235 | * Non-namespace classes are not supported on PHP 7. 236 | * Non-namespace constants are not supported on PHP 7. 237 | * Procedural APIs (`mecab_*` functions) are not supported on PHP 7. 238 | * Non-namespace classes are deprecated on PHP 5. 239 | * PHP versions earlier than 5.3 are no longer supported. 240 | * MeCab versions earlier than 0.99 are no longer supported. 241 | * Removed features: 242 | * `$filter` callback argument of `mecab_split()` function. 243 | * The persistent resource. 244 | 245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /mecab/php_mecab.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The MeCab PHP extension 3 | * 4 | * Copyright (c) 2006-2015 Ryusuke SEKIYAMA. All rights reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included 14 | * in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 | * DEALINGS IN THE SOFTWARE. 23 | * 24 | * @package php-mecab 25 | * @author Ryusuke SEKIYAMA 26 | * @copyright 2006-2015 Ryusuke SEKIYAMA 27 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 28 | * @version $Id$ 29 | */ 30 | 31 | #ifndef PHP_MECAB_H 32 | #define PHP_MECAB_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | #ifdef HAVE_CONFIG_H 39 | #include "config.h" 40 | #endif 41 | 42 | #include 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #ifdef __cplusplus 52 | } /* extern "C" */ 53 | #endif 54 | 55 | #include 56 | 57 | #ifdef __cplusplus 58 | extern "C" { 59 | #endif 60 | 61 | #ifdef ZTS 62 | #include "TSRM.h" 63 | #endif 64 | 65 | #define PHP_MECAB_MODULE_VERSION "0.6.0" 66 | 67 | #ifndef PHP_MECAB_VERSION_NUMBER 68 | #define PHP_MECAB_VERSION_NUMBER 0 69 | #endif 70 | #ifndef PHP_MECAB_VERSION_STRING 71 | #define PHP_MECAB_VERSION_STRING "unknown" 72 | #endif 73 | 74 | #define FREE_RESOURCE(resource) zend_list_delete(Z_RESVAL_P(resource)) 75 | 76 | /* {{{ module globals */ 77 | 78 | ZEND_BEGIN_MODULE_GLOBALS(mecab) 79 | char *default_rcfile; 80 | char *default_dicdir; 81 | char *default_userdic; 82 | ZEND_END_MODULE_GLOBALS(mecab) 83 | 84 | #ifdef ZTS 85 | #define MECAB_G(v) TSRMG(mecab_globals_id, zend_mecab_globals *, v) 86 | #else 87 | #define MECAB_G(v) (mecab_globals.v) 88 | #endif 89 | 90 | /* }}} */ 91 | 92 | /* {{{ type definitions */ 93 | 94 | typedef enum _php_mecab_node_attribute php_mecab_node_attribute; 95 | typedef enum _php_mecab_node_rel php_mecab_node_rel; 96 | typedef enum _php_mecab_path_rel php_mecab_path_rel; 97 | typedef struct _php_mecab php_mecab; 98 | typedef struct _php_mecab_node php_mecab_node; 99 | typedef struct _php_mecab_path php_mecab_path; 100 | 101 | enum _php_mecab_node_attribute { 102 | ATTR_ALL, 103 | ATTR_SURFACE, 104 | ATTR_FEATURE, 105 | ATTR_ID, 106 | ATTR_LENGTH, 107 | ATTR_RLENGTH, 108 | ATTR_RCATTR, 109 | ATTR_LCATTR, 110 | ATTR_POSID, 111 | ATTR_CHAR_TYPE, 112 | ATTR_STAT, 113 | ATTR_ISBEST, 114 | ATTR_ALPHA, 115 | ATTR_BETA, 116 | ATTR_PROB, 117 | ATTR_WCOST, 118 | ATTR_COST 119 | }; 120 | 121 | enum _php_mecab_node_rel { 122 | NODE_PREV, 123 | NODE_NEXT, 124 | NODE_ENEXT, 125 | NODE_BNEXT, 126 | NODE_RPATH, 127 | NODE_LPATH 128 | }; 129 | 130 | enum _php_mecab_path_rel { 131 | PATH_RNODE, 132 | PATH_RNEXT, 133 | PATH_LNODE, 134 | PATH_LNEXT 135 | }; 136 | 137 | struct _php_mecab { 138 | mecab_t *ptr; 139 | #if PHP_VERSION_ID >= 70000 140 | zend_string *str; 141 | #else 142 | char *str; 143 | int len; 144 | #endif 145 | int ref; 146 | }; 147 | 148 | struct _php_mecab_node { 149 | php_mecab *tagger; 150 | const mecab_node_t *ptr; 151 | }; 152 | 153 | struct _php_mecab_path { 154 | php_mecab *tagger; 155 | const mecab_path_t *ptr; 156 | }; 157 | 158 | typedef enum _php_mecab_traverse_mode php_mecab_traverse_mode; 159 | typedef struct _php_mecab_object php_mecab_object; 160 | typedef struct _php_mecab_node_object php_mecab_node_object; 161 | typedef struct _php_mecab_path_object php_mecab_path_object; 162 | 163 | enum _php_mecab_traverse_mode { 164 | TRAVERSE_NEXT, 165 | TRAVERSE_ENEXT, 166 | TRAVERSE_BNEXT 167 | }; 168 | 169 | struct _php_mecab_object { 170 | zend_object std; 171 | php_mecab *ptr; 172 | }; 173 | 174 | struct _php_mecab_node_object { 175 | zend_object std; 176 | php_mecab_node *ptr; 177 | const mecab_node_t *root; 178 | php_mecab_traverse_mode mode; 179 | }; 180 | 181 | struct _php_mecab_path_object { 182 | zend_object std; 183 | php_mecab_path *ptr; 184 | }; 185 | 186 | /* }}} */ 187 | 188 | #ifdef __cplusplus 189 | } /* extern "C" */ 190 | #endif 191 | 192 | #endif /* PHP_MECAB_H */ 193 | 194 | 195 | /* 196 | * Local variables: 197 | * tab-width: 4 198 | * c-basic-offset: 4 199 | * End: 200 | * vim600: noet sw=4 ts=4 fdm=marker 201 | * vim<600: noet sw=4 ts=4 202 | */ 203 | -------------------------------------------------------------------------------- /mecab/php_mecab_compat5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * macros for compatibility 3 | */ 4 | #ifndef PHP_MECAB_COMPAT_H 5 | #define PHP_MECAB_COMPAT_H 6 | 7 | #define PHP_MECAB_FETCH_OBJECT(ptr, type, zv) ptr = (type)zend_object_store_get_object((zv) TSRMLS_CC) 8 | 9 | #define PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER() { \ 10 | if (object) { \ 11 | zmecab = object; \ 12 | if (ZEND_NUM_ARGS() != 0) { \ 13 | WRONG_PARAM_COUNT; \ 14 | } else { \ 15 | php_mecab_object *intern; \ 16 | PHP_MECAB_FETCH_OBJECT(intern, php_mecab_object *, object); \ 17 | xmecab = intern->ptr; \ 18 | } \ 19 | } else { \ 20 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zmecab) == FAILURE) { \ 21 | return; \ 22 | } \ 23 | ZEND_FETCH_RESOURCE(xmecab, php_mecab *, &zmecab, -1, "mecab", le_mecab); \ 24 | } \ 25 | } 26 | 27 | #define PHP_MECAB_RSRC_FROM_PARAMETER() \ 28 | PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER() \ 29 | mecab = xmecab->ptr; \ 30 | 31 | #define PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(name) { \ 32 | if (object) { \ 33 | z##name = object; \ 34 | if (ZEND_NUM_ARGS() != 0) { \ 35 | WRONG_PARAM_COUNT; \ 36 | } else { \ 37 | php_mecab_##name##_object *intern; \ 38 | PHP_MECAB_FETCH_OBJECT(intern, php_mecab_##name##_object *, object); \ 39 | x##name = intern->ptr; \ 40 | } \ 41 | } else { \ 42 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z##name) == FAILURE) { \ 43 | return; \ 44 | } \ 45 | ZEND_FETCH_RESOURCE(x##name, php_mecab_##name *, &z##name, -1, "mecab_" #name, le_mecab_##name); \ 46 | } \ 47 | } 48 | 49 | #define PHP_MECAB_RSRC_FROM_PARAMETER2(name) \ 50 | PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(name) \ 51 | name = x##name->ptr; 52 | 53 | #define PHP_MECAB_PARSE_PARAMETERS(fmt, ...) { \ 54 | if (object) { \ 55 | zmecab = object; \ 56 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, fmt, __VA_ARGS__) == FAILURE) { \ 57 | return; \ 58 | } else { \ 59 | php_mecab_object *intern; \ 60 | PHP_MECAB_FETCH_OBJECT(intern, php_mecab_object *, object); \ 61 | xmecab = intern->ptr; \ 62 | } \ 63 | } else { \ 64 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r" fmt, &zmecab, __VA_ARGS__) == FAILURE) { \ 65 | return; \ 66 | } \ 67 | ZEND_FETCH_RESOURCE(xmecab, php_mecab *, &zmecab, -1, "mecab", le_mecab); \ 68 | } \ 69 | mecab = xmecab->ptr; \ 70 | } 71 | 72 | #define PHP_MECAB_PARSE_PARAMETERS2(name, fmt, ...) { \ 73 | if (object) { \ 74 | z##name = object; \ 75 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, fmt, __VA_ARGS__) == FAILURE) { \ 76 | return; \ 77 | } else { \ 78 | php_mecab_##name##_object *intern; \ 79 | PHP_MECAB_FETCH_OBJECT(intern, php_mecab_##name##_object *, object); \ 80 | x##name = intern->ptr; \ 81 | } \ 82 | } else { \ 83 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r" fmt, &z##name, __VA_ARGS__) == FAILURE) { \ 84 | return; \ 85 | } \ 86 | ZEND_FETCH_RESOURCE(x##name, php_mecab_##name *, &z##name, -1, "mecab_" #name, le_mecab_##name); \ 87 | } \ 88 | name = x##name->ptr; \ 89 | } 90 | 91 | #define PHP_MECAB_RETURN_PROPERTY(name, type, ...) { \ 92 | zval *object = getThis(); \ 93 | php_mecab_##name *x##name = NULL; \ 94 | const mecab_##name##_t *name = NULL; \ 95 | if (object) { \ 96 | if (ZEND_NUM_ARGS() != 0) { \ 97 | WRONG_PARAM_COUNT; \ 98 | } else { \ 99 | php_mecab_##name##_object *intern; \ 100 | intern = (php_mecab_##name##_object *)zend_object_store_get_object(object TSRMLS_CC); \ 101 | x##name = intern->ptr; \ 102 | } \ 103 | } else { \ 104 | zval *z##name = NULL; \ 105 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z##name) == FAILURE) { \ 106 | return; \ 107 | } \ 108 | ZEND_FETCH_RESOURCE(x##name, php_mecab_##name*, &z##name, -1, "mecab_" #name, le_mecab_##name); \ 109 | } \ 110 | name = x##name->ptr; \ 111 | RETURN_##type(__VA_ARGS__); \ 112 | } 113 | 114 | #define PHP_MECAB_FROM_PARAMETER() PHP_MECAB_RSRC_FROM_PARAMETER() 115 | #define PHP_MECAB_NODE_FROM_PARAMETER() PHP_MECAB_RSRC_FROM_PARAMETER2(node) 116 | #define PHP_MECAB_PATH_FROM_PARAMETER() PHP_MECAB_RSRC_FROM_PARAMETER2(path) 117 | 118 | #define PHP_MECAB_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER() 119 | #define PHP_MECAB_NODE_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(node) 120 | #define PHP_MECAB_PATH_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(path) 121 | 122 | #define PHP_MECAB_NODE_PARSE_PARAMETERS(fmt, ...) PHP_MECAB_PARSE_PARAMETERS2(node, fmt, __VA_ARGS__) 123 | #define PHP_MECAB_PATH_PARSE_PARAMETERS(fmt, ...) PHP_MECAB_PARSE_PARAMETERS2(path, fmt, __VA_ARGS__) 124 | 125 | #define PHP_MECAB_NODE_RETURN_PROPERTY(type, ...) PHP_MECAB_RETURN_PROPERTY(node, type, __VA_ARGS__) 126 | #define PHP_MECAB_PATH_RETURN_PROPERTY(type, ...) PHP_MECAB_RETURN_PROPERTY(path, type, __VA_ARGS__) 127 | 128 | #define PHP_MECAB_REGISTER_CONSTANT(name) \ 129 | REGISTER_LONG_CONSTANT(#name, name, CONST_PERSISTENT | CONST_CS) 130 | 131 | #define PHP_MECAB_REGISTER_NS_CONSTANT(name) \ 132 | REGISTER_NS_LONG_CONSTANT("MeCab", #name, MECAB_##name, CONST_PERSISTENT | CONST_CS) 133 | 134 | #if PHP_API_VERSION < 20100412 135 | static inline void 136 | object_properties_init(zend_object *object, zend_class_entry *class_type) 137 | { 138 | zval *tmp = NULL; 139 | zend_hash_copy(object->properties, &class_type->default_properties, 140 | (copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *)); 141 | } 142 | #endif 143 | 144 | #endif /* PHP_MECAB_COMPAT_H */ 145 | -------------------------------------------------------------------------------- /mecab/php_mecab_compat7.h: -------------------------------------------------------------------------------- 1 | /* 2 | * macros for compatibility 3 | */ 4 | #ifndef PHP_MECAB_COMPAT_H 5 | #define PHP_MECAB_COMPAT_H 6 | 7 | #define PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER() { \ 8 | if (ZEND_NUM_ARGS() != 0) { \ 9 | WRONG_PARAM_COUNT; \ 10 | } else { \ 11 | const php_mecab_object *intern = php_mecab_object_fetch_object(Z_OBJ_P(getThis())); \ 12 | xmecab = intern->ptr; \ 13 | } \ 14 | } 15 | 16 | #define PHP_MECAB_RSRC_FROM_PARAMETER() \ 17 | PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER() \ 18 | mecab = xmecab->ptr; \ 19 | 20 | #define PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(name) { \ 21 | if (ZEND_NUM_ARGS() != 0) { \ 22 | WRONG_PARAM_COUNT; \ 23 | } else { \ 24 | const php_mecab_##name##_object *intern = php_mecab_##name##_object_fetch_object(Z_OBJ_P(getThis())); \ 25 | x##name = intern->ptr; \ 26 | } \ 27 | } 28 | 29 | #define PHP_MECAB_RSRC_FROM_PARAMETER2(name) \ 30 | PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(name) \ 31 | name = x##name->ptr; 32 | 33 | #define PHP_MECAB_PARSE_PARAMETERS(fmt, ...) { \ 34 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, fmt, __VA_ARGS__) == FAILURE) { \ 35 | return; \ 36 | } else { \ 37 | const php_mecab_object *intern = php_mecab_object_fetch_object(Z_OBJ_P(getThis())); \ 38 | xmecab = intern->ptr; \ 39 | } \ 40 | mecab = xmecab->ptr; \ 41 | } 42 | 43 | #define PHP_MECAB_PARSE_PARAMETERS2(name, fmt, ...) { \ 44 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, fmt, __VA_ARGS__) == FAILURE) { \ 45 | return; \ 46 | } else { \ 47 | const php_mecab_##name##_object *intern = php_mecab_##name##_object_fetch_object(Z_OBJ_P(getThis())); \ 48 | x##name = intern->ptr; \ 49 | } \ 50 | } 51 | 52 | #define PHP_MECAB_RETURN_PROPERTY(name, type, ...) { \ 53 | if (ZEND_NUM_ARGS() != 0) { \ 54 | WRONG_PARAM_COUNT; \ 55 | } else { \ 56 | const php_mecab_##name##_object *intern = php_mecab_##name##_object_fetch_object(Z_OBJ_P(getThis())); \ 57 | const php_mecab_##name *x##name = intern->ptr; \ 58 | const mecab_##name##_t *name = x##name->ptr; \ 59 | RETURN_##type(__VA_ARGS__); \ 60 | } \ 61 | } 62 | 63 | #define PHP_MECAB_FROM_PARAMETER() PHP_MECAB_RSRC_FROM_PARAMETER() 64 | #define PHP_MECAB_NODE_FROM_PARAMETER() PHP_MECAB_RSRC_FROM_PARAMETER2(node) 65 | #define PHP_MECAB_PATH_FROM_PARAMETER() PHP_MECAB_RSRC_FROM_PARAMETER2(path) 66 | 67 | #define PHP_MECAB_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER() 68 | #define PHP_MECAB_NODE_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(node) 69 | #define PHP_MECAB_PATH_INTERNAL_FROM_PARAMETER() PHP_MECAB_INTERNAL_RSRC_FROM_PARAMETER2(path) 70 | 71 | #define PHP_MECAB_NODE_PARSE_PARAMETERS(fmt, ...) PHP_MECAB_PARSE_PARAMETERS2(node, fmt, __VA_ARGS__) 72 | #define PHP_MECAB_PATH_PARSE_PARAMETERS(fmt, ...) PHP_MECAB_PARSE_PARAMETERS2(path, fmt, __VA_ARGS__) 73 | 74 | #define PHP_MECAB_NODE_RETURN_PROPERTY(type, ...) PHP_MECAB_RETURN_PROPERTY(node, type, __VA_ARGS__) 75 | #define PHP_MECAB_PATH_RETURN_PROPERTY(type, ...) PHP_MECAB_RETURN_PROPERTY(path, type, __VA_ARGS__) 76 | 77 | #define PHP_MECAB_REGISTER_NS_CONSTANT(name) \ 78 | REGISTER_NS_LONG_CONSTANT("MeCab", #name, MECAB_##name, CONST_PERSISTENT | CONST_CS) 79 | 80 | #endif /* PHP_MECAB_COMPAT_H */ 81 | -------------------------------------------------------------------------------- /mecab/tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.diff 2 | *.exp 3 | *.log 4 | *.out 5 | *.php 6 | *.sh 7 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getAlpha.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getAlpha() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getBNext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getBNext() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getBeta.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getBeta() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getCharType.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getCharType() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getCost.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getCost() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getENext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getENext() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getFeature.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getFeature() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getId.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getId() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getIterator.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getIterator() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getLPath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getLPath() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getLcAttr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getLcAttr() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getLength.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getLength() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getNext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getNext() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getPosId.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getPosId() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getPrev.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getPrev() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getProb.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getProb() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getRLength.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getRLength() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getRPath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getRPath() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getRcAttr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getRcAttr() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getStat.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getStat() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getSurface.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getSurface() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__getWCost.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::getWCost() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__isBest.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::isBest() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__setTraverse.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::setTraverse() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__toArray.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::toArray() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Node__toString.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Node::toString() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Path__getCost.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Path::getCost() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Path__getLNext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Path::getLNext() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Path__getLNode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Path::getLNode() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Path__getProb.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Path::getProb() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Path__getRNext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Path::getRNext() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Path__getRNode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Path::getRNode() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__dictionaryInfo.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::dictionaryInfo() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__formatNode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::formatNode() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__new.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | instantiate MeCab\Tagger 3 | --FILE-- 4 | 8 | --EXPECT-- 9 | MeCab\Tagger 10 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__next.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::next() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__nextNode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::nextNode() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__parse.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::parse() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__parseNBest.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::parseNBest() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__parseNBestInit.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::parseNBestInit() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__parseToNode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::parseToNode() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab_Tagger__parseToString.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\Tagger::parseToString() member function 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 11 | --EXPECT-- 12 | OK 13 | -------------------------------------------------------------------------------- /mecab/tests/MeCab__split.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\split() member function 3 | --FILE-- 4 | 7 | --EXPECT-- 8 | The/quick/brown/fox/jumps/over/the/lazy/dog/. 9 | -------------------------------------------------------------------------------- /mecab/tests/MeCab__version.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | MeCab\version() function 3 | --FILE-- 4 | 7 | --EXPECTREGEX-- 8 | [0-9]\.[0-9]+ 9 | -------------------------------------------------------------------------------- /mecab/tests/mecab_dictionary_info.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_dictionary_info() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_format_node.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_format_node() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_nbest_init.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_nbest_init() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_nbest_next_tonode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_nbest_next_tonode() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_nbest_next_tostr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_nbest_next_tostr() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_nbest_sparse_tostr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_nbest_sparse_tostr() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_new.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_new() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | ?> 9 | --FILE-- 10 | 16 | --EXPECT-- 17 | mecab 18 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_alpha.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_alpha() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_beta.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_beta() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_bnext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_bnext() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_char_type.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_char_type() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_cost.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_cost() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_enext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_enext() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_feature.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_feature() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_id.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_id() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_isbest.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_isbest() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_lcattr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_lcattr() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_length.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_length() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_lpath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_lpath() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_next.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_next() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_posid.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_posid() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_prev.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_prev() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_prob.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_prob() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_rcattr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_rcattr() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_rlength.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_rlength() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_rpath.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_rpath() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_stat.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_stat() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_surface.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_surface() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_toarray.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_toarray() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_tostring.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_tostring() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_node_wcost.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_node_wcost() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_path_cost.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_path_cost() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_path_lnext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_path_lnext() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_path_lnode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_path_lnode() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_path_prob.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_path_prob() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_path_rnext.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_path_rnext() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_path_rnode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_path_rnode() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_sparse_tonode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_sparse_tonode() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_sparse_tostr.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_sparse_tostr() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | die('skip test is not implemented'); 9 | ?> 10 | --FILE-- 11 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /mecab/tests/mecab_split.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_split() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | ?> 9 | --FILE-- 10 | 13 | --EXPECT-- 14 | The/quick/brown/fox/jumps/over/the/lazy/dog/. 15 | -------------------------------------------------------------------------------- /mecab/tests/mecab_version.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | mecab_version() function 3 | --SKIPIF-- 4 | = 70000) { 6 | die('skip this feature is not available in PHP 7'); 7 | } 8 | ?> 9 | --FILE-- 10 | 13 | --EXPECTREGEX-- 14 | [0-9]\.[0-9]+ 15 | -------------------------------------------------------------------------------- /mecab/tests/test.txt.eucjp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsky/php-mecab/e27328b0fbdf54a4b8a28e04d1b4f30a0f6934eb/mecab/tests/test.txt.eucjp -------------------------------------------------------------------------------- /packages/debian/.gitignore: -------------------------------------------------------------------------------- 1 | *.deb 2 | mecab* 3 | php-mecab* 4 | -------------------------------------------------------------------------------- /packages/debian/README.md: -------------------------------------------------------------------------------- 1 | How to make Debian package of php-mecab 2 | ======================================= 3 | 4 | REQUIREMENTS 5 | ------------ 6 | 7 | * build-essential 8 | * devscripts 9 | * dh-make 10 | * dh-make-php 11 | * libmecab-dev 12 | * mecab 13 | * php5-dev 14 | * xsltproc 15 | 16 | 17 | PREPARE 18 | ------- 19 | 20 | You will have to discover the PEAR channel. 21 | 22 | $ `sudo pear channel-discover pecl.opendogs.org` 23 | 24 | 25 | MAKE A PACKAGE 26 | -------------- 27 | 28 | 1. $ `cd php-mecab/mecab` 29 | 2. $ `pear package package.xml` 30 | 3. $ `mv mecab-x.y.z.tgz ../packages/debian/` 31 | 4. $ `cd ../packages/debian` 32 | 5. $ `dh-make-pecl --only 5 mecab-x.y.z.tgz` 33 | 6. $ `cd php-mecab-x.y.z` 34 | 7. Edit *debian/control*. 35 | * Add `mecab` and `libmecab-dev` to **Build-Depends**. 36 | * Add `libmecab1` to **Depends**. 37 | 8. $ `debuild -uc -us` *[without GPG signing]* 38 | 39 | 40 | INSTALL 41 | ------- 42 | 43 | The .deb file will be generated at *php-mecab/packages/debian*. 44 | 45 | $ `sudo dpkg -i php5-mecab_x.y.z-1_{amd64,i386}.deb` 46 | -------------------------------------------------------------------------------- /packages/debian/debian-control.diff: -------------------------------------------------------------------------------- 1 | --- debian/control.orig 2 | +++ debian/control 3 | @@ -2,12 +2,12 @@ 4 | Section: web 5 | Priority: optional 6 | Maintainer: Ryusuke SEKIYAMA 7 | -Build-Depends: debhelper (>= 7), po-debconf, xsltproc , php5-dev 8 | +Build-Depends: debhelper (>= 7), po-debconf, xsltproc , php5-dev, mecab, libmecab-dev 9 | Standards-Version: 3.8.1 10 | 11 | Package: php5-mecab 12 | Architecture: any 13 | -Depends: ${shlibs:Depends}, ${php:Depends}, ${misc:Depends} 14 | +Depends: ${shlibs:Depends}, ${php:Depends}, ${misc:Depends}, libmecab1 15 | Description: mecab module for PHP 5 16 | The PHP bindings of the MeCab. 17 | . 18 | -------------------------------------------------------------------------------- /packages/ubuntu/.gitignore: -------------------------------------------------------------------------------- 1 | *.deb 2 | mecab* 3 | php-mecab* 4 | -------------------------------------------------------------------------------- /packages/ubuntu/README.md: -------------------------------------------------------------------------------- 1 | How to make Ubuntu package of php-mecab 2 | ======================================= 3 | 4 | REQUIREMENTS 5 | ------------ 6 | 7 | * build-essential 8 | * devscripts 9 | * dh-make 10 | * dh-make-php 11 | * libmecab-dev 12 | * mecab 13 | * php5-cli 14 | * php5-dev 15 | * xsltproc 16 | 17 | 18 | PREPARE 19 | ------- 20 | 21 | You will have to discover the PEAR channel. 22 | 23 | $ `sudo pear channel-discover pecl.opendogs.org` 24 | 25 | 26 | MAKE A PACKAGE 27 | -------------- 28 | 29 | 1. $ `cd php-mecab/mecab` 30 | 2. $ `pear package package.xml` 31 | 3. $ `mv mecab-x.y.z.tgz ../packages/ubuntu/` 32 | 4. $ `cd ../packages/ubuntu` 33 | 5. $ `dh-make-pecl --phpversion 5 mecab-x.y.z.tgz` 34 | 6. $ `cd php-mecab-x.y.z` 35 | 7. Edit *debian/control*. 36 | * Add `mecab` and `libmecab-dev` to **Build-Depends**. 37 | * Add `libmecab1` to **Depends**. 38 | 8. $ `debuild -uc -us` *[without GPG signing]* 39 | 40 | 41 | INSTALL 42 | ------- 43 | 44 | The .deb file will be generated at *php-mecab/packages/ubuntu*. 45 | 46 | $ `sudo dpkg -i php5-mecab_x.y.z-1_{amd64,i386}.deb` 47 | -------------------------------------------------------------------------------- /packages/ubuntu/debian-control.diff: -------------------------------------------------------------------------------- 1 | --- debian/control.orig 2 | +++ debian/control 3 | @@ -2,12 +2,12 @@ 4 | Section: web 5 | Priority: optional 6 | Maintainer: Ryusuke SEKIYAMA 7 | -Build-Depends: debhelper (>= 7), po-debconf, xsltproc , php5-dev 8 | +Build-Depends: debhelper (>= 7), po-debconf, xsltproc , php5-dev, mecab, libmecab-dev 9 | Standards-Version: 3.9.1 10 | 11 | Package: php5-mecab 12 | Architecture: any 13 | -Depends: ${shlibs:Depends}, ${php:Depends}, ${misc:Depends} 14 | +Depends: ${shlibs:Depends}, ${php:Depends}, ${misc:Depends}, libmecab1 15 | Description: mecab module for PHP 5 16 | The PHP bindings of the MeCab. 17 | . 18 | --------------------------------------------------------------------------------