Skip to content

Commit a2c0a55

Browse files
committed
🚧 WIP on replace-first algorithm
1 parent 5e2b4a4 commit a2c0a55

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lice_comb/impl/regexes.clj

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@
149149
; Alternative spellings
150150
(lciu/replace-in-coll #"(?i)\s+Australia(?!\w)" #"[\s\-–—]+(?:Australia|AU)")
151151
(lciu/replace-in-coll #"(?i)\s+Austria(?!\w)" #"[\s\-–—]+(?:Austria|AT)")
152-
(lciu/replace-in-coll #"(?i)\s+England and Wales(?!\w)" #"[\s\-–—]+(?:England[\s\-–—]*(?:and|&)[\s\-–—]*Wales|UK)")
152+
(lciu/replace-in-coll #"(?i)\s+England and Wales(?!\w)" #"[\s\-–—]+(?:England[\s\-–—]*(?:and|&)[\s\-–—]*Wales|GB|UK)")
153153
(lciu/replace-in-coll #"(?i)\s+France(?!\w)" #"[\s\-–—]+(?:France|FR)")
154154
(lciu/replace-in-coll #"(?i)\s+(Germany|Deutsche)(?!\w)" #"[\s\-–—]+(?:Germany?|DE|Deutsche)")
155155
(lciu/replace-in-coll #"(?i)\s+Japan(?!\w)" #"[\s\-–—]+(?:Japan|JP)")
156156
(lciu/replace-in-coll #"(?i)\s+Netherlands(?!\w)" #"[\s\-–—]+(?:Netherlands|NL)")
157-
(lciu/replace-in-coll #"(?i)(?<!\w)(United Kingdom|UK)(?!\w)" #"(?:United[\s\-–—]+Kingdom|UK)")
158-
(lciu/replace-in-coll #"(?i)\s+(USA?|United States)(?!\w)" #"[\s\-–—]+(?:United[\s\-–—]+States|USA?)")
157+
(lciu/replace-in-coll #"(?i)(?<!\w)(United Kingdom|UK)(?!\w)" #"(?:United[\s\-–—]+Kingdom|GB|UK)")
158+
(lciu/replace-in-coll #"(?i)\s+(USA?|United States)(?!\w)" #"[\s\-–—]+(?:United[\s\-–—]+States(?:[\s\-–—]+of[\s\-–—]+America)?|USA?)")
159159
(lciu/replace-in-coll #"(?i)\s+University of California(?!\w)" #"[\s\-–—]+(?:University[\s\-–—]+of[\s\-–—]+(?:California|CA)|UC|Cal)")
160160
(lciu/replace-in-coll #"(?i)(?<!\w)acknowledge?ment(?!\w)" #"Acknowledge?ment") ; No trailing \b, to handle plurals etc.
161161
(lciu/replace-in-coll #"(?i)(?<!\w)merchant[ai]bility(?!\w)" #"Merchant[ai]bility")

test/lice_comb/data/name_lists/gpl.edn

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"GNU General Public License, Version 2"
3030
"GNU General Public License, Version 3 (or later)"
3131
"GNU General Public License, Version 3"
32-
; "GNU General Public License, version 2 (GPL2), with the classpath exception" ;Expression
32+
; "GNU General Public License, version 2 (GPL2), with the classpath exception" ; Expression
3333
; "GNU General Public License, version 2 with the GNU Classpath Exception" ; Expression
3434
"GNU General Public License, version 2"
3535
"GNU General Public License, version 3 (GPLv3)"

0 commit comments

Comments
 (0)