Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stat
Manage
Activity
Members
Labels
Plan
Issues
0
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
nlpworkers
stat
Commits
e4671b10
There was an error fetching the commit references. Please try again later.
Commit
e4671b10
authored
5 years ago
by
Tomasz Walkowiak
Browse files
Options
Downloads
Patches
Plain Diff
formatting
parent
d200b140
No related merge requests found
Pipeline
#663
passed with stages
in 1 minute and 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/category.py
+9
-14
9 additions, 14 deletions
src/category.py
with
9 additions
and
14 deletions
src/category.py
+
9
−
14
View file @
e4671b10
...
...
@@ -18,7 +18,6 @@ class Model:
self
.
synsets
=
{}
if
len
(
path
)
>
0
:
self
.
read
(
path
)
#print(self.synsets)
print
(
"
New model
"
)
def
read
(
self
,
path
):
...
...
@@ -29,7 +28,6 @@ class Model:
ws
=
wb
.
active
num
=
0
for
row
in
ws
.
iter_rows
():
#print(num)
if
num
==
0
:
num
+=
1
continue
...
...
@@ -38,8 +36,6 @@ class Model:
if
lemma
is
None
or
tag
is
None
:
continue
var
=
row
[
1
].
value
synset
=
row
[
3
].
value
if
len
(
row
)
>
3
else
None
if
synset
is
not
None
:
self
.
synsets
[
str
(
synset
)]
=
tag
...
...
@@ -55,7 +51,7 @@ class Model:
class
Category
:
"""
Category.
"""
def
__init__
(
self
,
verbose
=
False
):
def
__init__
(
self
,
verbose
=
False
):
"""
Initialize Category.
"""
self
.
model
=
{}
self
.
modelpath
=
""
...
...
@@ -96,8 +92,8 @@ class Category:
if
id
in
model
.
synsets
:
self
.
inc
(
stat
,
model
.
synsets
[
id
])
if
self
.
verbose
:
print
(
"
Synset %s, category %s
"
%
(
id
,
model
.
synsets
[
id
]))
print
(
"
Synset %s, category %s
"
%
(
id
,
model
.
synsets
[
id
]))
found
=
True
break
...
...
@@ -109,21 +105,20 @@ class Category:
if
el
in
model
.
variants
:
self
.
inc
(
stat
,
model
.
variants
[
el
])
if
self
.
verbose
:
print
(
"
Variant %s, category %s
"
%
(
el
,
model
.
variants
[
el
]))
print
(
"
Variant %s, category %s
"
%
(
el
,
model
.
variants
[
el
]))
found
=
True
break
if
found
:
break
if
not
found
:
if
base
in
model
.
lemmas
:
self
.
inc
(
stat
,
model
.
lemmas
[
base
])
if
self
.
verbose
:
print
(
"
Base %s, category %s
"
%
(
base
,
model
.
lemmas
[
base
]))
print
(
"
Base %s, category %s
"
%
(
base
,
model
.
lemmas
[
base
]))
if
self
.
verbose
:
print
(
stat
)
with
open
(
outputFile
,
"
w
"
)
as
f
:
...
...
@@ -133,7 +128,7 @@ class Category:
def
main
():
"""
Runs the program.
"""
cat
=
Category
(
verbose
=
True
)
cat
.
process
(
"
../test/test
2
.ccl
"
,
{
"
path
"
:
"
/test/test.xlsx
"
},
cat
.
process
(
"
../test/test
1
.ccl
"
,
{
"
path
"
:
"
/test/test.xlsx
"
},
"
../test/test1_out.json
"
,
"
..
"
)
...
...
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