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
22 #include <lttoolbox/alphabet.h>
23 #include <lttoolbox/match_exe.h>
24 #include <lttoolbox/transducer.h>
33 typedef multimap
<int, vector
<int> > PatternStore
;
34 typedef pair
<PatternStore::iterator
, PatternStore::iterator
> PatternRange
;
40 PatternStore patterns
;
42 list
<vector
<int> > sequence_data
;
43 Transducer transducer
;
44 map
<int, int> final_type
;
47 void copy(PatternList
const &o
);
49 void insertOutOfSequence(wstring
const &lemma
, wstring
const &tags
,
51 void insertIntoSequence(int const id
, wstring
const &lemma
,
54 static int tagCount(wstring
const &tags
);
55 static wstring
tagAt(wstring
const &tags
, int const index
);
59 * This symbol stands for any char
61 static wstring
const ANY_CHAR
;
64 * This symbol stands for any tag
66 static wstring
const ANY_TAG
;
69 * This symbol marks a word queue
71 static wstring
const QUEUE
;
86 PatternList(PatternList
const &o
);
90 * @param o the object to be assigned
92 PatternList
& operator =(PatternList
const &o
);
95 * Marks the start of a multiple word sequence
100 * Ends the multiple word sequence
110 void insert(int const id
, wstring
const &lemma
, wstring
const &tags
);
117 void insert(int const id
, int const otherid
);
120 * Get the PatternStore
121 * @returns a PatternStore object
123 PatternStore
const & getPatterns();
128 void buildTransducer();
131 * Read PatternList from a file
132 * @param input the input stream
134 void read(FILE *input
);
137 * Write PatternList to a file
138 * @param output the output stream
140 void write(FILE *output
);
143 * Create a new MatchExe from PatternList, must be freed with 'delete'
144 * @return the new MatchExe object
146 MatchExe
* newMatchExe();
149 * Get the alphabet of this PatternList object
150 * @return the alphabet
152 Alphabet
& getAlphabet();