Android Open Source - sdk-text-similarity Test Text Similarity






From Project

Back to project page sdk-text-similarity.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project sdk-text-similarity listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
//from ww  w.j a  v  a2s. c  o m
import org.silpa.textsimilarity.TextSimilarity;


/**
 * Created by sujith on 14/7/14.
 */
public class TestTextSimilarity extends AndroidTestCase {

    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }

    @SmallTest
    @MediumTest
    @LargeTest
    public void testletterNgramEnglish() {
        TextSimilarity ts = new TextSimilarity();

        assertEquals(1.0, ts.compare("The quick brown fox jumps over the lazy dog", "The quick brown fox jumps over the lazy dog"));
        assertEquals(0.0, ts.compare("Alpha Beta Gamma Delta Omega Phi", "Sin Cos Tan Cosec Sec Cot"));
        assertEquals(0.4999999999999999, ts.compare("Julie loves me more than Linda loves me", "Jane likes me more than Julie loves me"));

    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }
}




Java Source Code List

.TestTextSimilarity.java
org.silpa.textsimilarity.TextSimilarity.java