Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P8758
(An Untitled Masterwork)
Active
Public
Actions
Authored by
awight
on Jul 17 2019, 9:42 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F29790676: raw.txt
Jul 17 2019, 9:42 AM
2019-07-17 09:42:06 (UTC+0)
Subscribers
None
#!/usr/bin/env python3
import
csv
import
json
def
load_occupations
():
with
open
(
"occupations.json"
)
as
f
:
raw_data
=
json
.
load
(
f
)
# Skip items without a label.
return
[
line
[
"itemLabel"
]
for
line
in
raw_data
if
\
not
line
[
"item"
]
.
endswith
(
line
[
"itemLabel"
])]
def
load_demonyms
():
with
open
(
"demonyms.json"
)
as
f
:
raw_data
=
json
.
load
(
f
)
# Skip items without a label.
return
[
line
[
"itemLabel"
]
for
line
in
raw_data
if
\
not
line
[
"item"
]
.
endswith
(
line
[
"itemLabel"
])]
def
generate_fgrep
(
occupations
):
with
open
(
"grep_cats.txt"
,
"w"
)
as
out
:
for
occupation
in
occupations
:
print
(
'([^A-Za-z0-9]|
\\
b)'
+
occupation
+
'([^A-Za-z0-9]|
\\
b)'
,
file
=
out
)
if
__name__
==
"__main__"
:
generate_fgrep
(
load_occupations
())
Event Timeline
awight
created this paste.
Jul 17 2019, 9:42 AM
2019-07-17 09:42:06 (UTC+0)
awight
mentioned this in
T228183: Investigation: Check how many categories and articles would be affected by changes
.
Jul 17 2019, 9:49 AM
2019-07-17 09:49:44 (UTC+0)
Log In to Comment