This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kz.moe.classifier; | |
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; | |
import com.google.gson.reflect.TypeToken; | |
import kz.moe.classifier.genetic.creature.BasicCreature; | |
import kz.moe.classifier.genetic.creature.Chromosome; | |
import kz.moe.classifier.genetic.creature.Gene; | |
import kz.moe.classifier.genetic.creature.ICreature; | |
import kz.moe.classifier.genetic.crossover.ICrossover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean consecutiveAscending = true; | |
boolean consecutiveDescending = true; | |
// Check to see if the newPin is made up of consecutive numbers in | |
// ascending order | |
for (int j = 0; j < newPin.length() - 1; j++) { | |
if (Convert.toLong(newPin.substring(j, j + 1)) == null | |
|| Convert.toLong(newPin.substring(j + 1, j + 2)) == null) { | |
consecutiveAscending = false; | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CrossoverFactory extends AbstractFactory{ | |
public static ICrossover createCrossover(CrossoverType type) { | |
report(type.name(), "Crossover"); | |
switch (type) { | |
case ONE_POINT_CROSSOVER: | |
return new OnePointCrossover(); | |
case TWO_POINT_CROSSOVER: | |
return new TwoPointCrossover(); | |
case UNIFORM_CROSSOVER: | |
return new UniformCrossover(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum CrossoverType { | |
ONE_POINT_CROSSOVER, TWO_POINT_CROSSOVER, UNIFORM_CROSSOVER, VAR_TO_VAR_CROSSOVER; | |
/** | |
* | |
* @param value should represent one of enum in CrossoverType | |
* @return return suited CrossoverType or ONE_POINT_CROSSOVER of nothing is found | |
*/ | |
public static CrossoverType parse(String value) { | |
final List<CrossoverType> list = Arrays.asList(CrossoverType.values()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kz.kaznu.counter; | |
import com.google.common.base.Stopwatch; | |
import kz.kaznu.counter.commons.utils.LoggerEnabler; | |
import kz.kaznu.counter.commons.utils.Timer; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.Random; | |
import java.util.concurrent.Callable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Used for device activation, method is manually transacted | |
* Method returns uniqueNumber, this number is used on mobile devices | |
* <br/> | |
* to use GetToken service | |
*/ | |
public DoActivationResponse doActivation(arguments...) throws InvalidDeviceAssignedToOtherUserException, | |
InvalidMemorableWordAttemptsException, | |
CredentialException, | |
InvalidUserHasAnotherDevicedAssignedException, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kz.moe.classifier.index; | |
import kz.moe.parser.model.MessageType; | |
import org.apache.lucene.index.PostingsEnum; | |
import org.apache.lucene.index.TermsEnum; | |
import org.apache.lucene.search.DocIdSetIterator; | |
import org.apache.lucene.search.similarities.DefaultSimilarity; | |
import org.apache.lucene.search.similarities.TFIDFSimilarity; | |
import org.apache.lucene.util.BytesRef; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void extractTfidfVector() throws Exception { | |
final IndexReader indexReader = indexerMany.readIndex(); | |
final TFIDFSimilarity tfidfSIM = new DefaultSimilarity(); | |
final Map<String, Double> termToTFIDF = new HashMap<>(); | |
final Map<String, Integer> termToNumber = new HashMap<>(); | |
final Fields fields = MultiFields.getFields(indexReader); | |
final Terms bodyTerms = fields.terms("body"); | |
final TermsEnum iterator = bodyTerms.iterator(); | |
BytesRef term; | |
while ((term = iterator.next()) != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0' encoding='UTF-8'?> | |
<server xmlns="urn:jboss:domain:4.0"> | |
<extensions> | |
<extension module="org.jboss.as.clustering.infinispan"/> | |
<extension module="org.jboss.as.connector"/> | |
<extension module="org.jboss.as.deployment-scanner"/> | |
<extension module="org.jboss.as.ee"/> | |
<extension module="org.jboss.as.ejb3"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* User: Sanzhar Aubakirov | |
* Date: 12/22/16 | |
*/ | |
public class Test { | |
public static void main(String[] args) { | |
Child c = new Child(); | |
c.A(); | |
} |