From 362801eb6c5f9aac6f9956955a8a5840178818a4 Mon Sep 17 00:00:00 2001 From: Lukhnos Liu Date: Mon, 10 Sep 2012 23:26:40 -0700 Subject: [PATCH] Remove SimpleLM. --- McBopomofo.xcodeproj/project.pbxproj | 6 --- Source/Engine/FastLM.cpp | 2 +- Source/Engine/SimpleLM.cpp | 64 ---------------------------- Source/Engine/SimpleLM.h | 54 ----------------------- Source/InputMethodController.h | 1 - 5 files changed, 1 insertion(+), 126 deletions(-) delete mode 100644 Source/Engine/SimpleLM.cpp delete mode 100644 Source/Engine/SimpleLM.h diff --git a/McBopomofo.xcodeproj/project.pbxproj b/McBopomofo.xcodeproj/project.pbxproj index 1d270bb7..9e052130 100644 --- a/McBopomofo.xcodeproj/project.pbxproj +++ b/McBopomofo.xcodeproj/project.pbxproj @@ -24,7 +24,6 @@ 6A0D4F0815FC0DA600ABF4B3 /* Bopomofo.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4EEF15FC0DA600ABF4B3 /* Bopomofo.tiff */; }; 6A0D4F0915FC0DA600ABF4B3 /* Bopomofo@2x.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4EF015FC0DA600ABF4B3 /* Bopomofo@2x.tiff */; }; 6A0D4F4515FC0EB100ABF4B3 /* Mandarin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4F2015FC0EB100ABF4B3 /* Mandarin.cpp */; }; - 6A0D4F4615FC0EB100ABF4B3 /* SimpleLM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D4F4315FC0EB100ABF4B3 /* SimpleLM.cpp */; }; 6A0D4F5215FC0EE100ABF4B3 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4F4C15FC0EE100ABF4B3 /* MainMenu.xib */; }; 6A0D4F5315FC0EE100ABF4B3 /* preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4F4E15FC0EE100ABF4B3 /* preferences.xib */; }; 6A0D4F5715FC0EF900ABF4B3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D4F4815FC0EE100ABF4B3 /* InfoPlist.strings */; }; @@ -147,8 +146,6 @@ 6A0D4F4015FC0EB100ABF4B3 /* OVTextBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVTextBuffer.h; sourceTree = ""; }; 6A0D4F4115FC0EB100ABF4B3 /* OVUTF8Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVUTF8Helper.h; sourceTree = ""; }; 6A0D4F4215FC0EB100ABF4B3 /* OVWildcard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVWildcard.h; sourceTree = ""; }; - 6A0D4F4315FC0EB100ABF4B3 /* SimpleLM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLM.cpp; sourceTree = ""; }; - 6A0D4F4415FC0EB100ABF4B3 /* SimpleLM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLM.h; sourceTree = ""; }; 6A0D4F4915FC0EE100ABF4B3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Source/en.lproj/InfoPlist.strings; sourceTree = ""; }; 6A0D4F4B15FC0EE100ABF4B3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Source/en.lproj/Localizable.strings; sourceTree = ""; }; 6A0D4F4D15FC0EE100ABF4B3 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = Source/en.lproj/MainMenu.xib; sourceTree = ""; }; @@ -331,8 +328,6 @@ 6A0D4F1315FC0EB100ABF4B3 /* Gramambular */, 6A0D4F1F15FC0EB100ABF4B3 /* Mandarin */, 6A0D4F2215FC0EB100ABF4B3 /* OpenVanilla */, - 6A0D4F4315FC0EB100ABF4B3 /* SimpleLM.cpp */, - 6A0D4F4415FC0EB100ABF4B3 /* SimpleLM.h */, 6A0421A615FEF3F50061ED63 /* FastLM.cpp */, 6A0421A715FEF3F50061ED63 /* FastLM.h */, ); @@ -643,7 +638,6 @@ 6A0D4F0215FC0DA600ABF4B3 /* VTVerticalCandidateTableView.m in Sources */, 6A0D4F0315FC0DA600ABF4B3 /* VTVerticalKeyLabelStripView.m in Sources */, 6A0D4F4515FC0EB100ABF4B3 /* Mandarin.cpp in Sources */, - 6A0D4F4615FC0EB100ABF4B3 /* SimpleLM.cpp in Sources */, 6A0421A815FEF3F50061ED63 /* FastLM.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Source/Engine/FastLM.cpp b/Source/Engine/FastLM.cpp index f1339218..e8791e89 100644 --- a/Source/Engine/FastLM.cpp +++ b/Source/Engine/FastLM.cpp @@ -71,7 +71,7 @@ bool FastLM::open(const char *path) return false; } - // we have 5 states + // we have 4 states, plus end and error // 0 // end -> end // lf -> forward, go to 0 diff --git a/Source/Engine/SimpleLM.cpp b/Source/Engine/SimpleLM.cpp deleted file mode 100644 index 3dc99029..00000000 --- a/Source/Engine/SimpleLM.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -// SimpleLM.cpp -// -// Copyright (c) 2011 Lukhnos D. Liu (http://lukhnos.org) -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -#include "SimpleLM.h" - -namespace Formosa { -namespace Gramambular { - -SimpleLM::SimpleLM() -{ -} - -void SimpleLM::add(const string &key, const string &value, double score) -{ - Unigram u; - u.keyValue.key = key; - u.keyValue.value = value; - u.score = score; - m_db[key].push_back(u); -} - -const vector SimpleLM::bigramsForKeys(const string &preceedingKey, const string& key) -{ - return vector(); -} - -const vector SimpleLM::unigramsForKeys(const string &key) -{ - map >::const_iterator f = m_db.find(key); - return f == m_db.end() ? vector() : (*f).second; -} - -bool SimpleLM::hasUnigramsForKey(const string& key) -{ - map >::const_iterator f = m_db.find(key); - return f != m_db.end(); -} - -} -} diff --git a/Source/Engine/SimpleLM.h b/Source/Engine/SimpleLM.h deleted file mode 100644 index fd78401e..00000000 --- a/Source/Engine/SimpleLM.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// SimpleLM.h -// -// Copyright (c) 2011 Lukhnos D. Liu (http://lukhnos.org) -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -#ifndef SIMPLELM_H -#define SIMPLELM_H - -#include -#include -#include -#include "LanguageModel.h" - -namespace Formosa { - namespace Gramambular { - class SimpleLM : public LanguageModel - { - public: - SimpleLM(); - void add(const string &key, const string &value, double score); - virtual const vector bigramsForKeys(const string &preceedingKey, const string& key); - virtual const vector unigramsForKeys(const string &key); - virtual bool hasUnigramsForKey(const string& key); - - protected: - map > m_db; - }; - - } -} - -#endif diff --git a/Source/InputMethodController.h b/Source/InputMethodController.h index e73dcac5..00aca989 100644 --- a/Source/InputMethodController.h +++ b/Source/InputMethodController.h @@ -36,7 +36,6 @@ #import #import "Mandarin.h" #import "Gramambular.h" -#import "SimpleLM.h" #import "FastLM.h" @interface McBopomofoInputMethodController : IMKInputController