Update of /cvsroot/fasttran/fasttran/fasttran
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv31003
Modified Files:
gui.py
Log Message:
ignore text segments containing no printable characters
Index: gui.py
===================================================================
RCS file: /cvsroot/fasttran/fasttran/fasttran/gui.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** gui.py 28 Feb 2007 10:17:17 -0000 1.3
--- gui.py 12 Apr 2007 10:08:57 -0000 1.4
***************
*** 1,4 ****
--- 1,5 ----
"""fasttran Graphic User Interface"""
"""History (most recent first):
+ 12-apr-2007 [als] ignore text segments containing no printable characters
28-feb-2007 [als] change LanguageID in translated document;
typo in .Translate: invalid highlight for scores < 40
***************
*** 29,32 ****
--- 30,38 ----
faceName="Verdana")
+ # Non-printable characters.
+ # Text segments consisting entirely of these characters
+ # will be ignored in TM training and text translation.
+ BLANKS = "".join(chr(_ii) for _ii in xrange(33)) # \x00 to space
+
class ExitButton(wx.Button):
***************
*** 298,302 ****
_range = _paragraphs(_ii).Range
for _phrase in _seg.get_segments(_range.Text):
! if not _phrase.strip():
# the segment is empty - skip
_range.Start += len(_phrase)
--- 304,308 ----
_range = _paragraphs(_ii).Range
for _phrase in _seg.get_segments(_range.Text):
! if not _phrase.strip(BLANKS):
# the segment is empty - skip
_range.Start += len(_phrase)
***************
*** 483,489 ****
_rv = []
for _ii in xrange(1, _paragraphs.Count + 1):
! _text = _paragraphs.Item(_ii).Range.Text.strip()
if _text:
! _rv.append(filter(None, [_phrase.strip()
for _phrase in _seg.get_segments(_text)]))
self.gauge.SetValue(_ii * _gauge_step + _gauge_start)
--- 489,495 ----
_rv = []
for _ii in xrange(1, _paragraphs.Count + 1):
! _text = _paragraphs.Item(_ii).Range.Text.strip(BLANKS)
if _text:
! _rv.append(filter(None, [_phrase.strip(BLANKS)
for _phrase in _seg.get_segments(_text)]))
self.gauge.SetValue(_ii * _gauge_step + _gauge_start)
|