Added models and dicts
[svmtool++.git] / lib / swindow.h
blob6eebbc229306c201cfe83aaff43c7a780c85403a
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
21 #include "common.h"
23 #define CHAR_NULL '~'
24 #define EMPTY_WORD "_"
25 #define EMPTY_POS "??"
26 #define EMPTY ""
27 #define LEFT_TO_RIGHT 1
28 #define RIGHT_TO_LEFT 2
29 #define PUT_MAX 0
30 #define RESET_VALUES 1
31 #define PUT_OLD 2
33 #define COUNTING_FROM_END 111
34 #define COUNTING_FROM_BEGIN 222
36 struct nodo{
37 int ord;
38 char wrd[TAM_WORD];
39 char realWrd[TAM_WORD];
40 char comment[TAM_LINE];
41 char pos[TAM_POS],posOld[TAM_POS];
42 long double weight,weightOld;
43 struct stack_t *stackScores;
44 nodo *next;
45 nodo *previous;
48 class swindow
50 private:
51 FILE *input;
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 void init();
62 int iniList();
64 int readSentence();
65 int readInput();
66 int readInput_old();
67 int winAdd(char *wrd, char *pos);
69 int winLookRegExp2(void *er,char *str);
70 void winCompRegExp();
71 void winFreeRegExp();
73 public:
74 int winLookRegExp(char *m);
75 int winMaterializePOSValues(int action);
77 ~swindow();
78 swindow(FILE *input);
79 swindow(FILE *input,int number, int position);
80 swindow(FILE *input,int number);
81 int next();
82 int previous();
83 nodo *getIndex();
84 nodo *get(int position,int direction);
85 int show();
87 void putLengthWin(int l);
88 void putIndex(int i);
90 int sentenceLength();
92 int winExistUnkWord(int direction, dictionary *d);
94 void winPushWordFeature(void *ptr,dictionary *d, struct stack_t *pila,int direction);
95 void winPushPosFeature(void *ptr,dictionary *d, struct stack_t *pila,int direction);
96 void winPushAmbiguityFeature(void *ptr,dictionary *d, struct stack_t *pila,int direction);
97 void winPushMFTFeature(void *ptr,dictionary *d, struct stack_t *pila,int direction);
98 void winPushMaybeFeature(void *ptr,dictionary *d, struct stack_t *pila,int direction);
99 void winPushSwnFeature(struct stack_t *pila);
100 void winPushUnknownFeatures(char *str, struct stack_t *pila);
102 void winPushSuffixFeature(char *wrd, struct stack_t *pila,int longitud);
103 void winPushPrefixFeature(char *wrd, struct stack_t *pila,int longitud);
104 //void winPushStartCapFeature(char *wrd, struct stack_t *pila);
105 void winPushAllUpFeature(char *wrd,stack_t *pila);
106 void winPushAllLowFeature(char *wrd,stack_t *pila);
107 void winPushContainCapFeature(char *wrd, stack_t *pila);
108 void winPushContainCapsFeature(char *wrd, stack_t *pila);
109 void winPushContainPeriodFeature(char *wrd, stack_t *pila);
110 void winPushContainCommaFeature(char *wrd, stack_t *pila);
111 void winPushContainNumFeature(char *wrd, stack_t *pila);
112 void winPushMultiwordFeature(char *wrd, stack_t *pila);
113 void winPushLetterFeature(char *, stack_t *, int, int );
114 void winPushLenghtFeature(char *wrd, stack_t *pila);
115 void winPushStartWithCapFeature(char *,stack_t *);
116 void winPushStartWithLowerFeature(char *,stack_t *);
117 void winPushStartWithNumberFeature(char *,stack_t *);
118 int iniGeneric();
119 void deleteList();
123 #define SWINDOW_W
124 #endif