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
ffca1378
Commit
ffca1378
authored
4 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Fixed filing of columns rawRange
parent
9cd10b96
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
reading_machine/src/Action.cpp
+9
-6
9 additions, 6 deletions
reading_machine/src/Action.cpp
reading_machine/src/Transition.cpp
+4
-0
4 additions, 0 deletions
reading_machine/src/Transition.cpp
with
13 additions
and
6 deletions
reading_machine/src/Action.cpp
+
9
−
6
View file @
ffca1378
...
@@ -80,9 +80,6 @@ Action Action::consumeCharacterIndex(const util::utf8string & consumed)
...
@@ -80,9 +80,6 @@ Action Action::consumeCharacterIndex(const util::utf8string & consumed)
{
{
auto
apply
=
[
consumed
](
Config
&
config
,
Action
&
)
auto
apply
=
[
consumed
](
Config
&
config
,
Action
&
)
{
{
config
.
getLastNotEmptyHyp
(
Config
::
rawRangeStartColName
,
config
.
getWordIndex
())
=
fmt
::
format
(
"{}"
,
config
.
getCharacterIndex
());
config
.
getLastNotEmptyHyp
(
Config
::
rawRangeEndColName
,
config
.
getWordIndex
())
=
fmt
::
format
(
"{}"
,
config
.
getCharacterIndex
()
+
consumed
.
size
());
config
.
moveCharacterIndex
(
consumed
.
size
());
config
.
moveCharacterIndex
(
consumed
.
size
());
};
};
...
@@ -586,8 +583,7 @@ Action Action::addCharsToCol(const std::string & col, int n, Config::Object obje
...
@@ -586,8 +583,7 @@ Action Action::addCharsToCol(const std::string & col, int n, Config::Object obje
{
{
if
(
util
::
isEmpty
(
config
.
getAsFeature
(
Config
::
rawRangeStartColName
,
index
)))
if
(
util
::
isEmpty
(
config
.
getAsFeature
(
Config
::
rawRangeStartColName
,
index
)))
config
.
getLastNotEmptyHyp
(
Config
::
rawRangeStartColName
,
index
)
=
fmt
::
format
(
"{}"
,
config
.
getCharacterIndex
());
config
.
getLastNotEmptyHyp
(
Config
::
rawRangeStartColName
,
index
)
=
fmt
::
format
(
"{}"
,
config
.
getCharacterIndex
());
if
(
util
::
isEmpty
(
config
.
getAsFeature
(
Config
::
rawRangeEndColName
,
index
)))
config
.
getLastNotEmptyHyp
(
Config
::
rawRangeEndColName
,
index
)
=
fmt
::
format
(
"{}"
,
config
.
getCharacterIndex
());
config
.
getLastNotEmptyHyp
(
Config
::
rawRangeEndColName
,
index
)
=
fmt
::
format
(
"{}"
,
config
.
getCharacterIndex
());
int
curEndValue
=
std
::
stoi
(
config
.
getAsFeature
(
Config
::
rawRangeEndColName
,
index
));
int
curEndValue
=
std
::
stoi
(
config
.
getAsFeature
(
Config
::
rawRangeEndColName
,
index
));
config
.
getLastNotEmptyHyp
(
Config
::
rawRangeEndColName
,
index
)
=
fmt
::
format
(
"{}"
,
curEndValue
+
n
);
config
.
getLastNotEmptyHyp
(
Config
::
rawRangeEndColName
,
index
)
=
fmt
::
format
(
"{}"
,
curEndValue
+
n
);
}
}
...
@@ -753,8 +749,15 @@ Action Action::updateIds(int bufferIndex)
...
@@ -753,8 +749,15 @@ Action Action::updateIds(int bufferIndex)
if
(
config
.
has
(
0
,
firstIndexOfSentence
,
0
))
if
(
config
.
has
(
0
,
firstIndexOfSentence
,
0
))
{
{
std
::
string
textMetadata
=
"# text = "
;
std
::
string
textMetadata
=
"# text = "
;
for
(
auto
i
=
std
::
stoi
(
config
.
getAsFeature
(
Config
::
rawRangeStartColName
,
firstIndexOfSentence
));
i
<
std
::
stoi
(
config
.
getAsFeature
(
Config
::
rawRangeEndColName
,
lineIndex
));
i
++
)
int
firstIndex
=
0
;
int
lastIndex
=
0
;
try
{
firstIndex
=
std
::
stoi
(
config
.
getAsFeature
(
Config
::
rawRangeStartColName
,
firstIndexOfSentence
));}
catch
(
std
::
exception
&
e
)
{
util
::
myThrow
(
fmt
::
format
(
"{} : '{}'"
,
e
.
what
(),
config
.
getAsFeature
(
Config
::
rawRangeStartColName
,
firstIndexOfSentence
)));}
try
{
lastIndex
=
std
::
stoi
(
config
.
getAsFeature
(
Config
::
rawRangeEndColName
,
lineIndex
));}
catch
(
std
::
exception
&
e
)
{
util
::
myThrow
(
fmt
::
format
(
"{} : '{}'"
,
e
.
what
(),
config
.
getAsFeature
(
Config
::
rawRangeEndColName
,
lineIndex
)));}
for
(
auto
i
=
firstIndex
;
i
<
lastIndex
;
i
++
)
textMetadata
=
fmt
::
format
(
"{}{}"
,
textMetadata
,
config
.
getLetter
(
i
));
textMetadata
=
fmt
::
format
(
"{}{}"
,
textMetadata
,
config
.
getLetter
(
i
));
config
.
getLastNotEmptyHyp
(
Config
::
commentsColName
,
firstIndexOfSentence
)
=
fmt
::
format
(
"{}
\n
# sent_id = {}"
,
textMetadata
,
config
.
getAsFeature
(
Config
::
sentIdColName
,
firstIndexOfSentence
));
config
.
getLastNotEmptyHyp
(
Config
::
commentsColName
,
firstIndexOfSentence
)
=
fmt
::
format
(
"{}
\n
# sent_id = {}"
,
textMetadata
,
config
.
getAsFeature
(
Config
::
sentIdColName
,
firstIndexOfSentence
));
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
reading_machine/src/Transition.cpp
+
4
−
0
View file @
ffca1378
...
@@ -317,7 +317,11 @@ void Transition::initSplitWord(std::vector<std::string> words)
...
@@ -317,7 +317,11 @@ void Transition::initSplitWord(std::vector<std::string> words)
sequence
.
emplace_back
(
Action
::
addCharsToCol
(
"FORM"
,
consumedWord
.
size
(),
Config
::
Object
::
Buffer
,
0
));
sequence
.
emplace_back
(
Action
::
addCharsToCol
(
"FORM"
,
consumedWord
.
size
(),
Config
::
Object
::
Buffer
,
0
));
sequence
.
emplace_back
(
Action
::
consumeCharacterIndex
(
consumedWord
));
sequence
.
emplace_back
(
Action
::
consumeCharacterIndex
(
consumedWord
));
for
(
unsigned
int
i
=
1
;
i
<
words
.
size
();
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
words
.
size
();
i
++
)
{
sequence
.
emplace_back
(
Action
::
addHypothesisRelativeRelaxed
(
"FORM"
,
Config
::
Object
::
Buffer
,
i
,
words
[
i
]));
sequence
.
emplace_back
(
Action
::
addHypothesisRelativeRelaxed
(
"FORM"
,
Config
::
Object
::
Buffer
,
i
,
words
[
i
]));
sequence
.
emplace_back
(
Action
::
transformSuffix
(
Config
::
rawRangeStartColName
,
Config
::
Object
::
Buffer
,
0
,
Config
::
rawRangeStartColName
,
Config
::
Object
::
Buffer
,
i
,
util
::
utf8string
(),
util
::
utf8string
()));
sequence
.
emplace_back
(
Action
::
transformSuffix
(
Config
::
rawRangeEndColName
,
Config
::
Object
::
Buffer
,
0
,
Config
::
rawRangeEndColName
,
Config
::
Object
::
Buffer
,
i
,
util
::
utf8string
(),
util
::
utf8string
()));
}
sequence
.
emplace_back
(
Action
::
setMultiwordIds
(
words
.
size
()
-
1
));
sequence
.
emplace_back
(
Action
::
setMultiwordIds
(
words
.
size
()
-
1
));
costDynamic
=
[
words
](
const
Config
&
config
)
costDynamic
=
[
words
](
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