Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
corpus2
Commits
a0fa6b8a
Commit
a0fa6b8a
authored
13 years ago
by
Adam Radziszewski
Browse files
Options
Downloads
Patches
Plain Diff
tagger eval reports diffs in seg if run in debug mode
parent
328cf722
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/tagger-eval.py
+8
-2
8 additions, 2 deletions
utils/tagger-eval.py
with
8 additions
and
2 deletions
utils/tagger-eval.py
+
8
−
2
View file @
a0fa6b8a
...
...
@@ -27,7 +27,7 @@ changelog = """
* separate stats for unknown forms
"""
def
text
(
tok_seq
,
respect_spaces
):
def
text
(
tok_seq
,
respect_spaces
,
mark_boundaries
=
False
):
"""
Extracts text from a sequence of tokens. If respect_spaces, will append
spaces between tokens where no no-space markers present.
"""
buff
=
StringIO
()
...
...
@@ -35,10 +35,14 @@ def text(tok_seq, respect_spaces):
for
tok
in
tok_seq
:
if
nonfirst
and
respect_spaces
and
tok
.
after_space
():
buff
.
write
(
'
'
)
if
mark_boundaries
:
buff
.
write
(
'
[
'
)
buff
.
write
(
tok
.
orth_utf8
().
decode
(
'
utf-8
'
))
if
mark_boundaries
:
buff
.
write
(
'
]
'
)
nonfirst
=
True
return
buff
.
getvalue
()
def
next_tok
(
rdr
):
while
True
:
tok
=
rdr
.
get_next_token
()
...
...
@@ -253,6 +257,8 @@ class TokComp:
pre_feat_sets
[
0
].
add
(
Feat
.
SEG_NOCHANGE
)
pre_feat_sets
[
0
].
update
(
self
.
cmp_toks
(
tag_seq
[
0
],
ref_seq
[
0
]))
else
:
if
self
.
debug
:
print
'
SEGCHANGE
\t
%s
\t
%s
'
%
(
text
(
tag_seq
,
True
,
True
),
text
(
ref_seq
,
True
,
True
))
# mark all as subjected to segmentation changes
for
feats
in
pre_feat_sets
:
feats
.
add
(
Feat
.
SEG_CHANGE
)
# check if all ref and tagged toks are punctuation
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment