Cambridge SMT System
TestFeatureRegistry.java
Go to the documentation of this file.
1 /*******************************************************************************
2  * Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use these files except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  * See the License for the specific language governing permissions and
12  * limitations under the License.
13  *
14  *******************************************************************************/
15 
16 package uk.ac.cam.eng.rule.features;
17 
18 import static org.junit.Assert.assertArrayEquals;
19 import static org.junit.Assert.assertEquals;
20 
21 import org.junit.Test;
22 
23 public class TestFeatureRegistry {
24 
25  public static final int[] S2T_LEX_PROB = new int[]{10};
26  public static final int[] PROV_S2T_LEX_PROB = new int[]{20, 21, 22, 23};
27  public static final int[] MULTIPLE = new int[]{11, 12, 13, 14, 15, 16, 17, 18, 19};
28 
29 
30  @Test
31  public void testFeatureRegistry() {
33  "source2target_probability,target2source_probability,word_insertion_penalty,rule_insertion_penalty,glue_rule,insert_scale,rule_count_1,rule_count_2,rule_count_greater_than_2,source2target_lexical_probability,target2source_lexical_probability,provenance_source2target_probability,provenance_target2source_probability,provenance_source2target_lexical_probability,provenance_target2source_lexical_probability",
34  "cc,nc,yx,web");
35  assertEquals(15, fReg.getFeatures().size());
36  assertArrayEquals(S2T_LEX_PROB,fReg
37  .getFeatureIndices(Feature.SOURCE2TARGET_LEXICAL_PROBABILITY));
38  assertArrayEquals(PROV_S2T_LEX_PROB, fReg
40  assertArrayEquals(MULTIPLE, fReg.getFeatureIndices(
44  }
45 
46 }