Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RL-Parsing
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
Releases
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
RL-Parsing
Commits
4fbcdd01
Commit
4fbcdd01
authored
Jul 30, 2021
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Added taggetbt
parent
f4a7a940
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Config.py
+1
-1
1 addition, 1 deletion
Config.py
Networks.py
+1
-1
1 addition, 1 deletion
Networks.py
main.py
+9
-2
9 additions, 2 deletions
main.py
with
11 additions
and
4 deletions
Config.py
+
1
−
1
View file @
4fbcdd01
...
...
@@ -106,7 +106,7 @@ class Config :
value
=
str
(
self
.
getAsFeature
(
lineIndex
,
self
.
index2col
[
colIndex
]))
if
value
==
""
:
value
=
"
_
"
elif
self
.
index2col
[
colIndex
]
==
"
HEAD
"
and
value
!=
"
-1
"
and
value
!=
Dicts
.
Dicts
.
erased
:
elif
self
.
index2col
[
colIndex
]
==
"
HEAD
"
and
value
!=
"
-1
"
and
value
!=
Dicts
.
Dicts
.
erased
and
value
!=
"
_
"
:
value
=
self
.
getAsFeature
(
int
(
value
),
"
ID
"
)
elif
self
.
index2col
[
colIndex
]
==
"
HEAD
"
and
value
==
"
-1
"
:
value
=
"
0
"
...
...
This diff is collapsed.
Click to expand it.
Networks.py
+
1
−
1
View file @
4fbcdd01
...
...
@@ -26,7 +26,7 @@ def createNetwork(name, dicts, outputSizes, incremental) :
elif
name
==
"
separated
"
:
return
SeparatedNet
(
dicts
,
outputSizes
,
incremental
,
featureFunctionAll
,
historyNb
,
historyPopNb
,
suffixSize
,
prefixSize
,
columns
,
hiddenSize
)
elif
name
==
"
tagger
"
:
return
BaseNet
(
dicts
,
outputSizes
,
incremental
,
featureFunctionNostack
,
historyNb
,
suffixSize
,
prefixSize
,
columns
,
hiddenSize
)
return
BaseNet
(
dicts
,
outputSizes
,
incremental
,
featureFunctionNostack
,
historyNb
,
historyPopNb
,
suffixSize
,
prefixSize
,
columns
,
hiddenSize
)
raise
Exception
(
"
Unknown network name
'
%s
'"
%
name
)
################################################################################
...
...
This diff is collapsed.
Click to expand it.
main.py
+
9
−
2
View file @
4fbcdd01
...
...
@@ -52,7 +52,7 @@ if __name__ == "__main__" :
parser
.
add_argument
(
"
--silent
"
,
"
-s
"
,
default
=
False
,
action
=
"
store_true
"
,
help
=
"
Don
'
t print advancement infos.
"
)
parser
.
add_argument
(
"
--transitions
"
,
default
=
"
eager
"
,
help
=
"
Transition set to use (
ea
ger |
swif
t |
t
agparser | tagparserbt |
tagparserbt1 |
recovery).
"
)
help
=
"
Transition set to use (
tag
ger |
taggerb
t |
e
ag
er | eagerbt | swift | tag
parser | tagparserbt | recovery).
"
)
parser
.
add_argument
(
"
--backSize
"
,
default
=
"
1
"
,
help
=
"
Size of back actions.
"
)
parser
.
add_argument
(
"
--network
"
,
default
=
"
base
"
,
...
...
@@ -96,7 +96,7 @@ if __name__ == "__main__" :
tmpDicts
=
Dicts
()
tmpDicts
.
readConllu
(
args
.
corpus
,
[
"
UPOS
"
],
0
)
tagActions
=
[
"
TAG UPOS %s
"
%
p
for
p
in
tmpDicts
.
getElementsOf
(
"
UPOS
"
)
if
"
__
"
not
in
p
and
not
isEmpty
(
p
)]
transitionSets
=
[[
Transition
(
elem
)
for
elem
in
tagActions
if
len
(
elem
)
>
0
],
[
Transition
(
"
NOBACK
"
),
Transition
(
"
BACK
"
+
args
.
backSize
)
]]
transitionSets
=
[[
Transition
(
"
NOBACK
"
),
Transition
(
"
BACK
"
+
args
.
backSize
)],
[
Transition
(
elem
)
for
elem
in
tagActions
if
len
(
elem
)
>
0
]]
args
.
predictedStr
=
"
UPOS
"
args
.
states
=
[
"
backer
"
,
"
tagger
"
]
strategy
=
[{
"
NOBACK
"
:
(
0
,
1
)},
{
"
TAG
"
:
(
1
,
0
)}]
...
...
@@ -109,6 +109,13 @@ if __name__ == "__main__" :
args
.
states
=
[
"
parser
"
]
strategy
=
[{
"
RIGHT
"
:
(
1
,
0
),
"
SHIFT
"
:
(
1
,
0
),
"
LEFT
"
:
(
0
,
0
),
"
REDUCE
"
:
(
0
,
0
)}]
probas
=
[[
list
(
map
(
float
,
args
.
probaRandom
.
split
(
'
,
'
))),
list
(
map
(
float
,
args
.
probaOracle
.
split
(
'
,
'
)))]]
elif
args
.
transitions
==
"
eagerbt
"
:
transitionSets
=
[[
Transition
(
"
NOBACK
"
),
Transition
(
"
BACK
"
+
args
.
backSize
)],
[
Transition
(
elem
)
for
elem
in
[
"
SHIFT
"
,
"
REDUCE
"
,
"
LEFT
"
,
"
RIGHT
"
]
if
len
(
elem
)
>
0
]]
args
.
predictedStr
=
"
HEAD
"
args
.
states
=
[
"
backer
"
,
"
parser
"
]
strategy
=
[{
"
NOBACK
"
:
(
0
,
1
)},
{
"
RIGHT
"
:
(
1
,
0
),
"
SHIFT
"
:
(
1
,
0
),
"
LEFT
"
:
(
0
,
1
),
"
REDUCE
"
:
(
0
,
1
)}]
probas
=
[[
list
(
map
(
float
,
args
.
probaStateBack
.
split
(
'
-
'
)[
0
].
split
(
'
,
'
))),
list
(
map
(
float
,
args
.
probaStateBack
.
split
(
'
-
'
)[
1
].
split
(
'
,
'
)))],
[
list
(
map
(
float
,
args
.
probaRandom
.
split
(
'
,
'
))),
list
(
map
(
float
,
args
.
probaOracle
.
split
(
'
,
'
)))]]
elif
args
.
transitions
==
"
tagparser
"
:
tmpDicts
=
Dicts
()
tmpDicts
.
readConllu
(
args
.
corpus
,
[
"
UPOS
"
],
0
)
...
...
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