Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Carlos-Francisco Méndez-Cruz
/
nlp-preprocessing-pipeline
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-08 00:45:45 -0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
341985792ca4269fa6f1d35b1bd1b3be5db88b05
34198579
1 parent
e54bba9e
New terminological tagging for CRFs
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
biologicalTermTagging-CRF.py
biologicalTermTagging-CRF.py
View file @
3419857
...
...
@@ -129,7 +129,7 @@ if __name__ == "__main__":
if
line
==
'
\n
'
:
oFile
.
write
(
line
)
else
:
line
=
line
.
strip
(
'
\n
'
)
line
=
line
.
strip
(
'
\
r\
n
'
)
listLine1
=
line
.
split
(
'
\t
'
)
if
len
(
listLine1
)
<
3
:
continue
...
...
@@ -143,18 +143,19 @@ if __name__ == "__main__":
if
word
.
find
(
'-'
)
>
-
1
:
found
=
False
repetitions
=
word
.
count
(
'-'
)
print
(
"repetitions: {}"
.
format
(
repetitions
))
#
print("repetitions: {}".format(repetitions))
wordOrig
=
word
for
i
in
range
(
0
,
repetitions
):
wordOrig
=
wordOrig
.
replace
(
'-'
,
' '
,
1
)
print
(
"Word: {}"
.
format
(
wordOrig
))
#
print("Word: {}".format(wordOrig))
if
wordOrig
in
hashTermsOrig
[
termTag
]:
print
(
"WordOrig: {}"
.
format
(
wordOrig
))
#
print("WordOrig: {}".format(wordOrig))
found
=
True
line
=
''
for
w
,
l
in
zip
(
word
.
split
(
'-'
),
lemma
.
split
(
'-'
)):
line
+=
w
+
'
\t
'
+
listLine1
[
1
]
+
'
\t
'
+
l
+
' '
+
termTag
+
' TermTag'
+
'
\n
'
line
.
rstrip
(
'
\r\n
'
)
print
(
"Line: {}"
.
format
(
line
))
if
not
found
:
line
=
listLine1
[
0
]
+
'
\t
'
+
listLine1
[
1
]
+
'
\t
'
+
listLine2
[
0
]
+
' '
+
termTag
+
' TermTag'
else
:
...
...
Please
register
or
login
to post a comment