Fixed mods to 644 again
[svmtool++.git] / include / swindow.h
blob3bd919e584a3a1b42c6021a6d374904df49a8e88
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 SWINDOW_H
20 #define SWINDOW_H
22 #include "common.h"
23 #include "dict.h"
24 #include "reader.h"
25 #include <iostream>
26 #include <stack>
27 #include <iosfwd>
29 #define CHAR_NULL '~'
30 #define EMPTY_WORD "_"
31 #define EMPTY_POS "??"
32 #define EMPTY ""
33 #define LEFT_TO_RIGHT 1
34 #define RIGHT_TO_LEFT 2
35 #define PUT_MAX 0
36 #define RESET_VALUES 1
37 #define PUT_OLD 2
39 #define COUNTING_FROM_END 111
40 #define COUNTING_FROM_BEGIN 222
43 struct weight_node_t;
44 struct nodo;
46 class swindow
48 public:
49 std::ostream* m_output;
50 reader m_reader;
52 //List Control
53 nodo *first;
54 nodo *last;
55 int numObj;
57 //Window Control
58 nodo *index,*beginWin,*endWin;
59 int lengthWin,posIndex,posBegin,posEnd;
61 //User window: this allows users to specify their own windows
62 std::vector<nodo*> user_window;
64 void init(dictionary* dic /*= 0*/);
65 int iniList(dictionary* dic /*= 0*/);
67 int readSentence(dictionary* dic /*= 0*/);
68 int readInput(dictionary* dic);
69 void winAdd(nodo * node);
71 int winLookRegExp2(void *er,const std::string& str);
72 void winCompRegExp();
73 void winFreeRegExp();
75 public:
76 int winLookRegExp(const std::string& m);
77 int winMaterializePOSValues(int action);
79 ~swindow();
80 swindow(std::istream& input, std::ostream* output, dictionary* dic /*= 0*/);
81 swindow(std::istream& input,int number, int position, std::ostream* output, dictionary* dic /*= 0*/);
82 swindow(std::istream& input,int number, std::ostream* output, dictionary* dic /*= 0*/);
83 swindow(int lengthWin, dictionary *dic);
84 bool next();
85 bool previous();
86 nodo *getIndex();
87 nodo *get(int position,int direction);
88 nodo *get_user(int position);
90 nodo *get_intern(int position);
91 int show(int showScoresFlag, int showComments);
93 void putLengthWin(int l);
94 void putIndex(int i);
96 int sentenceLength();
98 void setWindow(const std::vector<nodo*>&);
100 int winExistUnkWord(int direction, dictionary *d);
102 void winPushWordFeature(void* ptr, dictionary* d, stack< string >& pila, int direction);
103 void winPushPosFeature(void *ptr,dictionary *d, std::stack<std::string>& pila,int direction);
104 void winPushAmbiguityFeature(void *ptr,dictionary *d, std::stack<std::string>& pila,int direction);
105 void winPushMFTFeature(void *ptr,dictionary *d, std::stack<std::string>& pila,int direction);
106 void winPushMaybeFeature(void *ptr,dictionary *d, std::stack<std::string>& pila,int direction);
107 void winPushSwnFeature(std::stack<std::string>& pila);
109 void winPushSuffixFeature(const std::string& wrd, std::stack<std::string>& pila,int longitud);
110 void winPushPrefixFeature(const std::string& wrd, std::stack<std::string>& pila,int longitud);
111 //void winPushStartCapFeature(const std::string& wrd, struct std::stack *pila);
112 void winPushAllUpFeature(const std::string& wrd, std::stack<std::string>& pila);
113 void winPushAllLowFeature(const std::string& wrd, std::stack<std::string>& pila);
114 void winPushContainCapFeature(const std::string& wrd, std::stack<std::string>& pila);
115 void winPushContainCapsFeature(const std::string& wrd, std::stack<std::string>& pila);
116 void winPushContainPeriodFeature(const std::string& wrd, std::stack<std::string>& pila);
117 void winPushContainCommaFeature(const std::string& wrd, std::stack<std::string>& pila);
118 void winPushContainNumFeature(const std::string& wrd, std::stack<std::string>& pila);
119 void winPushMultiwordFeature(const std::string& wrd, std::stack<std::string>& pila);
120 void winPushLetterFeature(const std::string& wrd, std::stack<std::string>& pila, int where, int position );
121 void winPushLenghtFeature(const std::string& wrd, std::stack<std::string>& pila);
122 void winPushStartWithCapFeature(const std::string& wrd, std::stack<std::string>& pila );
123 void winPushStartWithLowerFeature(const std::string& wrd, std::stack<std::string>& pila );
124 void winPushStartWithNumberFeature(const std::string& wrd, std::stack<std::string>& pila );
125 int iniGeneric(dictionary* dic /*= 0*/);
126 void deleteList();
130 #endif