Commit f72d730b authored by Cocophotos's avatar Cocophotos

Merge branch 'release/1.0.3'

parents dc728846 ed3ce1b0
......@@ -34,6 +34,7 @@ bool OGRE::init( int argc, char* argv[] )
m_mode = ogreOptions->exists("no-rewriting") ? NOTHING : REWRITING;
m_mode = ogreOptions->exists("extraction") ? EXTRACTION : m_mode;
m_mode = ogreOptions->exists("tag") ? TAGGING : m_mode;
return true;
}catch(std::exception &e){
......@@ -232,7 +233,7 @@ void OGRE::rewrite(string outputDir)
}
rewriting = m_rewriter->rewrite(s, result, m_compiler);
}
else if(m_mode == EXTRACTION)
else if(m_mode == EXTRACTION || m_mode == TAGGING)
{
if(verbose >= DEBUG)
{
......@@ -241,7 +242,7 @@ void OGRE::rewrite(string outputDir)
std::string sentid = s->nodeProperties(it->second).feature("sentid");
std::cerr << "Extracting patterns from sentence " << sentid << std::endl;
}
m_rewriter->extract(s, patterns, m_compiler);
m_rewriter->extract(s, patterns, m_compiler, m_mode == TAGGING);
}
/*
......@@ -265,7 +266,7 @@ void OGRE::rewrite(string outputDir)
}
}
if(m_mode == EXTRACTION)
if(m_mode == EXTRACTION || m_mode == TAGGING)
{
if(verbose >= DEBUG)
std::cerr << "Producing patterns" << std::endl;
......@@ -277,6 +278,13 @@ void OGRE::rewrite(string outputDir)
std::cerr << "Unable to produce extracted pattern...";
delete p; p = NULL;
}
if(patterns.size() == 0 && ogreOptions->exists("force-output"))
{
if(!saveNewGraph(s, outputDir))
std::cerr << "Unable to output the sentence..." << std::endl;
}
patterns.clear();
}
}
......
......@@ -21,7 +21,7 @@ using namespace std;
class OGRE
{
public:
enum Mode{REWRITING=1, NOTHING, EXTRACTION};
enum Mode{REWRITING=1, NOTHING, EXTRACTION, TAGGING};
OGRE();
~OGRE();
......
......@@ -27,6 +27,7 @@ void CLIOptions::addGeneralOptions()
("force-output,p", "Force an output, even though nothing has been rewritten")
("no-rewriting,n", "Print the sentences where rules can be applied only.")
("extraction,e", "Extract patterns from rules.")
("tag,T", "Tag found patterns in sentences.")
;
options.add( desc );
}
Markdown is supported
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