Skip to content

Commit 78c1ed5

Browse files
mr-martianTinoDidriksen
authored andcommitted
Make sure to put the right things in the alphabet of the binary FST. Fixes bug introduced in 6c2486a
1 parent fd9f0fe commit 78c1ed5

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AC_PREREQ(2.52)
22

33
m4_define([PKG_VERSION_MAJOR], [3])
44
m4_define([PKG_VERSION_MINOR], [6])
5-
m4_define([PKG_VERSION_PATCH], [5])
5+
m4_define([PKG_VERSION_PATCH], [6])
66

77
AC_INIT([lttoolbox], [PKG_VERSION_MAJOR.PKG_VERSION_MINOR.PKG_VERSION_PATCH], [[email protected]], [lttoolbox], [https://wiki.apertium.org/wiki/Lttoolbox])
88

lttoolbox/att_compiler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ AttCompiler::is_word_punct(UChar32 symbol)
8888
void
8989
AttCompiler::update_alphabet(UChar32 c)
9090
{
91-
if (is_word_punct(c) || !(u_ispunct(c) && u_isspace(c))) {
91+
if (is_word_punct(c) || !(u_ispunct(c) || u_isspace(c))) {
9292
letters.insert(c);
9393
if(u_islower(c)) {
9494
letters.insert(u_toupper(c));

tests/data/alphabet.att

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
0 1 a a
2+
1 2 b b
3+
2 3 c c
4+
0 3 . .
5+
4 3 <h> <h>
6+
0 4 c c
7+
4 3 @_SPACE_@ @_SPACE_@
8+
0 3 ? ?
9+
3

tests/lt_print/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,17 @@ class SectionsFst(unittest.TestCase, PrintTest):
4040
1\t2\tε\t<np>\t0.000000\t
4141
2\t0.000000
4242
"""
43+
44+
45+
class Alphabet(unittest.TestCase, PrintTest):
46+
printdix = "data/alphabet.att"
47+
printdir = "lr"
48+
printflags = ["-a"]
49+
expectedOutput = """A
50+
B
51+
C
52+
a
53+
b
54+
c
55+
<h>
56+
"""

tests/printtest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class PrintTest(BasicTest):
1515
printdir = "lr"
1616
expectedOutput = ""
1717
expectedRetCodeFail = False
18+
printflags = []
1819

1920
def compileTest(self, tmpd):
2021
self.assertEqual(0, call([os.environ['LTTOOLBOX_PATH']+"/lt-comp",
@@ -27,7 +28,7 @@ def runTest(self):
2728
tmpd = mkdtemp()
2829
try:
2930
self.compileTest(tmpd)
30-
self.printresult = Popen([os.environ['LTTOOLBOX_PATH']+"/lt-print"] + [tmpd+"/compiled.bin"],
31+
self.printresult = Popen([os.environ['LTTOOLBOX_PATH']+"/lt-print"] + self.printflags + [tmpd+"/compiled.bin"],
3132
stdout=PIPE,
3233
stderr=PIPE)
3334

0 commit comments

Comments
 (0)