substitutiontest.java

来自「该原代码是实现机器学习中条件随机场模型的Java代码」· Java 代码 · 共 20 行

JAVA
20
字号
package lcrf.logic;

import junit.framework.TestCase;

public class SubstitutionTest extends TestCase {
    public void testsubstitution1() throws Exception {
        Atom a1 = new Atom("the(dog,is,good(X))");
        Atom a2 = new Atom("the(dog,is,good(  42  ))");

        Atom b1 = new Atom("the(X,X,good(X))");
        Atom b2 = new Atom("the(42,42,good(42))");

        Substitution subst = new Substitution(new Variable("X"), new NumberConstant(42));

        assertEquals(a2.getTermRepresentation(), subst.apply(a1.getTermRepresentation()));
        assertEquals(b2.getTermRepresentation(), subst.apply(b1.getTermRepresentation()));
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?