OSDN Git Service

updated libopenjtalk using python-jtalk
[nvdajp/nvdajpmiscdep.git] / include / jtalk / libopenjtalk / text2mecab / text2mecab.c
diff --git a/include/jtalk/libopenjtalk/text2mecab/text2mecab.c b/include/jtalk/libopenjtalk/text2mecab/text2mecab.c
deleted file mode 100644 (file)
index 9e27093..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/* ----------------------------------------------------------------- */\r
-/*           The Japanese TTS System "Open JTalk"                    */\r
-/*           developed by HTS Working Group                          */\r
-/*           http://open-jtalk.sourceforge.net/                      */\r
-/* ----------------------------------------------------------------- */\r
-/*                                                                   */\r
-/*  Copyright (c) 2008-2011  Nagoya Institute of Technology          */\r
-/*                           Department of Computer Science          */\r
-/*                                                                   */\r
-/* All rights reserved.                                              */\r
-/*                                                                   */\r
-/* Redistribution and use in source and binary forms, with or        */\r
-/* without modification, are permitted provided that the following   */\r
-/* conditions are met:                                               */\r
-/*                                                                   */\r
-/* - Redistributions of source code must retain the above copyright  */\r
-/*   notice, this list of conditions and the following disclaimer.   */\r
-/* - Redistributions in binary form must reproduce the above         */\r
-/*   copyright notice, this list of conditions and the following     */\r
-/*   disclaimer in the documentation and/or other materials provided */\r
-/*   with the distribution.                                          */\r
-/* - Neither the name of the HTS working group nor the names of its  */\r
-/*   contributors may be used to endorse or promote products derived */\r
-/*   from this software without specific prior written permission.   */\r
-/*                                                                   */\r
-/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND            */\r
-/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,       */\r
-/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF          */\r
-/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE          */\r
-/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */\r
-/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          */\r
-/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED   */\r
-/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     */\r
-/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */\r
-/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,   */\r
-/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY    */\r
-/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE           */\r
-/* POSSIBILITY OF SUCH DAMAGE.                                       */\r
-/* ----------------------------------------------------------------- */\r
-\r
-#ifndef TEXT2MECAB_C\r
-#define TEXT2MECAB_C\r
-\r
-#ifdef __cplusplus\r
-#define TEXT2MECAB_C_START extern "C" {\r
-#define TEXT2MECAB_C_END   }\r
-#else\r
-#define TEXT2MECAB_C_START\r
-#define TEXT2MECAB_C_END\r
-#endif                          /* __CPLUSPLUS */\r
-\r
-TEXT2MECAB_C_START;\r
-\r
-#include <stdio.h>\r
-#include <string.h>\r
-\r
-#include "text2mecab.h"\r
-\r
-#if defined(CHARSET_EUC_JP)\r
-#include "text2mecab_rule_euc_jp.h"\r
-#elif defined(CHARSET_SHIFT_JIS)\r
-#include "text2mecab_rule_shift_jis.h"\r
-#elif defined(CHARSET_UTF_8)\r
-#include "text2mecab_rule_utf_8.h"\r
-#else\r
-#error CHARSET is not specified\r
-#endif\r
-\r
-static int strtopcmp(const char *str, const char *pattern)\r
-{\r
-   int i;\r
-\r
-   for (i = 0;; i++) {\r
-      if (pattern[i] == '\0')\r
-         return i;\r
-      if (str[i] == '\0')\r
-         return -1;\r
-      if (str[i] != pattern[i])\r
-         return -1;\r
-   }\r
-}\r
-\r
-void text2mecab(char *output, const char *input)\r
-{\r
-   int i, j;\r
-   const int length = strlen(input);\r
-   const char *str;\r
-   int index = 0;\r
-   int s, e = -1;\r
-\r
-   for (s = 0; s < length;) {\r
-      str = &input[s];\r
-      /* search */\r
-      for (i = 0; text2mecab_conv_list[i] != NULL; i += 2) {\r
-         e = strtopcmp(str, text2mecab_conv_list[i]);\r
-         if (e != -1)\r
-            break;\r
-      }\r
-      if (e != -1) {\r
-         /* convert */\r
-         s += e;\r
-         str = text2mecab_conv_list[i + 1];\r
-         for (j = 0; str[j] != '\0'; j++)\r
-            output[index++] = str[j];\r
-      } else if (text2mecab_control_range[0] <= str[0] && str[0] <= text2mecab_control_range[1]) {\r
-         /* control character */\r
-         s++;\r
-      } else {\r
-         /* multi byte character */\r
-         e = -1;\r
-         for (j = 0; text2mecab_kanji_range[j] > 0; j += 3) {\r
-            if (text2mecab_kanji_range[j + 1] <= str[0] && text2mecab_kanji_range[j + 2] >= str[0]) {\r
-               e = text2mecab_kanji_range[j];\r
-               break;\r
-            }\r
-         }\r
-         if (e > 0) {\r
-            for (j = 0; j < e; j++)\r
-               output[index++] = input[s++];\r
-         } else {\r
-            /* unknown */\r
-            fprintf(stderr, "WARNING: text2mecab() in text2mecab.c: Wrong character.\n");\r
-            s++;\r
-         }\r
-      }\r
-   }\r
-   output[index] = '\0';\r
-}\r
-\r
-TEXT2MECAB_C_END;\r
-\r
-#endif                          /* !TEXT2MECAB_C */\r