Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tbp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexis Nasr
tbp
Commits
4a37ce59
Commit
4a37ce59
authored
4 years ago
by
Alexis Nasr
Browse files
Options
Downloads
Patches
Plain Diff
code refactoring
parent
25e8bd5c
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
expe/basic.fm
+7
-7
7 additions, 7 deletions
expe/basic.fm
src/Config.py
+3
-3
3 additions, 3 deletions
src/Config.py
src/FeatModel.py
+10
-7
10 additions, 7 deletions
src/FeatModel.py
src/tbp_decode.py
+1
-1
1 addition, 1 deletion
src/tbp_decode.py
with
21 additions
and
18 deletions
expe/basic.fm
+
7
−
7
View file @
4a37ce59
B -2 POS
B -1 POS
B 0 POS
B 1 POS
B 2 POS
S 0 POS
S 1 POS
W
B -2 POS
W
B -1 POS
W
B 0 POS
W
B 1 POS
W
B 2 POS
W
S 0 POS
W
S 1 POS
This diff is collapsed.
Click to expand it.
src/Config.py
+
3
−
3
View file @
4a37ce59
...
...
@@ -86,9 +86,9 @@ class Config:
return
False
def
getWordFeat
(
self
,
featTuple
):
container
=
featTuple
[
0
]
index
=
featTuple
[
1
]
tape
=
featTuple
[
2
]
container
=
featTuple
[
1
]
index
=
featTuple
[
2
]
tape
=
featTuple
[
3
]
if
(
container
==
'
B
'
):
...
...
This diff is collapsed.
Click to expand it.
src/FeatModel.py
+
10
−
7
View file @
4a37ce59
...
...
@@ -14,22 +14,22 @@ class FeatModel:
exit
(
1
)
featArray
=
[]
for
ligne
in
featModFile
:
(
container
,
position
,
wordFeature
)
=
ligne
.
split
()
#
print("container = ", container, "position = ", position, "wordFeature = ", wordFeature)
(
featType
,
container
,
position
,
wordFeature
)
=
ligne
.
split
()
#
print(
"type =", featType,
"container = ", container, "position = ", position, "wordFeature = ", wordFeature)
if
(
container
!=
"
B
"
and
container
!=
"
S
"
):
print
(
"
error while reading featMod file :
"
,
featModFilename
,
"
container :
"
,
container
,
"
undefined
"
)
exit
(
1
)
if
not
wordFeature
in
set
([
'
POS
'
,
'
LEMMA
'
,
'
FORM
'
]):
print
(
"
error while reading featMod file :
"
,
featModFilename
,
"
wordFeature :
"
,
wordFeature
,
"
undefined
"
)
exit
(
1
)
featArray
.
append
((
container
,
int
(
position
),
wordFeature
))
featArray
.
append
((
featType
,
container
,
int
(
position
),
wordFeature
))
featModFile
.
close
()
return
featArray
def
computeInputSize
(
self
,
dicos
):
inputVectorSize
=
0
for
featTuple
in
self
.
getFeatArray
():
feat
=
featTuple
[
2
]
feat
=
featTuple
[
3
]
inputVectorSize
+=
dicos
.
getDico
(
feat
).
getSize
()
return
inputVectorSize
...
...
@@ -42,15 +42,18 @@ class FeatModel:
def
getFeatArray
(
self
):
return
self
.
featArray
def
getFeat
Container
(
self
,
featIndex
):
def
getFeat
Type
(
self
,
featIndex
):
return
self
.
featArray
[
featIndex
][
0
]
def
getFeat
Position
(
self
,
featIndex
):
def
getFeat
Container
(
self
,
featIndex
):
return
self
.
featArray
[
featIndex
][
1
]
def
getFeat
Label
(
self
,
featIndex
):
def
getFeat
Position
(
self
,
featIndex
):
return
self
.
featArray
[
featIndex
][
2
]
def
getFeatLabel
(
self
,
featIndex
):
return
self
.
featArray
[
featIndex
][
3
]
def
buildInputVector
(
self
,
featVec
,
dicos
):
inputVector
=
np
.
zeros
(
self
.
inputVectorSize
,
dtype
=
"
int32
"
)
origin
=
0
...
...
This diff is collapsed.
Click to expand it.
src/tbp_decode.py
+
1
−
1
View file @
4a37ce59
...
...
@@ -43,7 +43,7 @@ sys.stderr.write('\n')
mcd
=
Mcd
(
mcd_file
)
sys
.
stderr
.
write
(
'
loading dicos
\n
'
)
dicos
=
Dicos
(
fileName
=
dicos_file
,
verbose
=
False
)
dicos
=
Dicos
(
fileName
=
dicos_file
)
moves
=
Moves
(
dicos
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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