diff --git a/gradint-build/Makefile b/gradint-build/Makefile index aab66dc5cd4c9877abc2e360d01d0239e6b91274..b50f4348d5802dc3822f085f79c0c4c673a59e52 100644 --- a/gradint-build/Makefile +++ b/gradint-build/Makefile @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/booktime.py b/gradint-build/src/booktime.py index 5640a83893cdede511020aadc33d40aad86a8e68..c206d76d89bfac7eac3b3e5ba4ba47ad9cac26b1 100644 --- a/gradint-build/src/booktime.py +++ b/gradint-build/src/booktime.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/filescan.py b/gradint-build/src/filescan.py index 2d1af7811284fcd60dde84b7682522c6bc8444bb..815f52cec288e28a1f9389b9f44cf9649ff5d5ae 100644 --- a/gradint-build/src/filescan.py +++ b/gradint-build/src/filescan.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/frontend.py b/gradint-build/src/frontend.py index 4d873a00ca107ddf56596b3bd756b8fa559a76e2..7b8cd52318fbcd647018936c9dd5666e2f26fdae 100644 --- a/gradint-build/src/frontend.py +++ b/gradint-build/src/frontend.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -1108,9 +1108,12 @@ def sanityCheck(text,language,pauseOnError=0): # text is utf-8; returns error me if ret: waitOnMessage(ret) return ret if language=="zh": + allDigits = True for t in text: if ord(t)>127: return # got hanzi or tone marks if t in "12345": return # got tone numbers + if t not in "0123456789. ": allDigits = False + if allDigits: return return "Pinyin needs tones. Please go back and add tone numbers to "+text+"."+cond(startBrowser("http://www.pristine.com.tw/lexicon.php?query="+fix_pinyin(text,[]).replace("1","1 ").replace("2","2 ").replace("3","3 ").replace("4","4 ").replace("5"," ").replace(" "," ").strip(wsp).replace(" ","+"))," Gradint has pointed your web browser at an online dictionary that might help.","") def check_for_slacking(): diff --git a/gradint-build/src/lessonplan.py b/gradint-build/src/lessonplan.py index 719dc31d010f423ba9dfde8cddedbd9e9e7cf351..3edcaa33b85d78064fbe3236367680af7eaee55d 100644 --- a/gradint-build/src/lessonplan.py +++ b/gradint-build/src/lessonplan.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/loop.py b/gradint-build/src/loop.py index 30a913b48ae192156e60c1a63e8143d2a6cb5f17..666e74033053d8d576f5e05017212c238bbe07e6 100644 --- a/gradint-build/src/loop.py +++ b/gradint-build/src/loop.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/makeevent.py b/gradint-build/src/makeevent.py index de1484755fa56c55a1f0153419f6b13b1c3bfc2a..a4f8e5c69924357bf6ba6bc42852bb0f24b6c796 100644 --- a/gradint-build/src/makeevent.py +++ b/gradint-build/src/makeevent.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/play.py b/gradint-build/src/play.py index 73b636f68d6ea725f0f0c65d9a8e47dad2b8a01e..41ed5da490f9202e28ca42ee6ba7ebcddc8d24cd 100644 --- a/gradint-build/src/play.py +++ b/gradint-build/src/play.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/recording.py b/gradint-build/src/recording.py index 3b528dff13dcc098ccb4e13934af85633e5b6e50..fbc913b9137073bbf239ea6acb589f3fd3d4d0ab 100644 --- a/gradint-build/src/recording.py +++ b/gradint-build/src/recording.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/sequence.py b/gradint-build/src/sequence.py index 03fd20eab1dd95ce34a9474569093b11fe5a9276..6043bfadc641a80360aa7fcecb539908ca8d00fc 100644 --- a/gradint-build/src/sequence.py +++ b/gradint-build/src/sequence.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/synth.py b/gradint-build/src/synth.py index ff7b92677d32da8abb0748316a82c2cc8c5b2e3a..bcee4bf5e7a22f29466051fe78fa59ee8bcdfcfa 100644 --- a/gradint-build/src/synth.py +++ b/gradint-build/src/synth.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -672,13 +672,17 @@ def read_chinese_number(num): nums=num.split(".") if len(nums)==1: # normal number columns=("yi4 qian1 bai3 shi2 wan4 qian1 bai3 shi2".split()+[""]) + has_wan = not ("00000000"+num)[-8:-4]=="0000" if len(num)>len(columns) or (num and num[0]=="0"): return "".join([digits[ord(d)-ord("0")] for d in num]) # far too many digits, or something starting with 0 - read one at a time r=[] for d,c,i in zip(list(num),columns[-len(num):],range(len(num))): if d=="0": - if c and not (r and r[-1]=="ling2"): r.append("ling2") # else nothing - elif d=="1" and c=="shi2" and i==0: r.append(c) + if c=="wan4" and has_wan: r.append(c) + elif c and not (r and r[-1]=="ling2"): r.append("ling2") + # else nothing + elif d=="1" and c=="shi2" and (i==0 or (r and r[-1]=="ling2")): r.append(c) # 10, 1010 else: r.append(digits[ord(d)-ord("0")]+c) + if len(r)>1 and r[-1]=="ling2": del r[-1] # e.g. 100 return "".join(r) elif len(nums)==2: # read digits after the point one at a time rVal = [read_chinese_number(nums[0]),"dian3"] diff --git a/gradint-build/src/system.py b/gradint-build/src/system.py index d47749e376ff5dc81edc08046281e755098ab55e..c477d73a2c66c0249ff2e0f15a03dcf98368dbf1 100644 --- a/gradint-build/src/system.py +++ b/gradint-build/src/system.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/src/top.py b/gradint-build/src/top.py index 8e54c069740c701152a61bb5aabba9c1628d3e29..a6e810debedf6d7f1f019bc78da2d64aec15dddc 100644 --- a/gradint-build/src/top.py +++ b/gradint-build/src/top.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -program_name = "gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+." +program_name = "gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+." # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gradint-build/src/users.py b/gradint-build/src/users.py index 19dfa50a7abd46cd2c0b22ee4da1a4745c114da3..b017500577b2077a0f08e20a7f3d237d2892d708 100644 --- a/gradint-build/src/users.py +++ b/gradint-build/src/users.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or diff --git a/gradint-build/thindown.py b/gradint-build/thindown.py index 6144880d535197e060a88849df607965aee77c0b..0e072beac6248b732fed650fffb27ca89579d0a0 100644 --- a/gradint-build/thindown.py +++ b/gradint-build/thindown.py @@ -1,5 +1,5 @@ # This file is part of the source code of -# gradint v0.9956 (c) 2002-2010 Silas S. Brown. GPL v3+. +# gradint v0.9957 (c) 2002-2010 Silas S. Brown. GPL v3+. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or