Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24928005
eliminate-common-nouns
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
553 B
Referenced Files
None
Subscribers
None
eliminate-common-nouns
View Options
#!/usr/bin/env python3
import
sys
import
os.path
#
# Parses arguments
#
if
len
(
sys
.
argv
)
!=
2
:
print
(
'Usage:'
,
sys
.
argv
[
0
],
'<text file>'
)
sys
.
exit
(
1
)
filename
=
sys
.
argv
[
1
]
if
not
os
.
path
.
exists
(
filename
):
print
(
filename
+
': no such file'
)
sys
.
exit
(
2
)
#
# Discards English words
#
with
open
(
"wordsEn.txt"
,
"r"
)
as
file
:
englishWords
=
file
.
read
()
.
split
()
with
open
(
filename
,
"r"
)
as
file
:
for
line
in
file
:
candidate
=
line
.
strip
()
if
candidate
.
lower
()
not
in
englishWords
:
print
(
candidate
)
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Sat, Mar 21, 04:57 (9 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3546282
Default Alt Text
eliminate-common-nouns (553 B)
Attached To
Mode
rEPN extract-proper-nouns
Attached
Detach File
Event Timeline
Log In to Comment