Skip to content

Commit 6f67f99

Browse files
committed
修改fnlp-core的test错误
1 parent 0340f34 commit 6f67f99

File tree

21 files changed

+493
-523
lines changed

21 files changed

+493
-523
lines changed

example-data/seg-bad-case.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2013年 03月 25日 16:29
2+
2011年 9月 6日 22:11
3+
2012年 5月 5日 24:00
4+
1999年 7月 4日 02:10
5+
98年 8月 10日 05:20
6+
浙江 省 了 大 批 投资
7+
浙江省 了解 这个 情况 的 人 不 多
8+
从 北京 经 济南 下 徐州
9+
发展中 国家 服装 需求 大 增
10+
我们 提供 高档 和服 务必 前来 选购
11+
我们 提供 高档 设备 和 服务 。
12+
服务
13+
穿 上 日本 和服 装嫩
14+
这 台 计算机 系统盘 出 了 故障
15+
丹东 西安 全 是 我 喜欢 的 地方
16+
南京 的 市长 江大桥 说 南京市 长江 大桥 好 长
17+
这 事儿 的确 定 不 下 来
18+
去 网吧
19+
去 酒吧
20+
看 A片
21+
常见 软件
22+
我 的 小米 2 买 来 半 个 月 目前 出现 的 问题 是 手机 连 不 上 数据线 冲 不 了 电 , 也 连 不 上 电脑 数据线 是 OK 的 我 式 过 是 中 病毒
23+
操作 系统
24+
我 雅思 成绩 , 听力 7 , 阅读 6 , 写作 9
25+
VB 对
26+
C++ 指南
27+
晚上 21:10
28+
这 招 行不通 的
29+
招行 工行
30+
小米 手机
31+
内核 中 等待 队列
32+
跟 我 妻小 说
33+
哽咽 向 对方 妻小 道歉
34+
王菲 与 谢霆锋 恋情 公开
35+
刘菲 和 李亚鹏 结婚
36+
刘鹏 和 李亚鹏 结婚
37+
刘鹏 与 李亚鹏 结婚
38+
我 是 屌丝 好不
39+
自动 雨刮 自动 大灯 等
40+
比 CRV 好 太 多 了
41+
比 SUV 舒服 很多
42+
比 SUV 舒服 很多
43+
比 ipad 舒服 很多
44+
比 ipad 好 很多
45+
看起来 比 ipad 舒服 很多
46+
欧莱雅 美宝莲 兰蔻 是 很好 的 品牌

fnlp-app/pom.xml

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,40 @@
1-
<?xml version="1.0"?>
2-
<project
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4-
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5-
<modelVersion>4.0.0</modelVersion>
6-
<parent>
7-
<groupId>org.fnlp</groupId>
8-
<artifactId>fnlp-all</artifactId>
9-
<version>2.0.0-SNAPSHOT</version>
10-
</parent>
11-
<groupId>org.fnlp</groupId>
12-
<artifactId>fnlp-app</artifactId>
13-
<version>2.0.0-SNAPSHOT</version>
14-
<name>fnlp-app</name>
15-
<url>http://maven.apache.org</url>
16-
<properties>
17-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18-
</properties>
19-
<dependencies>
20-
<dependency>
21-
<groupId>junit</groupId>
22-
<artifactId>junit</artifactId>
23-
<version>4.11</version>
24-
<scope>test</scope>
25-
</dependency>
26-
<dependency>
27-
<groupId>org.fnlp</groupId>
28-
<artifactId>fnlp-core</artifactId>
29-
<version>2.0.0-SNAPSHOT</version>
30-
</dependency>
31-
<dependency>
32-
<groupId>org.apache.lucene</groupId>
33-
<artifactId>lucene-core</artifactId>
34-
<version>4.7.0</version>
35-
</dependency>
36-
<dependency>
37-
<groupId>org.apache.lucene</groupId>
38-
<artifactId>lucene-queryparser</artifactId>
39-
<version>4.7.0</version>
40-
</dependency>
41-
</dependencies>
42-
</project>
1+
<?xml version="1.0"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.fnlp</groupId>
6+
<artifactId>fnlp-all</artifactId>
7+
<version>2.0-SNAPSHOT</version>
8+
</parent>
9+
<groupId>org.fnlp</groupId>
10+
<artifactId>fnlp-app</artifactId>
11+
<version>2.0-SNAPSHOT</version>
12+
<name>fnlp-app</name>
13+
<url>http://maven.apache.org</url>
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>4.11</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.fnlp</groupId>
26+
<artifactId>fnlp-core</artifactId>
27+
<version>2.0-SNAPSHOT</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.apache.lucene</groupId>
31+
<artifactId>lucene-core</artifactId>
32+
<version>4.7.0</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.apache.lucene</groupId>
36+
<artifactId>lucene-queryparser</artifactId>
37+
<version>4.7.0</version>
38+
</dependency>
39+
</dependencies>
40+
</project>

fnlp-core/pom.xml

Lines changed: 113 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,115 @@
11
<?xml version="1.0"?>
2-
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4-
<modelVersion>4.0.0</modelVersion>
5-
<parent>
6-
<groupId>org.fnlp</groupId>
7-
<artifactId>fnlp-all</artifactId>
8-
<version>2.0.0-SNAPSHOT</version>
9-
</parent>
10-
<groupId>org.fnlp</groupId>
11-
<artifactId>fnlp-core</artifactId>
12-
<version>2.0.0-SNAPSHOT</version>
13-
<name>fnlp-core</name>
14-
<url>http://maven.apache.org</url>
15-
<properties>
16-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17-
</properties>
18-
<dependencies>
19-
<dependency>
20-
<groupId>junit</groupId>
21-
<artifactId>junit</artifactId>
22-
<version>4.11</version>
23-
<scope>test</scope>
24-
</dependency>
25-
</dependencies>
26-
<build>
27-
<plugins>
28-
<plugin>
29-
<groupId>org.apache.maven.plugins</groupId>
30-
<artifactId>maven-compiler-plugin</artifactId>
31-
<version>2.3.2</version>
32-
<configuration>
33-
<source>1.6</source>
34-
<target>1.6</target>
35-
<encoding>UTF-8</encoding>
36-
</configuration>
37-
</plugin>
38-
</plugins>
39-
</build>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.fnlp</groupId>
6+
<artifactId>fnlp-all</artifactId>
7+
<version>2.0-SNAPSHOT</version>
8+
<relativePath>../pom.xml</relativePath>
9+
</parent>
10+
<groupId>org.fnlp</groupId>
11+
<artifactId>fnlp-core</artifactId>
12+
<version>2.0</version>
13+
<name>fnlp-core</name>
14+
<url>https://github.com/xpqiu/fnlp/</url>
15+
<description>FNLP is developed for Chinese natural language processing (NLP), which also includes some machine learning algorithms and data sets to achieve the NLP tasks. FNLP is distributed under LGPL3.0.</description>
16+
<organization>
17+
<name>fnlp.org</name>
18+
<url>http://www.fnlp.org</url>
19+
</organization>
20+
21+
<scm>
22+
<url>scm:git:git@github.com:xpqiu/fnlp.git</url>
23+
<connection>scm:git:git@github.com:xpqiu/fnlp.git</connection>
24+
<tag>fnlp-core-2.0</tag>
25+
</scm>
26+
27+
<properties>
28+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
29+
</properties>
30+
<dependencies>
31+
<dependency>
32+
<groupId>junit</groupId>
33+
<artifactId>junit</artifactId>
34+
<version>4.11</version>
35+
<scope>test</scope>
36+
</dependency>
37+
</dependencies>
38+
39+
<profiles>
40+
<profile>
41+
<id>release</id>
42+
<distributionManagement>
43+
<snapshotRepository>
44+
<id>sonatype-nexus-snapshots</id>
45+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
46+
</snapshotRepository>
47+
<repository>
48+
<id>sonatype-nexus-staging</id>
49+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
50+
</repository>
51+
</distributionManagement>
52+
<build>
53+
<plugins>
54+
<!-- Source -->
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-source-plugin</artifactId>
58+
<version>2.2.1</version>
59+
<executions>
60+
<execution>
61+
<phase>package</phase>
62+
<goals>
63+
<goal>jar-no-fork</goal>
64+
</goals>
65+
</execution>
66+
</executions>
67+
</plugin>
68+
<!-- Javadoc -->
69+
<plugin>
70+
<groupId>org.apache.maven.plugins</groupId>
71+
<artifactId>maven-javadoc-plugin</artifactId>
72+
<version>2.9.1</version>
73+
<executions>
74+
<execution>
75+
<phase>package</phase>
76+
<goals>
77+
<goal>jar</goal>
78+
</goals>
79+
</execution>
80+
</executions>
81+
</plugin>
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-gpg-plugin</artifactId>
85+
<version>1.5</version>
86+
<executions>
87+
<execution>
88+
<id>sign-artifacts</id>
89+
<phase>verify</phase>
90+
<goals>
91+
<goal>sign</goal>
92+
</goals>
93+
</execution>
94+
</executions>
95+
</plugin>
96+
</plugins>
97+
</build>
98+
</profile>
99+
</profiles>
100+
101+
<build>
102+
<plugins>
103+
<plugin>
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-compiler-plugin</artifactId>
106+
<version>2.3.2</version>
107+
<configuration>
108+
<source>1.6</source>
109+
<target>1.6</target>
110+
<encoding>UTF-8</encoding>
111+
</configuration>
112+
</plugin>
113+
</plugins>
114+
</build>
40115
</project>

fnlp-core/src/main/java/org/fnlp/nlp/similarity/Cluster.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,18 @@ public Cluster(int key, float v, String s) {
3838
}
3939

4040
public Cluster(int newid, Cluster c1, Cluster c2, float pc) {
41-
id = newid;
42-
prop = pc;
43-
left = c1;
44-
right = c2;
45-
rep = c1.rep+":"+c2.rep;
41+
id = newid;
42+
prop = pc;
43+
left = c1;
44+
right = c2;
45+
if(c1==null && c2==null)
46+
rep = null;
47+
else if(c1==null)
48+
rep = c2.rep;
49+
else if(c2==null)
50+
rep = c1.rep;
51+
else
52+
rep = c1.rep+":"+c2.rep;
4653
}
4754

4855
String getN() {

fnlp-core/src/main/java/org/fnlp/nlp/similarity/train/WordCluster.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ public Cluster startClustering() {
489489

490490

491491

492-
// int[] idx = MyCollection.sort(wordProb);
492+
// int[] idx = MyCollection.sort(wordProb);
493+
wordProb.remove(-1);
494+
wordProb.remove(-2);
493495

494496
int[] idx = MyHashSparseArrays.trim(wordProb, ENERGY);
495497

fnlp-core/src/test/java/org/fnlp/ml/classifier/knn/KNNTest.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ public void testClassifyInstanceSetInt() {
5757

5858

5959
}
60-
@Test
61-
public void testClassifyInstanceTypeInt() {
62-
fail("Not yet implemented");
63-
}
64-
65-
@Test
66-
public void testGetStringLabelInstanceInt() {
67-
fail("Not yet implemented");
68-
}
60+
6961

7062
}

0 commit comments

Comments
 (0)