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
f5176d86
Commit
f5176d86
authored
12 years ago
by
jezozwierzak
Browse files
Options
Downloads
Patches
Plain Diff
repaired tabs in subheads
parent
4af354c0
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
utils/CSVColumn.py
+19
-5
19 additions, 5 deletions
utils/CSVColumn.py
utils/chunk_eval.py
+4
-2
4 additions, 2 deletions
utils/chunk_eval.py
with
23 additions
and
7 deletions
utils/CSVColumn.py
+
19
−
5
View file @
f5176d86
...
...
@@ -93,11 +93,12 @@ class CSVColumn:
self
.
recountWidths
()
else
:
assert
type
(
data
).
__name__
!=
'
dict
'
,
'
You added dict to column with no subcolumns
'
if
len
(
self
.
content
)
==
0
:
self
.
type
=
type
(
data
).
__name__
self
.
content
.
append
(
data
)
if
len
(
str
(
data
))
>
self
.
width
and
self
.
isSubColumn
():
self
.
parent
.
recountWidths
()
self
.
parent
.
recountWidths
(
self
.
parent
.
content
.
index
(
self
)
)
elif
len
(
str
(
data
)
+
self
.
separator
)
>
self
.
width
:
self
.
width
=
len
(
str
(
data
))
...
...
@@ -113,7 +114,7 @@ class CSVColumn:
result
+=
row
return
result
def
recountWidths
(
self
):
def
recountWidths
(
self
,
sub
=
''
):
subColsStr
=
''
for
subColumn
in
self
.
content
:
subColsStr
+=
subColumn
.
name
+
self
.
separator
...
...
@@ -122,10 +123,23 @@ class CSVColumn:
self
.
width
=
len
(
subColsStr
)
for
subColumn
in
self
.
content
:
subColumn
.
width
=
len
(
subColumn
.
name
+
self
.
separator
)
el
if
self
.
parent
.
rows
>
0
:
if
len
(
self
.
content
[
0
].
content
)
>
0
:
widths
=
0
for
i
in
range
(
0
,
len
(
self
.
content
)):
#Dla każdej podkolumny
for
j
in
range
(
0
,
self
.
parent
.
rows
):
#Dla każdego wiersza
if
sub
==
''
:
for
i
in
range
(
0
,
len
(
self
.
content
)):
#Dla każdej podkolumny
for
j
in
range
(
0
,
len
(
self
.
content
[
0
].
content
)):
#Dla każdego wiersza
if
i
==
len
(
self
.
content
)
-
1
:
if
self
.
width
-
widths
>
0
:
self
.
content
[
i
].
width
=
self
.
width
-
widths
else
:
self
.
content
[
i
].
width
=
len
(
self
.
parent
.
ptr
(
self
.
content
[
i
].
content
[
j
],
1
))
break
elif
len
(
self
.
parent
.
ptr
(
self
.
content
[
i
].
content
[
j
],
1
))
>
self
.
content
[
i
].
width
:
self
.
content
[
i
].
width
=
len
(
self
.
parent
.
ptr
(
self
.
content
[
i
].
content
[
j
],
1
))
widths
+=
self
.
content
[
i
].
width
else
:
i
=
sub
for
j
in
range
(
0
,
len
(
self
.
content
[
0
].
content
)):
#Dla każdego wiersza
if
i
==
len
(
self
.
content
)
-
1
:
if
self
.
width
-
widths
>
0
:
self
.
content
[
i
].
width
=
self
.
width
-
widths
...
...
This diff is collapsed.
Click to expand it.
utils/chunk_eval.py
+
4
−
2
View file @
f5176d86
...
...
@@ -159,6 +159,7 @@ def main(ch_path, ref_path, chan_names, input_format, out_path, tagset, verbose,
# process each sentence separately
for
ch_sent
,
ref_sent
in
zip
(
ch_chunk
.
sentences
(),
ref_chunk
.
sentences
()):
print
ch_sent
.
size
(),
ref_sent
.
size
()
assert
ch_sent
.
size
()
==
ref_sent
.
size
()
ch_annots
=
get_annots
(
ch_sent
,
chan_name
)
ref_annots
=
get_annots
(
ref_sent
,
chan_name
)
...
...
@@ -166,14 +167,15 @@ def main(ch_path, ref_path, chan_names, input_format, out_path, tagset, verbose,
results
[
chan_name
]
=
stats
.
getStats
()
csvTable
.
addRow
(
results
)
#
csvTable.countAvg()
csvTable
.
countAvg
()
if
out_path
!=
''
:
out
=
codecs
.
open
(
out_path
,
"
w
"
,
"
utf-8
"
)
out
.
write
(
csvTable
.
__str__
())
out
.
close
()
else
:
print
csvTable
if
__name__
==
'
__main__
'
:
go
()
\ No newline at end of file
go
()
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