Commit d4661ecc authored by Florent Jacquemard's avatar Florent Jacquemard
Browse files

target equiv2 : option -o : write [trees] to file

parent 61f5e3cb
......@@ -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;
}
......@@ -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&);
......
......@@ -13,7 +13,7 @@
#include "LRT.hpp"
size_t LabeledRhythmTree::save(const std::string filename) const
size_t LabeledRhythmTree::write(const std::string filename) const
{
std::ofstream file;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment