Updated source code from upstream SVN
[svmtool++.git] / include / weight.h
blob2d9fb85beae1003814d23d02f9f67a43da0e272e
1 /*
2 * Copyright (C) 2004 Jesus Gimenez, Lluis Marquez and Senen Moya
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef WEIGHT_H
20 #define WEIGHT_H
22 #include "hash.h"
24 struct weight_node_t
26 weight_node_t() : pos(), data(0) {}
27 std::string pos;
28 long double data;
31 class weight_struct_t;
33 class weightRepository
35 private:
36 hash_t<weight_struct_t*> wr;
38 std::string wrGetMergeInput(hash_t<weight_node_t*> *tptr, float filter); //ADD 180705
39 //char *wrGetMergeInput(hash_t *tptr); //DEL 180705
40 FILE *openFile(const std::string& name, char mode[]);
41 void wrReadMergeModel(FILE *in,float filter);
42 char wrSaltarBlancs(FILE *in,char c,int jmp);
43 void wrAddPOS(unsigned long obj, const std::string& pos, long double weight);
44 public:
45 long double wrGetWeight(const std::string& feature,const std::string& pos);
46 void wrAdd(const std::string& feature, const std::string& pos, long double weight);
47 //void wrWrite(char *outName); //DEL 180705
48 void wrWrite(const std::string& outName, float filter); //ADD 180705
49 void wrWriteHash(hash_t<weight_node_t*> *tptr,FILE *f,char separador);
50 weightRepository(const std::string& fileName,float filter);
51 weightRepository();
52 ~weightRepository();
55 #endif