00001 /*00002 * The Software License00003 * =================================================================================00004 * Copyright (c) 2003-.The Terimber Corporation. All rights reserved.00005 * =================================================================================00006 * Redistributions of source code must retain the above copyright notice, 00007 * this list of conditions and the following disclaimer.00008 * Redistributions in binary form must reproduce the above copyright notice, 00009 * this list of conditions and the following disclaimer in the documentation 00010 * and/or other materials provided with the distribution.00011 * The end-user documentation included with the redistribution, if any, 00012 * must include the following acknowledgment:00013 * "This product includes software developed by the Terimber Corporation."00014 * =================================================================================00015 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, 00016 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00017 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00018 * IN NO EVENT SHALL THE TERIMBER CORPORATION OR ITS CONTRIBUTORS BE LIABLE FOR 00019 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00020 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00021 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00022 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT00023 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE00024 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.00025 * ================================================================================00026 */00027
00028 #ifndef _terimber_fuzzywrapper_h_00029 #define _terimber_fuzzywrapper_h_00030
00033enumngram_quality00034 {
00035nq_high = 0,
00036nq_normal,
00037nq_low00038 };
00039
00042enumphonetic_quality00043 {
00044pq_high = 0,
00045pq_normal,
00046pq_low00047 };
00048
00052class linked_result00053 {
00054 public:
00056linked_result() :
00057 _next(0),
00058 _str(0)
00059 {
00060 }
00061
00063~linked_result()
00064 {
00065 if (_next)
00066 delete_next;
00067
00068 if (_str)
00069 delete [] _str;
00070 }
00071
00072 public:
00073
00074linked_result* _next;
00075char* _str;
00076 };
00077
00083class fuzzy_wrapper00084 {
00085 public:
00087 virtual00088~fuzzy_wrapper()
00089 {
00090 }
00091
00092 // methods00093
00097 virtual00098 bool00099 add( constchar* phrase
00100 ) = 0;
00101
00104 virtual00105 bool00106 remove( constchar* phrase
00107 ) = 0;
00108
00110 virtual00111 bool00112 match( ngram_quality nq,
00113 phonetic_quality fq,
00114 constchar* phrase,
00115 linked_result& suggestions
00116 ) const = 0;
00117
00118 };
00119
00122class fuzzy_wrapper_factory00123 {
00124 public:
00125 fuzzy_wrapper*
00126 get_fuzzy_wrapper(size_t memory_usage
00127 );
00128 };
00129
00130 #endif //_terimber_fuzzywrapper_h_