Skip to content

Commit 9c12d93

Browse files
committed
Detect copyright with parens
Signed-off-by: Philippe Ombredanne <pombredanne@aboutcode.org>
1 parent 42cd565 commit 9c12d93

20 files changed

Lines changed: 69 additions & 24 deletions

src/cluecode/copyrights.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ def get_tokens(numbered_lines, splitter=re.compile(r'[\t =;]+').split):
429429

430430
# when there is a an openning parens in the middle of a word, add a
431431
# space before in some cases: exclude (digit , (s , (c , (-
432-
line = re.sub(pattern=r'(\([^rsc\-\d])', repl=' \g<1>', string=line, flags=re.IGNORECASE)
432+
# this allows to recover from words like KISA(Korean
433+
line = re.sub(pattern=r'(\([^rsc\-\d])', repl=' \g<1>', string=line)
433434
for tok in splitter(line):
434435
# strip trailing quotes+comma
435436
if tok.endswith("',"):
@@ -1236,6 +1237,10 @@ def build_detection_from_node(
12361237
(r'^param$', 'JUNK'),
12371238
(r'^which$', 'JUNK'),
12381239

1240+
# github/gitlab usernames
1241+
(r'^Hiroki11x$', 'NNP'),
1242+
(r'^goldze$', 'NNP'),
1243+
12391244
# "Es6ToEs3ClassSideInheritance. and related names
12401245
(r"^[A-Z]([a-zA-Z]*[0-9]){2,}[a-zA-Z]+[\.,]?", 'JUNK'),
12411246

@@ -1300,7 +1305,7 @@ def build_detection_from_node(
13001305
# '!(r)'
13011306
(r'^!\(r\)$', 'JUNK'),
13021307

1303-
# vars with curly braces
1308+
# vars with parens
13041309
(r'\(var', 'JUNK'),
13051310

13061311
# tags
@@ -1895,7 +1900,7 @@ def build_detection_from_node(
18951900

18961901
# rare form of trailing punct in name: Ian Robertson).
18971902
(r'^Robert.*', 'NNP'),
1898-
1903+
18991904
############################################################################
19001905
# Named entities: companies, groups, universities, etc
19011906
############################################################################
@@ -2233,6 +2238,7 @@ def build_detection_from_node(
22332238
(r'^Xiph.Org$', 'NNP'),
22342239
(r'^iClick,?$', 'NNP'),
22352240
(r'^electronics?$', 'NNP'),
2241+
(r'^semiconductors?[\.,]?$', 'NNP'),
22362242

22372243
# proper nouns with digits
22382244
(r'^([A-Z][a-z0-9]+){1,2}[\.,]?$', 'NNP'),
@@ -2370,8 +2376,6 @@ def build_detection_from_node(
23702376
# some punctuation combos
23712377
(r'^(?:=>|->|<-|<=)$', 'JUNK'),
23722378

2373-
(r'^semiconductors?[\.,]?$', 'NNP'),
2374-
23752379
############################################################################
23762380
# catch all other as Nouns
23772381
############################################################################
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary
4+
copyrights:
5+
- Copyright 2014
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary
4+
copyrights:
5+
- Copyright 2018 dunamu (ju)
6+
holders:
7+
- dunamu (ju)
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary
4+
copyrights:
5+
- Copyright (c) 2023 Wolken (zwolken@foxmail.com zharry@web.de)
6+
holders:
7+
- Wolken
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary
4+
copyrights:
5+
- Copyright (c) 2002 Obviex (TM)
6+
holders:
7+
- Obviex (TM)
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary
4+
copyrights:
5+
- Copyright (c) 2018 qiuri Qiu Ri
6+
holders:
7+
- qiuri Qiu Ri
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary
4+
copyrights:
5+
- Copyright 1996 V (DL)2 inc.
6+
holders:
7+
- V (DL)2 inc.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary
4+
copyrights:
5+
- Xfrom Elsevier, Copyright 2016
6+
holders:
7+
- Xfrom Elsevier
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary
4+
copyrights:
5+
- Copyright 2018 Hiroki11x (Hiroki Naganuma)
6+
holders:
7+
- Hiroki11x (Hiroki Naganuma)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
what:
22
- copyrights
33
- holders
4-
- holders_summary

0 commit comments

Comments
 (0)