Fixed mods to 644 again
[svmtool++.git] / include / weight.h
blob16e244fa422c4f358bab4947e7d8bee944c4886a
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 weight_node_t(std::string _pos) : pos(_pos), data(0) {}
28 std::string pos;
29 long double data;
32 class weight_struct_t;
34 class weightRepository
36 private:
37 hash_t<weight_struct_t*> wr;
39 std::string wrGetMergeInput(hash_t<weight_node_t*> *tptr, float filter); //ADD 180705
40 //char *wrGetMergeInput(hash_t *tptr); //DEL 180705
41 FILE *openFile(const std::string& name, char mode[]);
42 void wrReadMergeModel(FILE *in,float filter);
43 char wrSaltarBlancs(FILE *in,char c,int jmp);
44 void wrAddPOS(unsigned long obj, const std::string& pos, long double weight);
45 public:
46 long double wrGetWeight(const std::string& feature,const std::string& pos);
47 void wrAdd(const std::string& feature, const std::string& pos, long double weight);
48 //void wrWrite(char *outName); //DEL 180705
49 void wrWrite(const std::string& outName, float filter); //ADD 180705
50 void wrWriteHash(hash_t<weight_node_t*> *tptr,FILE *f,char separador);
51 weightRepository(const std::string& fileName,float filter);
52 weightRepository();
53 ~weightRepository();
56 #endif