This file contains hidden or 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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* 一个数组中倒找使得两个数组平均化的解 | |
* | |
* @author ansj | |
* | |
*/ |
This file contains hidden or 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 com.ansj.vec; | |
import java.io.BufferedInputStream; | |
import java.io.DataInputStream; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; |
This file contains hidden or 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 com.kuyun.nlp; | |
import java.util.ArrayList; | |
import java.util.List; | |
import com.kuyun.nlp.util.PageDown; | |
public class HtmlExtraction { | |
public static void main(String[] args) { | |
String html = PageDown |
This file contains hidden or 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
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.util.zip.GZIPInputStream; | |
import java.util.zip.GZIPOutputStream; | |
public class StringZip { | |
public static void main(String[] args) throws Exception { | |
StringBuilder value = new StringBuilder() ; |
This file contains hidden or 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 LogisticRegression { | |
public int N; | |
public int n_in; | |
public int n_out; | |
public double[][] W; | |
public double[] b; | |
public LogisticRegression(int N, int n_in, int n_out) { | |
this.N = N; | |
this.n_in = n_in; |
This file contains hidden or 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
import java.lang.reflect.Array; | |
import java.util.Arrays; | |
import java.util.HashSet; | |
import java.util.Iterator; | |
import java.util.Set; | |
/** | |
* 文本坐标记用的 tagBegin是开始标记 tagEnd 是结束标记 用了二分法查找来确定单词 content 是传入的正文 正文可以传多次 | |
* 标记词语也可以传多次 | |
* |
This file contains hidden or 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 AnsjStringUtil { | |
private static int[] filter = new int[128]; | |
private static int[] filterEnd = new int[128]; | |
static { | |
filter['<'] = Integer.MAX_VALUE/2; | |
filterEnd['<'] = '>'; | |
filter['&'] = 10; |
This file contains hidden or 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 BinarySearchAbsMin { | |
public static void main(String[] args) { | |
int[] ints = { -3213, -232, -453, -5, -3, -2, 3, 8, 834, 2342, 999 }; | |
int min = searchAbsMin(ints, 0, ints.length); | |
System.out.println(min); | |
} | |
// 二分查找 | |
private static int searchAbsMin(int[] ints, int start, int end) { |
NewerOlder