Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon
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
Container registry
Model registry
Operate
Environments
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
macaon
Commits
673b4d2a
Commit
673b4d2a
authored
5 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Removed cycle checking in Action::attach and fixed index problem in some transition cost
parent
65bb83a7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
reading_machine/src/Action.cpp
+8
-11
8 additions, 11 deletions
reading_machine/src/Action.cpp
reading_machine/src/Transition.cpp
+2
-2
2 additions, 2 deletions
reading_machine/src/Transition.cpp
with
10 additions
and
13 deletions
reading_machine/src/Action.cpp
+
8
−
11
View file @
673b4d2a
...
...
@@ -667,15 +667,15 @@ Action Action::attach(Config::Object governorObject, int governorIndex, Config::
return
false
;
// Check for cycles
while
(
govLineIndex
!=
depLineIndex
)
{
try
{
govLineIndex
=
std
::
stoi
(
config
.
getAsFeature
(
Config
::
headColName
,
govLineIndex
));
}
catch
(
std
::
exception
&
)
{
return
true
;}
}
//
while (govLineIndex != depLineIndex)
//
{
//
try
//
{
//
govLineIndex = std::stoi(config.getAsFeature(Config::headColName, govLineIndex));
//
} catch(std::exception &) {return true;}
//
}
return
fals
e
;
return
tru
e
;
};
return
{
Type
::
Write
,
apply
,
undo
,
appliable
};
...
...
@@ -743,9 +743,6 @@ Action Action::setRootUpdateIdsEmptyStackIfSentChanged()
firstIndexOfSentence
=
i
;
}
if
(
firstIndexOfSentence
<
0
)
util
::
myThrow
(
"could not find any token in current sentence"
);
for
(
int
i
=
firstIndexOfSentence
;
i
<=
lineIndex
;
++
i
)
{
if
(
!
config
.
has
(
0
,
i
,
0
))
...
...
This diff is collapsed.
Click to expand it.
reading_machine/src/Transition.cpp
+
2
−
2
View file @
673b4d2a
...
...
@@ -362,7 +362,7 @@ void Transition::initStandardLeft_rel(std::string label)
return
0
;
int
cost
=
getNbLinkedWith
(
config
.
getWordIndex
(),
getLastIndexOfSentence
(
config
.
getWordIndex
(),
config
),
Config
::
Object
::
Buffer
,
depIndex
,
config
);
cost
+=
getNbLinkedWith
(
1
,
config
.
getStackSize
()
-
2
,
Config
::
Object
::
Stack
,
depIndex
,
config
);
cost
+=
getNbLinkedWith
(
1
,
config
.
getStackSize
()
-
1
,
Config
::
Object
::
Stack
,
depIndex
,
config
);
if
(
label
!=
config
.
getConst
(
Config
::
deprelColName
,
depIndex
,
0
))
++
cost
;
...
...
@@ -406,7 +406,7 @@ void Transition::initEagerRight_rel(std::string label)
{
auto
depIndex
=
config
.
getWordIndex
();
int
cost
=
getNbLinkedWith
(
1
,
config
.
getStackSize
()
-
2
,
Config
::
Object
::
Stack
,
depIndex
,
config
);
int
cost
=
getNbLinkedWith
(
1
,
config
.
getStackSize
()
-
1
,
Config
::
Object
::
Stack
,
depIndex
,
config
);
cost
+=
getNbLinkedWithHead
(
depIndex
+
1
,
getLastIndexOfSentence
(
depIndex
,
config
),
Config
::
Object
::
Buffer
,
depIndex
,
config
);
if
(
label
!=
config
.
getConst
(
Config
::
deprelColName
,
depIndex
,
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