Package: espeak-ng / 1.49.2+dfsg-8

lessgreat-punct Patch series | download
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
commit df247b7cab6e28e691e1db5b4abe7f0649e3b339
Author: Reece H. Dunn <msclrhd@gmail.com>
Date:   Thu May 3 21:29:17 2018 +0100

    Fix the ispunct ctype implementation.

diff --git a/src/ucd-tools/src/ctype.c b/src/ucd-tools/src/ctype.c
index 42bb9f58..ac6a37ea 100644
--- a/src/ucd-tools/src/ctype.c
+++ b/src/ucd-tools/src/ctype.c
@@ -1,6 +1,6 @@
 /* ctype-style APIs.
  *
- * Copyright (C) 2012-2017 Reece H. Dunn
+ * Copyright (C) 2012-2018 Reece H. Dunn
  *
  * This file is part of ucd-tools.
  *
@@ -151,19 +151,7 @@ int ucd_isprint(codepoint_t c)
 
 int ucd_ispunct(codepoint_t c)
 {
-	switch (ucd_lookup_category(c))
-	{
-	case UCD_CATEGORY_Pc:
-	case UCD_CATEGORY_Pd:
-	case UCD_CATEGORY_Pe:
-	case UCD_CATEGORY_Pf:
-	case UCD_CATEGORY_Pi:
-	case UCD_CATEGORY_Po:
-	case UCD_CATEGORY_Ps:
-		return 1;
-	default:
-		return 0;
-	}
+	return ucd_isgraph(c) && !ucd_isalnum(c);
 }
 
 int ucd_isspace(codepoint_t c)
diff --git a/src/ucd-tools/tools/printdata.py b/src/ucd-tools/tools/printdata.py
index 513a890c..e7bdc9a1 100755
--- a/src/ucd-tools/tools/printdata.py
+++ b/src/ucd-tools/tools/printdata.py
@@ -78,10 +78,7 @@ def isblank(data): # word separator
 		return 0
 
 def ispunct(data):
-	if data.get('GeneralCategory', 'Cn')[0] in 'P':
-		return 1
-	else:
-		return 0
+	return 1 if isgraph(data) and not isalnum(data) else 0
 
 def isprint(data):
 	if data.get('GeneralCategory', 'Cn')[0] in 'LMNPSZ': # not in 'CI'