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 }