[marf-cvs] marf/src/marf MARF.java,1.94,1.95
Brought to you by:
mokhov
From: Serguei A. M. <mo...@us...> - 2006-01-29 22:28:29
|
Update of /cvsroot/marf/marf/src/marf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13994/marf/src/marf Modified Files: MARF.java Log Message: Renumber NLP-related enumerations so that they don't have possible conflicts with typical option processing and the rest of MARF as it was earlier done for the preprocessing, feature, extraction, classification, sample formats, etc. Rename INgramModels to ENgramModels and IStatisticalEstimators to EStatisticalEstimators to indicate that these are just enumerations. When we migrate to Java 1.5 these interfaces will be replaced by the enums anyways, so the name can be changed now. Since these members are unlikely to be used by external apps since 0.3.0.2 the name change impact should be miminal and our own NLP apps that use these are only to be released for the first time anyway. Mark the remaining methods of MARF.NLP as `synchronized'. Index: MARF.java =================================================================== RCS file: /cvsroot/marf/marf/src/marf/MARF.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** MARF.java 14 Jan 2006 19:06:19 -0000 1.94 --- MARF.java 29 Jan 2006 22:28:21 -0000 1.95 *************** *** 1278,1361 **** /** ! * Enumeration of Statistical Estimators. * * @author Serguei Mokhov * @since 0.3.0.2 */ ! public interface IStatisticalEstimators { /** * Indicates to use Maximum Likelyhood Estimate estimator/smoothing. */ ! public static final int MLE = 0; /** * Indicates to use Add One estimator/smoothing. */ ! public static final int ADD_ONE = 16; /** * Indicates to use Add Delta estimator/smoothing. */ ! public static final int ADD_DELTA = 17; /** * Indicates to use Witten-Bell estimator/smoothing. */ ! public static final int WITTEN_BELL = 4; /** * Indicates to use Good-Turing estimator/smoothing. */ ! public static final int GOOD_TURING = 5; /** * Indicates to use SLI estimator/smoothing. */ ! public static final int SLI = 6; /** * Indicates to use GLI estimator/smoothing. */ ! public static final int GLI = 7; /** * Indicates to use Katz Backoff estimator/smoothing. */ ! public static final int KATZ_BACKOFF = 8; } /** ! * Enumeration of N-gram Models. * * @author Serguei Mokhov * @since 0.3.0.2 */ ! public interface INgramModels { /** * Indicates to use unigram language model. */ ! public static final int UNIGRAM = 1; /** * Indicates to use bigram language model. */ ! public static final int BIGRAM = 2; /** * Indicates to use trigram language model. */ ! public static final int TRIGRAM = 3; /** * Indicates to use n-gram language model. */ ! public static final int NGRAM = 19; } /** ! * Class NLP is more related to the Natural Language Processing ! * part of MARF. * * @author Serguei Mokhov --- 1278,1367 ---- /** ! * <p>Enumeration of Statistical Estimators. ! * In 0.3.0.5 renamed from <code>IStatisticalEstimators</code> to ! * <code>EStatisticalEstimators</code>. ! * </p> * * @author Serguei Mokhov * @since 0.3.0.2 */ ! public interface EStatisticalEstimators { /** * Indicates to use Maximum Likelyhood Estimate estimator/smoothing. */ ! public static final int MLE = 800; /** * Indicates to use Add One estimator/smoothing. */ ! public static final int ADD_ONE = 801; /** * Indicates to use Add Delta estimator/smoothing. */ ! public static final int ADD_DELTA = 802; /** * Indicates to use Witten-Bell estimator/smoothing. */ ! public static final int WITTEN_BELL = 803; /** * Indicates to use Good-Turing estimator/smoothing. */ ! public static final int GOOD_TURING = 804; /** * Indicates to use SLI estimator/smoothing. */ ! public static final int SLI = 805; /** * Indicates to use GLI estimator/smoothing. */ ! public static final int GLI = 806; /** * Indicates to use Katz Backoff estimator/smoothing. */ ! public static final int KATZ_BACKOFF = 807; } /** ! * <p>Enumeration of N-gram Models. ! * In 0.3.0.5 renamed from <code>INgramModels</code> to ! * <code>ENgramModels</code>. ! * </p> * * @author Serguei Mokhov * @since 0.3.0.2 */ ! public interface ENgramModels { /** * Indicates to use unigram language model. */ ! public static final int UNIGRAM = 900; /** * Indicates to use bigram language model. */ ! public static final int BIGRAM = 901; /** * Indicates to use trigram language model. */ ! public static final int TRIGRAM = 902; /** * Indicates to use n-gram language model. */ ! public static final int NGRAM = 903; } /** ! * <p>Class NLP is more related to the Natural Language Processing ! * part of MARF.</p> * * @author Serguei Mokhov *************** *** 1367,1435 **** * Indicates to use stemming module. */ ! public static final int STEMMING = 9; /** * Indicates to use case-sesitive processing of text. */ ! public static final int CASE_SENSITIVE = 10; /** * When parsing text, also parse numbers as tokens. */ ! public static final int PARSE_NUMBERS = 11; /** * When parsing text, also parse quoted literals. */ ! public static final int PARSE_QUOTED_STRINGS = 12; /** * When parsing text, also parse typical ends of sentences. */ ! public static final int PARSE_ENDS_OF_SENTENCE = 13; /** * Perform a raw dump of Zipf's Law data. */ ! public static final int RAW_ZIPFS_LAW_DUMP = 14; /** * Work in character mode. */ ! public static final int CHARACTER_MODE = 15; /** * Action to train a classifier. */ ! public static final int TRAIN = 20; /** * Action to perform a classification task. */ ! public static final int CLASSIFY = 21; /** * Use interactive mode. */ ! public static final int INTERACTIVE = 22; /** * When classifying, cheat with Zipf's Law implementation. */ ! public static final int ZIPFS_LAW_CHEAT = 23; /** * Current smoothing method. * Default is MLE. ! * @see IStatisticalEstimators#MLE */ ! private static int siSmoothingMethod = IStatisticalEstimators.MLE; /** * Current N-gram model. * Default is BIGRAM. ! * @see INgramModels#BIGRAM */ ! private static int siNgramModel = INgramModels.BIGRAM; /** --- 1373,1441 ---- * Indicates to use stemming module. */ ! public static final int STEMMING = 1000; /** * Indicates to use case-sesitive processing of text. */ ! public static final int CASE_SENSITIVE = 1001; /** * When parsing text, also parse numbers as tokens. */ ! public static final int PARSE_NUMBERS = 1002; /** * When parsing text, also parse quoted literals. */ ! public static final int PARSE_QUOTED_STRINGS = 1003; /** * When parsing text, also parse typical ends of sentences. */ ! public static final int PARSE_ENDS_OF_SENTENCE = 1004; /** * Perform a raw dump of Zipf's Law data. */ ! public static final int RAW_ZIPFS_LAW_DUMP = 1005; /** * Work in character mode. */ ! public static final int CHARACTER_MODE = 1006; /** * Action to train a classifier. */ ! public static final int TRAIN = 1007; /** * Action to perform a classification task. */ ! public static final int CLASSIFY = 1008; /** * Use interactive mode. */ ! public static final int INTERACTIVE = 1009; /** * When classifying, cheat with Zipf's Law implementation. */ ! public static final int ZIPFS_LAW_CHEAT = 1010; /** * Current smoothing method. * Default is MLE. ! * @see EStatisticalEstimators#MLE */ ! private static int siSmoothingMethod = EStatisticalEstimators.MLE; /** * Current N-gram model. * Default is BIGRAM. ! * @see ENgramModels#BIGRAM */ ! private static int siNgramModel = ENgramModels.BIGRAM; /** *************** *** 1452,1456 **** * @param piSmoothingMethod new smoothing method to use */ ! public static void setSmoothingMethod(final int piSmoothingMethod) { siSmoothingMethod = piSmoothingMethod; --- 1458,1462 ---- * @param piSmoothingMethod new smoothing method to use */ ! public static synchronized void setSmoothingMethod(final int piSmoothingMethod) { siSmoothingMethod = piSmoothingMethod; *************** *** 1479,1483 **** * @return inner smoothing method */ ! public static String getLanguage() { return sstrLanguage; --- 1485,1489 ---- * @return inner smoothing method */ ! public static synchronized String getLanguage() { return sstrLanguage; *************** *** 1488,1492 **** * @param pstrLanguages new language value */ ! public static void setLanguage(String pstrLanguages) { sstrLanguage = pstrLanguages; --- 1494,1498 ---- * @param pstrLanguages new language value */ ! public static synchronized void setLanguage(String pstrLanguages) { sstrLanguage = pstrLanguages; |