Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Carlos-Francisco Méndez-Cruz
/
conditional-random-fields
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Carlos-Francisco Méndez-Cruz
2018-03-06 19:08:39 -0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8c2b229afcfcc14a4261605c987fca54cefa297e
8c2b229a
1 parent
90224aa9
Prepare abstracts
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
prepare-abstracts.py
prepare-abstracts.py
View file @
8c2b229
...
...
@@ -22,6 +22,8 @@ __author__ = 'CMendezC'
# --inputPath /export/space1/users/compu2/bionlp/conditional-random-fields/data-sets
# --inputFile text-annotated-abstracts-original.txt
# --outputPath /export/space1/users/compu2/bionlp/conditional-random-fields/data-sets/original
# --dicPath /export/space1/users/compu2/bionlp/nlp-preprocessing-pipeline/dictionaries
# --dicFile genes.txt
# python3 prepare-abstracts.py --inputPath /export/space1/users/compu2/bionlp/conditional-random-fields/data-sets --inputFile text-annotated-abstracts-original.txt --outputPath /export/space1/users/compu2/bionlp/conditional-random-fields/data-sets/original
if
__name__
==
"__main__"
:
...
...
@@ -33,6 +35,10 @@ if __name__ == "__main__":
help
=
"Input file"
,
metavar
=
"FILE"
)
parser
.
add_option
(
"--outputPath"
,
dest
=
"outputPath"
,
help
=
"Output path"
,
metavar
=
"PATH"
)
parser
.
add_option
(
"--dicPath"
,
dest
=
"dicPath"
,
help
=
"Dictionary path"
,
metavar
=
"PATH"
)
parser
.
add_option
(
"--dicFile"
,
dest
=
"dicFile"
,
help
=
"Dictionary file"
,
metavar
=
"FILE"
)
(
options
,
args
)
=
parser
.
parse_args
()
if
len
(
args
)
>
0
:
...
...
@@ -44,6 +50,8 @@ if __name__ == "__main__":
print
(
"Input path: "
+
str
(
options
.
inputPath
))
print
(
"Input file"
,
str
(
options
.
inputFile
))
print
(
"Output path: "
+
str
(
options
.
outputPath
))
print
(
"Dictionary path: "
+
str
(
options
.
dicPath
))
print
(
"Dictionary file"
,
str
(
options
.
dicFile
))
filesWritten
=
0
t0
=
time
()
...
...
@@ -69,6 +77,8 @@ if __name__ == "__main__":
oFile
.
write
(
line
)
else
:
print
(
"Warning: line without PMID"
)
with
open
(
os
.
path
.
join
(
options
.
dicPath
,
options
.
dicFile
),
"w"
,
encoding
=
"utf-8"
,
errors
=
"replace"
)
as
dFile
:
for
gene
in
hashGenes
.
keys
():
dFile
.
write
(
"{}
\n
"
.
format
(
gene
))
...
...
Please
register
or
login
to post a comment