Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
qparse
qparselib
Commits
d4661ecc
Commit
d4661ecc
authored
Mar 09, 2021
by
Florent Jacquemard
Browse files
target equiv2 : option -o : write [trees] to file
parent
61f5e3cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/targets/equiv/equiv2.cpp
View file @
d4661ecc
...
...
@@ -713,17 +713,24 @@ int main(int argc, char** argv)
tab
->
best
(
k0
,
k
);
// fill table up to k-best
INFO
(
"time to parse : {}ms"
,
util
::
duration
(
time_start
));
LabeledRhythmTree
*
t
=
LRTFactory
<
Parsing
::
KeyQ
>::
best
(
tab
,
k0
);
assert
(
t
);
INFO
(
"Ouput tree : {}"
,
*
t
);
if
(
f_output
&&
(
_output_file
.
size
()
==
0
))
{
ERROR
(
"empty output file name"
);
return
(
1
);
}
LabeledRhythmTree
*
t
=
LRTFactory
<
Parsing
::
KeyQ
>::
best
(
tab
,
k0
);
assert
(
t
);
INFO
(
"Ouput tree : {}"
,
*
t
);
t
->
write
(
std
::
cout
);
if
(
f_output
)
{
INFO
(
"export trees to file {}"
,
_output_file
);
size_t
err
=
t
->
write
(
_output_file
);
if
(
err
>
0
)
ERROR
(
"export failed"
);
}
return
0
;
}
src/trees/LRT.hpp
View file @
d4661ecc
...
...
@@ -149,12 +149,12 @@ public:
/// pretty-print this tree in the given output stream
virtual
void
print
(
std
::
ostream
&
o
)
const
;
virtual
std
::
string
to_string
()
const
;
/// write a raw serial representation of this tree in the given file
size_t
save
(
const
std
::
string
filename
)
const
;
/// raw print this tree in the given output stream, 1 line per bar.
virtual
void
write
(
std
::
ostream
&
o
)
const
;
/// write a raw serial representation of this tree in the given file
size_t
write
(
const
std
::
string
filename
)
const
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
LabeledRhythmTree
&
);
...
...
src/trees/export/LRTFileOut.cpp
View file @
d4661ecc
...
...
@@ -13,7 +13,7 @@
#include
"LRT.hpp"
size_t
LabeledRhythmTree
::
sav
e
(
const
std
::
string
filename
)
const
size_t
LabeledRhythmTree
::
writ
e
(
const
std
::
string
filename
)
const
{
std
::
ofstream
file
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment