PLearn 0.1
generate_ontology.cc
Go to the documentation of this file.
00001 #include <plearn_learners/language/WordNet/WordNetOntology.h>
00002 #include <plearn/base/stringutils.h>    
00003 
00004 using namespace PLearn;
00005 
00006 int main(int argc, char** argv)
00007 {
00008     if (argc != 7)
00009         PLERROR("usage : generate_ontology {load | extract} voc synset ontology diff_unk print");
00010     bool load = (tostring(argv[1]) == "load");
00011     string voc_file = tostring(argv[2]);
00012     string synset_file = tostring(argv[3]);
00013     string ontology_file = tostring(argv[4]);
00014     bool diff_unk = tobool(argv[5]);
00015     bool print = tobool(argv[6]);
00016     WordNetOntology* ontology;
00017     if (load)
00018     {
00019         ontology = new WordNetOntology(voc_file, synset_file, ontology_file, false, true);
00020     } else
00021     {
00022         ontology = new WordNetOntology(voc_file, diff_unk, false, false);
00023         ontology->save(synset_file, ontology_file);
00024     }
00025 
00026     ontology->detectWordsWithoutOntology();
00027 
00028     //ontology->extractWordHighLevelSenses(1, 1, 0, 0, 0);
00029 
00030     if (print)
00031         ontology->print(true);
00032 
00033     ontology->printStats();
00034 
00035     return 0;
00036 }
00037 
00038 
00039 /*
00040   Local Variables:
00041   mode:c++
00042   c-basic-offset:4
00043   c-file-style:"stroustrup"
00044   c-file-offsets:((innamespace . 0)(inline-open . 0))
00045   indent-tabs-mode:nil
00046   fill-column:79
00047   End:
00048 */
00049 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines