Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tomaž Erjavec
siIUS
Commits
081c74f8
Commit
081c74f8
authored
Feb 07, 2020
by
Tomaž Erjavec
Browse files
Fix bug with spaces
parent
b2a8aa00
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/conllu2tei.pl
View file @
081c74f8
...
...
@@ -94,7 +94,7 @@ sub sent2tei {
next
unless
$line
=~
/^\d+\t/
;
my
(
$n
,
$token
,
$lemma
,
$upos
,
$xpos
,
$ufeats
,
$link
,
$role
,
$extra
,
$local
)
=
split
/\t/
,
$line
;
$xpos
=~
/-+$/
/
;
# Get rid of trailing dashes introduced by Stanford NLP
$xpos
=~
s
/-+$//
;
# Get rid of trailing dashes introduced by Stanford NLP
if
(
$xpos
=~
/Z/
)
{
$tag
=
'
pc
'}
else
{
$tag
=
'
w
'}
#$role =~ s/:/_/; #Leave for now, although backwards incompatibility!
my
$feats
=
"
UposTag=
$upos
";
...
...
@@ -117,7 +117,7 @@ sub sent2tei {
}
unless
(
@deps
)
{
#No parse
$tei
.=
join
"
\n
",
@toks
;
$tei
=~
s|<c> </c>\n$|\n|
;
$space
=
$tei
=~
s|<c> </c>\n$|\n|
;
}
else
{
# Parsed
#Give IDs to tokens as we have a parse
...
...
@@ -126,7 +126,7 @@ sub sent2tei {
$element
=~
s| | xml:id="$id" |
;
$tei
.=
"
$element
\n
";
}
$tei
=~
s|<c> </c>\n$|\n|
;
$space
=
$tei
=~
s|<c> </c>\n$|\n|
;
$tei
.=
"
<linkGrp type=
\"
$ud_type
\"
targFunc=
\"
head argument
\"
corresp=
\"
#
$id
\"
>
\n
";
foreach
$dep
(
@deps
)
{
my
(
$head
,
$arg
,
$role
)
=
split
/\t/
,
$dep
;
...
...
@@ -137,7 +137,8 @@ sub sent2tei {
}
$tei
.=
"
</linkGrp>
";
}
$tei
.=
"
\n
</s>
\n
<c> </c>
\n
";
$tei
.=
"
\n
</s>
\n
";
$tei
.=
"
<c> </c>
\n
"
if
$space
;
return
$tei
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment