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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
macaon
Commits
a2fddd00
Commit
a2fddd00
authored
4 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Defaulting staticCost to dynamicCost
parent
085a30f2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
reading_machine/src/Transition.cpp
+42
-13
42 additions, 13 deletions
reading_machine/src/Transition.cpp
with
42 additions
and
13 deletions
reading_machine/src/Transition.cpp
+
42
−
13
View file @
a2fddd00
...
@@ -144,6 +144,8 @@ void Transition::initWrite(std::string colName, std::string object, std::string
...
@@ -144,6 +144,8 @@ void Transition::initWrite(std::string colName, std::string object, std::string
return
1
;
return
1
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initAdd
(
std
::
string
colName
,
std
::
string
object
,
std
::
string
index
,
std
::
string
value
)
void
Transition
::
initAdd
(
std
::
string
colName
,
std
::
string
object
,
std
::
string
index
,
std
::
string
value
)
...
@@ -165,6 +167,8 @@ void Transition::initAdd(std::string colName, std::string object, std::string in
...
@@ -165,6 +167,8 @@ void Transition::initAdd(std::string colName, std::string object, std::string in
return
1
;
return
1
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initNothing
()
void
Transition
::
initNothing
()
...
@@ -173,6 +177,8 @@ void Transition::initNothing()
...
@@ -173,6 +177,8 @@ void Transition::initNothing()
{
{
return
0
;
return
0
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initIgnoreChar
()
void
Transition
::
initIgnoreChar
()
...
@@ -183,6 +189,8 @@ void Transition::initIgnoreChar()
...
@@ -183,6 +189,8 @@ void Transition::initIgnoreChar()
{
{
return
0
;
return
0
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initEndWord
()
void
Transition
::
initEndWord
()
...
@@ -195,6 +203,8 @@ void Transition::initEndWord()
...
@@ -195,6 +203,8 @@ void Transition::initEndWord()
return
0
;
return
0
;
return
1
;
return
1
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initAddCharToWord
()
void
Transition
::
initAddCharToWord
()
...
@@ -221,6 +231,8 @@ void Transition::initAddCharToWord()
...
@@ -221,6 +231,8 @@ void Transition::initAddCharToWord()
return
0
;
return
0
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initSplitWord
(
std
::
vector
<
std
::
string
>
words
)
void
Transition
::
initSplitWord
(
std
::
vector
<
std
::
string
>
words
)
...
@@ -249,6 +261,8 @@ void Transition::initSplitWord(std::vector<std::string> words)
...
@@ -249,6 +261,8 @@ void Transition::initSplitWord(std::vector<std::string> words)
return
cost
;
return
cost
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initSplit
(
int
index
)
void
Transition
::
initSplit
(
int
index
)
...
@@ -264,6 +278,8 @@ void Transition::initSplit(int index)
...
@@ -264,6 +278,8 @@ void Transition::initSplit(int index)
return
transitions
[
index
]
->
getCostDynamic
(
config
);
return
transitions
[
index
]
->
getCostDynamic
(
config
);
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initEagerShift
()
void
Transition
::
initEagerShift
()
...
@@ -294,6 +310,8 @@ void Transition::initStandardShift()
...
@@ -294,6 +310,8 @@ void Transition::initStandardShift()
{
{
return
0
;
return
0
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initEagerLeft_rel
(
std
::
string
label
)
void
Transition
::
initEagerLeft_rel
(
std
::
string
label
)
...
@@ -355,6 +373,8 @@ void Transition::initStandardLeft_rel(std::string label)
...
@@ -355,6 +373,8 @@ void Transition::initStandardLeft_rel(std::string label)
return
cost
;
return
cost
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initEagerLeft
()
void
Transition
::
initEagerLeft
()
...
@@ -375,6 +395,8 @@ void Transition::initEagerLeft()
...
@@ -375,6 +395,8 @@ void Transition::initEagerLeft()
return
cost
;
return
cost
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initEagerRight_rel
(
std
::
string
label
)
void
Transition
::
initEagerRight_rel
(
std
::
string
label
)
...
@@ -438,6 +460,8 @@ void Transition::initStandardRight_rel(std::string label)
...
@@ -438,6 +460,8 @@ void Transition::initStandardRight_rel(std::string label)
return
cost
;
return
cost
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initEagerRight
()
void
Transition
::
initEagerRight
()
...
@@ -460,6 +484,8 @@ void Transition::initEagerRight()
...
@@ -460,6 +484,8 @@ void Transition::initEagerRight()
return
cost
;
return
cost
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initReduce_strict
()
void
Transition
::
initReduce_strict
()
...
@@ -480,19 +506,6 @@ void Transition::initReduce_strict()
...
@@ -480,19 +506,6 @@ void Transition::initReduce_strict()
return
cost
;
return
cost
;
};
};
costDynamic
=
[](
const
Config
&
config
)
{
auto
stackIndex
=
config
.
getStack
(
0
);
auto
wordIndex
=
config
.
getWordIndex
();
if
(
!
config
.
isToken
(
stackIndex
))
return
0
;
int
cost
=
getNbLinkedWithDeps
(
wordIndex
,
getLastIndexOfSentence
(
wordIndex
,
config
),
Config
::
Object
::
Buffer
,
stackIndex
,
config
);
return
cost
;
};
costStatic
=
costDynamic
;
costStatic
=
costDynamic
;
}
}
...
@@ -512,6 +525,8 @@ void Transition::initReduce_relaxed()
...
@@ -512,6 +525,8 @@ void Transition::initReduce_relaxed()
return
cost
;
return
cost
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initEOS
(
int
bufferIndex
)
void
Transition
::
initEOS
(
int
bufferIndex
)
...
@@ -529,6 +544,8 @@ void Transition::initEOS(int bufferIndex)
...
@@ -529,6 +544,8 @@ void Transition::initEOS(int bufferIndex)
return
0
;
return
0
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initDeprel
(
std
::
string
label
)
void
Transition
::
initDeprel
(
std
::
string
label
)
...
@@ -539,6 +556,8 @@ void Transition::initDeprel(std::string label)
...
@@ -539,6 +556,8 @@ void Transition::initDeprel(std::string label)
{
{
return
config
.
getConst
(
Config
::
deprelColName
,
config
.
getLastAttached
(),
0
)
==
label
?
0
:
1
;
return
config
.
getConst
(
Config
::
deprelColName
,
config
.
getLastAttached
(),
0
)
==
label
?
0
:
1
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initTransformSuffix
(
std
::
string
fromCol
,
std
::
string
fromObj
,
std
::
string
fromIndex
,
std
::
string
toCol
,
std
::
string
toObj
,
std
::
string
toIndex
,
std
::
string
rule
)
void
Transition
::
initTransformSuffix
(
std
::
string
fromCol
,
std
::
string
fromObj
,
std
::
string
fromIndex
,
std
::
string
toCol
,
std
::
string
toObj
,
std
::
string
toIndex
,
std
::
string
rule
)
...
@@ -576,6 +595,8 @@ void Transition::initTransformSuffix(std::string fromCol, std::string fromObj, s
...
@@ -576,6 +595,8 @@ void Transition::initTransformSuffix(std::string fromCol, std::string fromObj, s
return
1
;
return
1
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initUppercase
(
std
::
string
col
,
std
::
string
obj
,
std
::
string
index
)
void
Transition
::
initUppercase
(
std
::
string
col
,
std
::
string
obj
,
std
::
string
index
)
...
@@ -598,6 +619,8 @@ void Transition::initUppercase(std::string col, std::string obj, std::string ind
...
@@ -598,6 +619,8 @@ void Transition::initUppercase(std::string col, std::string obj, std::string ind
return
1
;
return
1
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initUppercaseIndex
(
std
::
string
col
,
std
::
string
obj
,
std
::
string
index
,
std
::
string
inIndex
)
void
Transition
::
initUppercaseIndex
(
std
::
string
col
,
std
::
string
obj
,
std
::
string
index
,
std
::
string
inIndex
)
...
@@ -623,6 +646,8 @@ void Transition::initUppercaseIndex(std::string col, std::string obj, std::strin
...
@@ -623,6 +646,8 @@ void Transition::initUppercaseIndex(std::string col, std::string obj, std::strin
return
1
;
return
1
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initLowercase
(
std
::
string
col
,
std
::
string
obj
,
std
::
string
index
)
void
Transition
::
initLowercase
(
std
::
string
col
,
std
::
string
obj
,
std
::
string
index
)
...
@@ -645,6 +670,8 @@ void Transition::initLowercase(std::string col, std::string obj, std::string ind
...
@@ -645,6 +670,8 @@ void Transition::initLowercase(std::string col, std::string obj, std::string ind
return
1
;
return
1
;
};
};
costStatic
=
costDynamic
;
}
}
void
Transition
::
initLowercaseIndex
(
std
::
string
col
,
std
::
string
obj
,
std
::
string
index
,
std
::
string
inIndex
)
void
Transition
::
initLowercaseIndex
(
std
::
string
col
,
std
::
string
obj
,
std
::
string
index
,
std
::
string
inIndex
)
...
@@ -670,6 +697,8 @@ void Transition::initLowercaseIndex(std::string col, std::string obj, std::strin
...
@@ -670,6 +697,8 @@ void Transition::initLowercaseIndex(std::string col, std::string obj, std::strin
return
1
;
return
1
;
};
};
costStatic
=
costDynamic
;
}
}
int
Transition
::
getNbLinkedWith
(
int
firstIndex
,
int
lastIndex
,
Config
::
Object
object
,
int
withIndex
,
const
Config
&
config
)
int
Transition
::
getNbLinkedWith
(
int
firstIndex
,
int
lastIndex
,
Config
::
Object
object
,
int
withIndex
,
const
Config
&
config
)
...
...
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