FreeLing
4.0
|
00001 00002 // 00003 // Omlet - Open Machine Learning Enhanced Toolkit 00004 // 00005 // Copyright (C) 2014 TALP Research Center 00006 // Universitat Politecnica de Catalunya 00007 // 00008 // This file is part of the Omlet library 00009 // 00010 // The Omlet library is free software; you can redistribute it 00011 // and/or modify it under the terms of the GNU Affero General Public 00012 // License as published by the Free Software Foundation; either 00013 // version 3 of the License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Affero General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Affero General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 51 Franklin St, 5th Floor, Boston, MA 02110-1301 USA 00023 // 00024 // contact: Lluis Padro (padro@lsi.upc.es) 00025 // TALP Research Center 00026 // despatx Omega.S112 - Campus Nord UPC 00027 // 08034 Barcelona. SPAIN 00028 // 00030 00031 #ifndef _SVM 00032 #define _SVM 00033 00034 #include <string> 00035 00036 #include "boost/thread/mutex.hpp" 00037 #include "freeling/omlet/example.h" 00038 #include "freeling/omlet/classifier.h" 00039 #include "freeling/omlet/libsvm.h" 00040 00041 namespace freeling { 00042 00046 00047 class svm : public classifier { 00048 private: 00049 svm_model *model; 00050 int *class_code; 00051 static boost::mutex svm_sem; 00052 00053 public: 00054 // constructor 00055 svm(const std::wstring &, const std::wstring &); 00056 // destructor 00057 ~svm(); 00058 00060 void classify(const example &, double[]) const; 00062 int get_nlabels() const; 00063 }; 00064 00065 } // namespace 00066 00067 #endif