diff --git a/scripts/train_test_parser.sh b/scripts/train_test_parser.sh index 1624a0a..d567421 100755 --- a/scripts/train_test_parser.sh +++ b/scripts/train_test_parser.sh @@ -15,7 +15,7 @@ regularization_parameter_pruner=1e12 # Same for the pruner. train=true test=true prune=true # This will revert to false if model_type=basic. -train_external_pruner=true #false # If true, the pruner is trained separately. +train_external_pruner=false # If true, the pruner is trained separately. posterior_threshold=0.0001 # Posterior probability threshold for the pruner. pruner_max_heads=10 # Maximum number of candidate heads allowed by the pruner. labeled=true # Output dependency labels. @@ -23,7 +23,7 @@ large_feature_set=true # Use a large feature set (slower but more accurate). case_sensitive=false # Distinguish word upper/lower case. form_cutoff=0 # Cutoff in word occurrence. lemma_cutoff=0 # Cutoff in lemma occurrence. -projective=true # Force single-rooted projective trees. +projective=false # If true, force single-rooted projective trees. model_type=standard # Parts used in the model (subset of "af+cs+gp+as+hb+np+dp+gs+ts"). # Some shortcuts are: "standard" (means "af+cs+gp"); # "basic" (means "af"); and "full" (means "af+cs+gp+as+hb+gs+ts"). diff --git a/scripts_srl/train_test_semantic_parser.sh b/scripts_srl/train_test_semantic_parser.sh index 0cbf472..0dc854c 100755 --- a/scripts_srl/train_test_semantic_parser.sh +++ b/scripts_srl/train_test_semantic_parser.sh @@ -17,8 +17,8 @@ test=true prune=true # This will revert to false if model_type=basic. prune_labels=true prune_distances=true -train_external_pruner=false #false # If true, the pruner is trained separately. -trained_external_pruner=true #false # If true, loads the external pruner. +train_external_pruner=false # If true, the pruner is trained separately. +trained_external_pruner=false # If true, loads the external pruner. posterior_threshold=0.0001 # Posterior probability threshold for the pruner. pruner_max_arguments=20 #10 # Maximum number of candidate heads allowed by the pruner. labeled=true # Output semantic labels. diff --git a/src/semantic_parser/FactorPredicateAutomaton.h b/src/semantic_parser/FactorPredicateAutomaton.h index d34b6f2..6d6a61d 100644 --- a/src/semantic_parser/FactorPredicateAutomaton.h +++ b/src/semantic_parser/FactorPredicateAutomaton.h @@ -131,7 +131,6 @@ class FactorPredicateAutomaton : public GenericFactor { const vector &additional_log_potentials, Configuration &configuration, double *value) { - //LOG(INFO) << "Begin Maximize"; // Decode maximizing over the senses and using the Viterbi algorithm // as an inner loop. // If sense=-1, the final score is zero (so take the argmax at the end). @@ -147,9 +146,6 @@ class FactorPredicateAutomaton : public GenericFactor { vector > path(length); CHECK_GE(length, 1); - //LOG(INFO) << "Sense " << s << " of " << num_senses; - //LOG(INFO) << "length = " << length; - // The start state is a1 = 0. values[0].resize(1); values[0][0] = 0.0; @@ -180,8 +176,6 @@ class FactorPredicateAutomaton : public GenericFactor { additional_log_potentials); } - //LOG(INFO) << "Terminate"; - // The end state is a = length. int best_last_state = -1; double best_score = -1e12; @@ -202,14 +196,11 @@ class FactorPredicateAutomaton : public GenericFactor { best_score += GetSenseScore(s, variable_log_potentials, additional_log_potentials); - //LOG(INFO) << "Backtrack"; - // Only backtrack if the solution is the best so far. if (best_score > *value) { // This is the best sense so far. best_sense = s; *value = best_score; - //LOG(INFO) << length; best_path.resize(length); best_path[length-1] = best_last_state; @@ -228,8 +219,6 @@ class FactorPredicateAutomaton : public GenericFactor { } } - //LOG(INFO) << "Write config"; - // Now write the configuration. vector *sense_arguments = static_cast*>(configuration); @@ -240,8 +229,6 @@ class FactorPredicateAutomaton : public GenericFactor { sense_arguments->push_back(a); } } - - //LOG(INFO) << "End Maximize"; } // Compute the score of a given assignment. @@ -249,8 +236,6 @@ class FactorPredicateAutomaton : public GenericFactor { const vector &additional_log_potentials, const Configuration configuration, double *value) { - //LOG(INFO) << "Begin Evaluate"; - const vector *sense_arguments = static_cast*>(configuration); // Sense belong to {-1,0,1,...} @@ -276,7 +261,6 @@ class FactorPredicateAutomaton : public GenericFactor { int a2 = GetLength(s); // Stop position. *value += GetSiblingScore(s, a1, a2, variable_log_potentials, additional_log_potentials); - //LOG(INFO) << "End Evaluate"; } // Given a configuration with a probability (weight), @@ -387,10 +371,6 @@ class FactorPredicateAutomaton : public GenericFactor { map_senses[s] = k; } - //LOG(INFO) << outgoing_arcs.size() << " outgoing arcs."; - //LOG(INFO) << siblings.size() << " siblings."; - - // Create a temporary list of arguments. // Each argument position will be mapped to a one-based array, in // which sense_arguments[s][1] = p, sense_arguments[s][2] = p+1 (p-1), @@ -406,7 +386,6 @@ class FactorPredicateAutomaton : public GenericFactor { CHECK_EQ(p, outgoing_arcs[k]->predicate()); int a = outgoing_arcs[k]->argument(); int s = outgoing_arcs[k]->sense(); - //LOG(INFO) << "Arc " << s << " " << p << " " << a; int position = (right)? a-p : p-a; ++position; // Position 0 is reserved for the case a1=-1. CHECK_GE(position, 1) << p << " " << a; @@ -448,8 +427,6 @@ class FactorPredicateAutomaton : public GenericFactor { int a1 = siblings[k]->first_argument(); int a2 = siblings[k]->second_argument(); - //LOG(INFO) << "Sibling " << s << " " << p << " " << a1 << " " << a2; - int position1 = right? a1-p : p-a1; int position2 = right? a2-p : p-a2; if (a1 < 0) position1 = -1; // To handle a1=-1. diff --git a/src/semantic_parser/SemanticDecoder.cpp b/src/semantic_parser/SemanticDecoder.cpp index 78cdf62..df8e4fe 100644 --- a/src/semantic_parser/SemanticDecoder.cpp +++ b/src/semantic_parser/SemanticDecoder.cpp @@ -1362,8 +1362,6 @@ void SemanticDecoder::DecodeFactorGraph(Instance *instance, Parts *parts, } } - //LOG(INFO) << "Created predicate automata."; - ////////////////////////////////////////////////////////////////////// // Build consecutive co-parent factors. ////////////////////////////////////////////////////////////////////// @@ -1580,8 +1578,6 @@ void SemanticDecoder::DecodeFactorGraph(Instance *instance, Parts *parts, factor_graph->SetResidualThresholdAD3(1e-3); //factor_graph->SetResidualThresholdAD3(1e-6); - //LOG(INFO) << "Running AD3"; - // Run AD3. timeval start, end; gettimeofday(&start, NULL);