Skip to content

Commit

Permalink
Make sure to put the right things in the alphabet of the binary FST. …
Browse files Browse the repository at this point in the history
…Fixes bug introduced in 6c2486a
  • Loading branch information
mr-martian authored and TinoDidriksen committed May 31, 2022
1 parent fd9f0fe commit 78c1ed5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ(2.52)

m4_define([PKG_VERSION_MAJOR], [3])
m4_define([PKG_VERSION_MINOR], [6])
m4_define([PKG_VERSION_PATCH], [5])
m4_define([PKG_VERSION_PATCH], [6])

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

Expand Down
2 changes: 1 addition & 1 deletion lttoolbox/att_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ AttCompiler::is_word_punct(UChar32 symbol)
void
AttCompiler::update_alphabet(UChar32 c)
{
if (is_word_punct(c) || !(u_ispunct(c) && u_isspace(c))) {
if (is_word_punct(c) || !(u_ispunct(c) || u_isspace(c))) {
letters.insert(c);
if(u_islower(c)) {
letters.insert(u_toupper(c));
Expand Down
9 changes: 9 additions & 0 deletions tests/data/alphabet.att
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
0 1 a a
1 2 b b
2 3 c c
0 3 . .
4 3 <h> <h>
0 4 c c
4 3 @_SPACE_@ @_SPACE_@
0 3 ? ?
3
14 changes: 14 additions & 0 deletions tests/lt_print/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,17 @@ class SectionsFst(unittest.TestCase, PrintTest):
1\t2\tε\t<np>\t0.000000\t
2\t0.000000
"""


class Alphabet(unittest.TestCase, PrintTest):
printdix = "data/alphabet.att"
printdir = "lr"
printflags = ["-a"]
expectedOutput = """A
B
C
a
b
c
<h>
"""
3 changes: 2 additions & 1 deletion tests/printtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class PrintTest(BasicTest):
printdir = "lr"
expectedOutput = ""
expectedRetCodeFail = False
printflags = []

def compileTest(self, tmpd):
self.assertEqual(0, call([os.environ['LTTOOLBOX_PATH']+"/lt-comp",
Expand All @@ -27,7 +28,7 @@ def runTest(self):
tmpd = mkdtemp()
try:
self.compileTest(tmpd)
self.printresult = Popen([os.environ['LTTOOLBOX_PATH']+"/lt-print"] + [tmpd+"/compiled.bin"],
self.printresult = Popen([os.environ['LTTOOLBOX_PATH']+"/lt-print"] + self.printflags + [tmpd+"/compiled.bin"],
stdout=PIPE,
stderr=PIPE)

Expand Down

0 comments on commit 78c1ed5

Please sign in to comment.