org.bigml.mimir.nlp.lda.MappifyTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mimir Show documentation
Show all versions of mimir Show documentation
Java/Clojure Prediction Code for BigML
The newest version!
package org.bigml.mimir.nlp.lda;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bigml.mimir.nlp.tokenization.TokenStreamFactory;
import org.bigml.mimir.nlp.topicmodel.Mappifier;
import org.junit.Assert;
import org.junit.Test;
public class MappifyTest {
public MappifyTest() {
// TODO Auto-generated constructor stub
}
@Test public void mappifyChinese() {
Map expected = new HashMap();
expected.put("鱷梨", 2L);
Set znWords = new HashSet();
znWords.add("鱷梨");
TokenStreamFactory tf = TokenStreamFactory.getBuilder(
"zh", "single", 2, false, znWords, null);
List tokens = tf.getTokenList("charles 鱷梨 parker 鱷梨");
Mappifier mp = new Mappifier(znWords, "zh");
Map tokenMap = mp.documentToMap(tokens);
Assert.assertTrue(expected.equals(tokenMap));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy