2 * Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 #ifndef _TRANSFER_MULT_
20 #define _TRANSFER_MULT_
22 #include <apertium/TransferInstr.H>
23 #include <apertium/TransferToken.H>
24 #include <apertium/TransferWord.H>
25 #include <lttoolbox/Alphabet.H>
26 #include <lttoolbox/Buffer.H>
27 #include <lttoolbox/FSTProcessor.H>
28 #include <lttoolbox/MatchExe.H>
29 #include <lttoolbox/MatchState.H>
45 map<string, string> attr_items;
46 map<string, string> variables;
47 map<string, int> macros;
48 map<string, set<string> > lists;
49 map<string, set<string> > listslow;
52 Buffer<TransferToken> input_buffer;
53 vector<string *> tmpword;
54 vector<string *> tmpblank;
62 unsigned int numwords;
66 enum OutputType{lu,chunk};
68 OutputType defaultAttrs;
70 void copy(TransferMult const &o);
72 void readData(FILE *input);
73 void readBil(string const &filename);
74 string caseOf(string const &str);
75 string copycase(string const &source_word, string const &target_word);
77 bool beginsWith(string const &str1, string const &str2) const;
78 bool endsWith(string const &str1, string const &str2) const;
79 string tolower(string const &str) const;
80 string tags(string const &str) const;
81 string readWord(FILE *in);
82 string readBlank(FILE *in);
83 string readUntil(FILE *in, int const symbol) const;
84 void applyWord(string const &word_str);
86 TransferToken & readToken(FILE *in);
87 void writeMultiple(list<vector<string> >::iterator itwords,
88 list<string>::iterator itblanks,
89 list<vector<string> >::const_iterator limitwords,
90 string acum = "", bool multiple = false);
91 vector<string> acceptions(string const &str);
92 bool isDefaultWord(string const &str);
96 TransferMult(TransferMult const &o);
97 TransferMult & operator =(TransferMult const &o);
99 void read(string const &datafile, string const &fstfile);
100 void transfer(FILE *in, FILE *out);