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-07 18:03:26 -0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e425a3bedcb2840879a0ff1b5fdd6b923c82b0c0
e425a3be
1 parent
339bca7c
New terminological tagging for CRFs
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
biologicalTermTagging-CRF.py
biologicalTermTagging-CRF.py
View file @
e425a3b
...
...
@@ -136,17 +136,19 @@ if __name__ == "__main__":
if
len
(
word
)
>
1
:
for
termTag
in
hashTerms
:
if
word
in
hashTerms
[
termTag
]:
wordOrig
=
word
.
replace
(
'-'
,
' '
)
#print("Word: {}".format(word))
if
wordOrig
in
hashTermsOrig
[
termTag
]:
print
(
"WordOrig: {}"
.
format
(
wordOrig
))
line
=
''
for
w
,
l
in
zip
(
word
.
split
(
'-'
),
lemma
.
split
(
'-'
)):
line
+=
w
+
'
\t
'
+
listLine1
[
1
]
+
'
\t
'
+
l
+
' '
+
termTag
+
' TermTag'
+
'
\n
'
line
.
rstrip
(
'
\n
'
)
if
word
.
find
(
'-'
)
>
-
1
:
wordOrig
=
word
.
replace
(
'-'
,
' '
)
#print("Word: {}".format(word))
if
wordOrig
in
hashTermsOrig
[
termTag
]:
print
(
"WordOrig: {}"
.
format
(
wordOrig
))
line
=
''
for
w
,
l
in
zip
(
word
.
split
(
'-'
),
lemma
.
split
(
'-'
)):
line
+=
w
+
'
\t
'
+
listLine1
[
1
]
+
'
\t
'
+
l
+
' '
+
termTag
+
' TermTag'
+
'
\n
'
line
.
rstrip
(
'
\n
'
)
else
:
line
=
listLine1
[
0
]
+
'
\t
'
+
listLine1
[
1
]
+
'
\t
'
+
listLine2
[
0
]
+
' '
+
termTag
+
' TermTag'
else
:
line
=
listLine1
[
0
]
+
'
\t
'
+
listLine1
[
1
]
+
'
\t
'
+
listLine2
[
0
]
+
' '
+
termTag
+
' TermTag'
#line = listLine1[0] + '\t' + termTag + '\t' + listLine2[0] + ' ' + termTag + ' TermTag'
else
:
line
=
listLine1
[
0
]
+
'
\t
'
+
listLine1
[
1
]
+
'
\t
'
+
listLine2
[
0
]
+
' '
+
'O'
+
' TermTag'
# line = listLine1[0] + '\t' + termTag + '\t' + listLine2[0] + ' ' + termTag + ' TermTag'
...
...
Please
register
or
login
to post a comment