diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index a4faf74..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore index 90ec22b..2c430c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .svn +.DS_Store diff --git a/dees.xcodeproj/project.pbxproj b/dees.xcodeproj/project.pbxproj index 4fca345..02925d0 100644 --- a/dees.xcodeproj/project.pbxproj +++ b/dees.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 42; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -203,10 +203,19 @@ /* Begin PBXProject section */ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0800; + }; buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "dees" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + en, + ); mainGroup = 08FB7794FE84155DC02AAC07 /* dees */; projectDirPath = ""; + projectRoot = ""; targets = ( 8DD76F620486A84900D96B5E /* dees */, ); @@ -241,7 +250,6 @@ COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; INSTALL_PATH = "$(HOME)/bin"; LIBRARY_SEARCH_PATHS = ( @@ -249,6 +257,7 @@ "$(SRCROOT)/lib", ); PRODUCT_NAME = dees; + SDKROOT = macosx; ZERO_LINK = YES; }; name = Debug; @@ -256,38 +265,66 @@ 1DEB923308733DC60010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - ppc, - i386, - ); GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; INSTALL_PATH = "$(HOME)/bin"; LIBRARY_SEARCH_PATHS = ( "$(LIBRARY_SEARCH_PATHS)", "$(SRCROOT)/lib", ); PRODUCT_NAME = dees; + SDKROOT = macosx; }; name = Release; }; 1DEB923608733DC60010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; }; name = Debug; }; 1DEB923708733DC60010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; }; name = Release; }; diff --git a/dees.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/dees.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/dees.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/dees.xcodeproj/project.xcworkspace/xcuserdata/esposito.xcuserdatad/UserInterfaceState.xcuserstate b/dees.xcodeproj/project.xcworkspace/xcuserdata/esposito.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..0daa4dd Binary files /dev/null and b/dees.xcodeproj/project.xcworkspace/xcuserdata/esposito.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/dees.xcodeproj/xcuserdata/esposito.xcuserdatad/xcschemes/dees.xcscheme b/dees.xcodeproj/xcuserdata/esposito.xcuserdatad/xcschemes/dees.xcscheme new file mode 100644 index 0000000..86fb812 --- /dev/null +++ b/dees.xcodeproj/xcuserdata/esposito.xcuserdatad/xcschemes/dees.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dees.xcodeproj/xcuserdata/esposito.xcuserdatad/xcschemes/xcschememanagement.plist b/dees.xcodeproj/xcuserdata/esposito.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..9d162a5 --- /dev/null +++ b/dees.xcodeproj/xcuserdata/esposito.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + dees.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 8DD76F620486A84900D96B5E + + primary + + + + + diff --git a/general.H b/general.H index c5c308d..b459e90 100644 --- a/general.H +++ b/general.H @@ -18,16 +18,18 @@ #ifndef GENERAL_H #define GENERAL_H -using namespace std; + #include #include #include -//#include +#include //#include #include // pour cout << #include // pour fic << #include +using namespace std; + // ------------- pour le portage -------------- // pour compiler sur le ppc diff --git a/interface.H b/interface.H index b93f2aa..5785d8e 100644 --- a/interface.H +++ b/interface.H @@ -1,4 +1,4 @@ -#ifndef _INTERFACE_H +#ifndef INTERFACE_H #define INTERFACE_H #include "main.H" void Y(); diff --git a/interface.cpp b/interface.cpp index 0df2021..0fffc21 100644 --- a/interface.cpp +++ b/interface.cpp @@ -70,7 +70,7 @@ void proportion_PRFA() for (j = 0; j < nb_try; ++j) { A.becomeRandomMax(i,2,0,nb_moy_succ, 1, i); - taille_auto = A.size (); + taille_auto = (int) A.size (); if (taille_auto == (unsigned int) i) { if (A.isPFA ()) @@ -338,7 +338,7 @@ void Apprentissage_unique() string str; float tmp; float precision; - T_ModeReturn moderet=begin; + T_ModeReturn moderet=::begin; T_ModeEpsilon modeeps=epsfixed; int max_etats=INT_MAX; @@ -348,7 +348,7 @@ void Apprentissage_unique() cout << "1 - La precision .................. : " << precision << "\n"; cout << "2 - Le mode de retour ............. : " - << (moderet==begin?"begin":"end") << "\n"; + << (moderet==::begin?"begin":"end") << "\n"; cout << "3 - Le mode de gestion de epsilon . : " << (modeeps==epsfixed?"epsfixed": (modeeps==variable?"variable":"word_variable")) @@ -377,9 +377,9 @@ void Apprentissage_unique() cout << "mode de retour (begin|end|b|e) : "; cin >> str; if ((str=="end") || (str == "e")) - moderet=end; + moderet=::end; else - moderet=begin; + moderet=::begin; } else if (reponse == "3") { // mode de gestion de epsilon diff --git a/ma.H b/ma.H index f031814..ab45077 100644 --- a/ma.H +++ b/ma.H @@ -124,9 +124,9 @@ public: // true if the MA is empty inline bool empty() const {return Q.empty();} // return the size of the MA - inline unsigned int size () const {return Q.size ();} + inline unsigned long size () const {return Q.size ();} // return the number of letter of the MA - inline unsigned int nb_lettres () const {return Sigma.size ();} + inline unsigned long nb_lettres () const {return Sigma.size ();} // return safely iota[q] (even if iota[q]=0) inline float val_iota (const State q) const { SFunc::const_iterator i = iota.find (q); diff --git a/ma.cpp b/ma.cpp index ce68748..afaa2a1 100644 --- a/ma.cpp +++ b/ma.cpp @@ -249,7 +249,7 @@ MA::save_dot (const char *Filename, } ofstream fp (Filename); - if (fp == NULL) + if (!fp) { throw 1; } @@ -795,7 +795,7 @@ RESULT MA::load (const char *Filename) if (Filename == NULL) throw - 1; ifstream fp (Filename); - if (fp == NULL) + if (!fp) throw - 2; fp.precision (30); string buf; diff --git a/main.cpp b/main.cpp index ca1f36e..3f2f436 100644 --- a/main.cpp +++ b/main.cpp @@ -15,7 +15,6 @@ * * ***************************************************************************/ -using namespace std; #include "interface.H" #include "test.H" #include "main.H" @@ -72,7 +71,7 @@ bool viewmultipletransitions=false; // vrai pour ne plus regrouper les transitio bool interactive=false; // interactive mode // L'apprentissage -T_ModeReturn moderet = end; // Le mode de retour des arÍtes (end ou begin) +T_ModeReturn moderet = ::end; // Le mode de retour des arÍtes (end ou begin) T_ModeEpsilon modeeps = variable; // Le mode d'apprentissage avec epsilon fixe ou variable (epsfixed ou variable) float test_proportion = 0.2; // la proportion de l'echantillon attribuee au test int nb_tours = 100; // Le nombre d'itÈrations pour Baum Welch @@ -590,7 +589,7 @@ void affiche_PSe(void) { cout << "res = " << res << endl; for (q=PSe.begin() ; q != PSe.end() ; q++) { - cout << "P_" << q->first << "(\Se) = " << q-> second << endl; + cout << "P_" << q->first << "(\\Se) = " << q-> second << endl; } } @@ -713,9 +712,9 @@ initialise_arguments (int argc, char *argv[]) { arg = argv[++i]; if (arg == "begin") - moderet = begin; + moderet = ::begin; else - moderet = end; + moderet = ::end; } else if (arg == "--modeeps") { @@ -1321,4 +1320,4 @@ main (int argc, char *argv[]) affiche_utilisation (); return -1; } -} \ No newline at end of file +} diff --git a/pfa.cpp b/pfa.cpp index 23f081f..c8cab2e 100644 --- a/pfa.cpp +++ b/pfa.cpp @@ -340,7 +340,7 @@ PFA::perplexite (const Sample & S) const res = sum = 0; for (w = S.begin (); w != S.end (); S.next (w)) { - res += log (r(w->first)) * w->second; + res += log (p(w->first)) * w->second; sum += w->second; } } diff --git a/pprfa.H b/pprfa.H index 723f9f7..1bb8beb 100644 --- a/pprfa.H +++ b/pprfa.H @@ -26,7 +26,6 @@ #include "pfa.H" #include "simplex.H" - typedef enum {determinist, positive, nonconstrained} T_ModeVariables; typedef enum {begin, end} T_ModeReturn; typedef enum {epsfixed, variable, word_variable} T_ModeEpsilon; @@ -130,7 +129,7 @@ public: const double prec, // The precision parameter const double epsprime, // The bound under which transition are erased const bool verbose = false, // verbose mode (show the states during construction) - const T_ModeReturn moderet = end, // return mode (end of the tree or begin of the tree) + const T_ModeReturn moderet = ::end, // return mode (end of the tree or begin of the tree) const T_ModeEpsilon modeeps = variable, // epsilon mode (epsfixed or variable) unsigned int maxstates = INT_MAX, // The maximal states number after which learning is cancelled unsigned int seuil=10, // La periodicitÈ minimum avant de ne plus considÈrer l'Ètat @@ -175,5 +174,4 @@ protected: RESULT compute_XR(void); }; - #endif diff --git a/pprfa_dees.cpp b/pprfa_dees.cpp index 871b0ce..56c8224 100644 --- a/pprfa_dees.cpp +++ b/pprfa_dees.cpp @@ -42,10 +42,10 @@ PPRFA::DEES (T_ModeVariables modeVariables, cout << "\nmoderet = "; switch (moderet) { - case begin: + case ::begin: cout << "begin"; break; - case end: + case ::end: cout << "end"; } cout << "\nmodeeps = "; @@ -533,4 +533,4 @@ RESULT PPRFA::sol (T_ModeVariables modeVariables, // le mode dans lequel renvoye return solmax (modeVariables,solution, v, S, simplx,precision, moderet, modeeps, W, INT_MAX); } */ -} \ No newline at end of file +} diff --git a/sample.H b/sample.H index 55eb8e8..2bcb30e 100644 --- a/sample.H +++ b/sample.H @@ -105,7 +105,7 @@ public: return S; } // Renvoie le nombre de mots contenus dans S (pour la fct precision) - inline unsigned int nb_mots() const + inline unsigned long nb_mots() const { return S.size(); } diff --git a/sample.cpp b/sample.cpp index 04d790b..6d7ddfd 100644 --- a/sample.cpp +++ b/sample.cpp @@ -475,7 +475,7 @@ RESULT Sample::load (const char *Filename) break; default: - cerr << "Erreur non repertorie" << endl; + cerr << "Erreur non repertoriee" << endl; } } return e; diff --git a/test.cpp b/test.cpp index f593bfb..0413f3a 100644 --- a/test.cpp +++ b/test.cpp @@ -25,7 +25,7 @@ void test_PSe(void) { cout << "res = " << res << endl; for (q=PSe.begin() ; q != PSe.end() ; q++) { - cout << "P_" << q->first << "(\Se) = " << q-> second << endl; + cout << "P_" << q->first << "(\\Se) = " << q-> second << endl; } }