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
7e8b84ee
Commit
7e8b84ee
authored
4 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Made sentid into an extra column
parent
23b452ce
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
reading_machine/include/Config.hpp
+2
-0
2 additions, 0 deletions
reading_machine/include/Config.hpp
reading_machine/src/BaseConfig.cpp
+7
-19
7 additions, 19 deletions
reading_machine/src/BaseConfig.cpp
reading_machine/src/Config.cpp
+15
-3
15 additions, 3 deletions
reading_machine/src/Config.cpp
with
24 additions
and
22 deletions
reading_machine/include/Config.hpp
+
2
−
0
View file @
7e8b84ee
...
...
@@ -56,6 +56,7 @@ class Config
String
state
{
"NONE"
};
boost
::
circular_buffer
<
String
>
history
{
10
};
boost
::
circular_buffer
<
std
::
size_t
>
stack
{
50
};
std
::
vector
<
std
::
string
>
extraColumns
{
isMultiColName
,
childsColName
,
sentIdColName
,
EOSColName
};
protected
:
...
...
@@ -145,6 +146,7 @@ class Config
void
addComment
();
void
setAppliableSplitTransitions
(
const
std
::
vector
<
Transition
*>
&
appliableSplitTransitions
);
const
std
::
vector
<
Transition
*>
&
getAppliableSplitTransitions
()
const
;
bool
isExtraColumn
(
const
std
::
string
&
colName
)
const
;
};
#endif
This diff is collapsed.
Click to expand it.
reading_machine/src/BaseConfig.cpp
+
7
−
19
View file @
7e8b84ee
...
...
@@ -28,25 +28,13 @@ void BaseConfig::readMCD(std::string_view mcdFilename)
std
::
fclose
(
file
);
if
(
colName2Index
.
count
(
isMultiColName
))
util
::
myThrow
(
fmt
::
format
(
"mcd '{}' must not contain column '{}'"
,
mcdFilename
,
isMultiColName
));
colIndex2Name
.
emplace_back
(
isMultiColName
);
colName2Index
.
emplace
(
isMultiColName
,
colIndex2Name
.
size
()
-
1
);
if
(
colName2Index
.
count
(
childsColName
))
util
::
myThrow
(
fmt
::
format
(
"mcd '{}' must not contain column '{}'"
,
mcdFilename
,
childsColName
));
colIndex2Name
.
emplace_back
(
childsColName
);
colName2Index
.
emplace
(
childsColName
,
colIndex2Name
.
size
()
-
1
);
if
(
colName2Index
.
count
(
sentIdColName
))
util
::
myThrow
(
fmt
::
format
(
"mcd '{}' must not contain column '{}'"
,
mcdFilename
,
sentIdColName
));
colIndex2Name
.
emplace_back
(
sentIdColName
);
colName2Index
.
emplace
(
sentIdColName
,
colIndex2Name
.
size
()
-
1
);
if
(
colName2Index
.
count
(
EOSColName
))
util
::
myThrow
(
fmt
::
format
(
"mcd '{}' must not contain column '{}'"
,
mcdFilename
,
EOSColName
));
colIndex2Name
.
emplace_back
(
EOSColName
);
colName2Index
.
emplace
(
EOSColName
,
colIndex2Name
.
size
()
-
1
);
for
(
auto
&
column
:
extraColumns
)
{
if
(
colName2Index
.
count
(
column
))
util
::
myThrow
(
fmt
::
format
(
"mcd '{}' must not contain column '{}'"
,
mcdFilename
,
column
));
colIndex2Name
.
emplace_back
(
column
);
colName2Index
.
emplace
(
column
,
colIndex2Name
.
size
()
-
1
);
}
}
void
BaseConfig
::
readRawInput
(
std
::
string_view
rawFilename
)
...
...
This diff is collapsed.
Click to expand it.
reading_machine/src/Config.cpp
+
15
−
3
View file @
7e8b84ee
...
...
@@ -98,7 +98,7 @@ void Config::print(FILE * dest) const
}
for
(
unsigned
int
i
=
0
;
i
<
getNbColumns
()
-
1
;
i
++
)
{
if
(
getColName
(
i
)
==
isMultiColName
or
getColName
(
i
)
=
=
childs
ColName
)
if
(
isExtraColumn
(
getColName
(
i
))
and
getColName
(
i
)
!
=
EOS
ColName
)
{
if
(
i
==
getNbColumns
()
-
2
)
currentSequence
.
back
().
back
()
=
'\n'
;
...
...
@@ -146,7 +146,7 @@ void Config::printForDebug(FILE * dest) const
toPrint
.
back
().
emplace_back
(
""
);
for
(
unsigned
int
i
=
0
;
i
<
getNbColumns
();
i
++
)
{
if
(
getColName
(
i
)
==
isMultiColName
or
getColName
(
i
)
=
=
childs
ColName
)
if
(
isExtraColumn
(
getColName
(
i
))
and
getColName
(
i
)
!
=
EOS
ColName
)
continue
;
toPrint
.
back
().
emplace_back
(
getColName
(
i
));
}
...
...
@@ -159,7 +159,7 @@ void Config::printForDebug(FILE * dest) const
toPrint
.
back
().
emplace_back
(
line
==
(
int
)
wordIndex
?
"=>"
:
""
);
for
(
unsigned
int
i
=
0
;
i
<
getNbColumns
();
i
++
)
{
if
(
getColName
(
i
)
==
isMultiColName
or
getColName
(
i
)
=
=
childs
ColName
)
if
(
isExtraColumn
(
getColName
(
i
))
and
getColName
(
i
)
!
=
EOS
ColName
)
continue
;
std
::
string
colContent
=
has
(
i
,
line
,
0
)
?
getAsFeature
(
i
,
line
).
get
()
:
"?"
;
std
::
string
toPrintCol
=
colContent
;
...
...
@@ -563,6 +563,10 @@ void Config::addPredicted(const std::set<std::string> & predicted)
util
::
myThrow
(
fmt
::
format
(
"unknown column '{}'"
,
col
));
this
->
predicted
.
insert
(
col
);
}
for
(
auto
&
col
:
extraColumns
)
if
(
col
!=
EOSColName
)
this
->
predicted
.
insert
(
col
);
}
bool
Config
::
isPredicted
(
const
std
::
string
&
colName
)
const
...
...
@@ -674,3 +678,11 @@ Config::Object Config::str2object(const std::string & s)
return
Object
::
Buffer
;
}
bool
Config
::
isExtraColumn
(
const
std
::
string
&
colName
)
const
{
for
(
auto
&
extraCol
:
extraColumns
)
if
(
extraCol
==
colName
)
return
true
;
return
false
;
}
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