sequitur.patch
3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
--- g2p/Utility.cc 2013-04-22 17:59:44.507473917 -0400
+++ Utility.cc 2013-04-22 17:56:57.862944655 -0400
@@ -31,6 +31,7 @@
#include <iomanip>
#include <iostream>
#include <string>
+#include <cstdio>
using namespace Core;
--- g2p/setup.py 2011-08-03 09:38:38.000000000 -0400
+++ setup.py 2013-04-22 18:50:58.158946383 -0400
@@ -33,7 +33,7 @@
'_sequitur_',
language = 'c++',
define_macros=[
- ('MULTIGRAM_SIZE', '2')],
+ ('MULTIGRAM_SIZE', '5')],
sources = [
'sequitur.i',
'Assertions.cc',
--- g2p/PriorityQueue.hh 2011-08-03 09:38:18.000000000 -0400
+++ PriorityQueue.hh 2014-01-23 12:10:24.209785867 -0500
@@ -65,7 +65,7 @@
/** Remove top-most item */
void pop() {
require(!Precursor::empty());
- move(1, Precursor::size());
+ this->move(1, Precursor::size());
Precursor::deleteLast();
if (Precursor::size() > 0) downHeap(1);
verify_(invariant());
@@ -83,7 +83,7 @@
/** Insert new item */
void insert(const Item &e) {
- append(e);
+ this->append(e);
upHeap(Precursor::size()) ;
verify_(invariant());
//if (size() > maxSize_) deleteLast();
@@ -94,33 +94,33 @@
void PriorityQueueBase<H, PF>::downHeap(Index i) {
require(1 <= i && i <= Precursor::size());
Index j;
- Item e = item(i);
+ Item e = this->item(i);
while (i <= Precursor::size() / 2) {
j = 2 * i;
- if (j < Precursor::size() && precedes_(item(j+1), item(j))) j = j + 1;
- if (!precedes_(item(j), e)) break;
- move(i, j);
+ if (j < Precursor::size() && precedes_(this->item(j+1), this->item(j))) j = j + 1;
+ if (!precedes_(this->item(j), e)) break;
+ this->move(i, j);
i = j;
}
- put(i, e);
+ this->put(i, e);
}
template <class H, class PF>
void PriorityQueueBase<H, PF>::upHeap(Index i) {
require(1 <= i && i <= Precursor::size());
- Item e = item(i);
- while (i > 1 && !precedes_(item(i/2), e)) {
- move(i, i/2);
+ Item e = this->item(i);
+ while (i > 1 && !precedes_(this->item(i/2), e)) {
+ this->move(i, i/2);
i /= 2;
}
- put(i, e);
+ this->put(i, e);
}
template <class H, class PF>
bool PriorityQueueBase<H, PF>::invariant() const {
if (!Precursor::invariant()) return false;
for (Index i = 2 ; i < Precursor::size() ; ++i)
- if (precedes_(item(i), item(i/2)))
+ if (precedes_(this->item(i), this->item(i/2)))
return false;
return true;
}
@@ -242,9 +242,9 @@
Precursor(precedes, maxSize) {}
void insert(const typename Precursor::Item &e) {
- require(!contains(key_(e)));
+ require(!this->contains(this->key_(e)));
Precursor::insert(e) ;
- ensure(contains(key_(e))) ;
+ ensure(this->contains(this->key_(e))) ;
}
void changeTop(const typename Precursor::Item &e) {
@@ -289,11 +289,11 @@
* given item dropped, and the stack is unchanged.
*/
bool insertOrRelax(const typename Precursor::Item &e) {
- if (contains(key_(e))) {
- typename Precursor::Index i = Precursor::map_[key_(e)] ;
- if (precedes_(e, Precursor::heap_[i])) {
+ if (this->contains(this->key_(e))) {
+ typename Precursor::Index i = Precursor::map_[this->key_(e)] ;
+ if (this->precedes_(e, Precursor::heap_[i])) {
Precursor::heap_[i] = e;
- upHeap(i);
+ this->upHeap(i);
verify_(invariant());
} else return false;
} else insert(e);