Skip to content

Commit 2457f21

Browse files
1.41 版本发布
1 parent 4110737 commit 2457f21

File tree

7 files changed

+48
-38
lines changed

7 files changed

+48
-38
lines changed

.idea/workspace.xml

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src_code/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>io.github.BeardedManZhao</groupId>
77
<artifactId>algorithmStar</artifactId>
8-
<version>1.40</version>
8+
<version>1.41</version>
99
<packaging>jar</packaging>
1010
<name>algorithmStar</name>
1111
<description>algorithmStar-java</description>

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/OperationAlgorithmManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public final class OperationAlgorithmManager implements OperationAlgorithm {
2121
/**
2222
* AS version
2323
*/
24-
public final static float VERSION = 1.40f;
24+
public final static float VERSION = 1.41f;
2525

2626
/**
2727
* 计算组件的日志打印开关,当此处值为false的时候,计算组件中的日志将不会被打印,logger也不会被调用,一般来说,这里为了减少冗余的字符串实例化操作,会设置为false,当需要调试的时候才需要打开此处的数值。

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/featureExtraction/DictFeatureExtraction.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ private HashMap<String, Integer> getIndexFromMap(int initSize, String[] data) {
111111
// 首先按照提供的字端将编号准备好
112112
HashMap<String, Integer> hashMap = new HashMap<>(initSize);
113113
for (int length = data.length - 1; length >= 0; length--) {
114-
hashMap.put(data[length], length);
114+
final String datum = data[length];
115+
if (!hashMap.containsKey(datum)) {
116+
hashMap.put(datum, hashMap.size());
117+
}
115118
}
116119
return hashMap;
117120
}

src_code/src/test/java/MAIN1.java

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,27 @@
1-
2-
import io.github.beardedManZhao.algorithmStar.integrator.Route2DDrawingIntegrator;
3-
import io.github.beardedManZhao.algorithmStar.algorithm.generatingAlgorithm.ZhaoCoordinateNet2D;
4-
import io.github.beardedManZhao.algorithmStar.operands.coordinate.DoubleCoordinateTwo;
5-
import io.github.beardedManZhao.algorithmStar.operands.route.DoubleConsanguinityRoute2D;
1+
import io.github.beardedManZhao.algorithmStar.algorithm.featureExtraction.DictFeatureExtraction;
2+
import io.github.beardedManZhao.algorithmStar.core.AlgorithmStar;
3+
import io.github.beardedManZhao.algorithmStar.operands.matrix.ColumnIntegerMatrix;
64

75
/**
86
* 示例代码文件
97
*/
108
public class MAIN1 {
119
public static void main(String[] args) {
12-
// 构建人员坐标(二维)
13-
DoubleCoordinateTwo A = new DoubleCoordinateTwo(10, 10);
14-
DoubleCoordinateTwo B = new DoubleCoordinateTwo(-10, 4);
15-
DoubleCoordinateTwo C = new DoubleCoordinateTwo(1, 0);
16-
DoubleCoordinateTwo E = new DoubleCoordinateTwo(6, 1);
17-
DoubleCoordinateTwo Z = new DoubleCoordinateTwo(1, 21);
10+
// 准备几个所谓的类别
11+
final String[] sentences = new String[]{
12+
"zhao", "zhao", "asdasd", "zhao1", "zhao123", "zhao4"
13+
};
1814

19-
// 获取关系网络,该算法是我实现出来,用于推断人员关系网的,这里的名称您可以自定义,需要注意的是下面集成器的实例化需要您将该名称传进去
20-
ZhaoCoordinateNet2D zhaoCoordinateNet = ZhaoCoordinateNet2D.getInstance("Z");
21-
zhaoCoordinateNet.addRoute(DoubleConsanguinityRoute2D.parse("A -> B", A, B)); // Representing A takes the initiative to know B
22-
zhaoCoordinateNet.addRoute(DoubleConsanguinityRoute2D.parse("A -> C", A, C));
23-
zhaoCoordinateNet.addRoute(DoubleConsanguinityRoute2D.parse("E -> Z", E, Z));
24-
zhaoCoordinateNet.addRoute(DoubleConsanguinityRoute2D.parse("A -> Z", A, Z));
25-
zhaoCoordinateNet.addRoute(DoubleConsanguinityRoute2D.parse("B -> Z", B, Z));
15+
// 获取到特征处理计算组件 这里使用的是 词频向量特征提取组件
16+
final DictFeatureExtraction dictFeatureExtraction = DictFeatureExtraction.getInstance("DictFeatureExtraction");
2617

27-
// 使用2维路线绘制集成器,输出上面所有人员之间的关系网络图片
28-
Route2DDrawingIntegrator a = new Route2DDrawingIntegrator("A", "Z");
29-
// 设置图片输出路径
30-
a.setImageOutPath("D:\\out\\image.jpg")
31-
// 设置图片宽度
32-
.setImageWidth(1000)
33-
// 设置图片高度
34-
.setImageHeight(1000)
35-
// 设置离散阈值,用来放大微小的变化
36-
.setDiscreteThreshold(4)
37-
// 运行集成器!
38-
.run();
18+
// 构建一个 AS 库计算对象
19+
// TODO 需要注意是 在这里我们需要设置一下第二个泛型的类型
20+
// 第二个泛型代表的就是 词频处理之后返回的操作数的类型 ColumnIntegerMatrix 是 dictFeatureExtraction 对应的类型
21+
final AlgorithmStar<?, ColumnIntegerMatrix> instance = AlgorithmStar.getInstance();
22+
// 将组件和需要被处理的数据提供给计算对象 TODO 这里获取到的类型就是 ColumnIntegerMatrix
23+
final ColumnIntegerMatrix extract = instance.extract(dictFeatureExtraction, sentences);
3924

40-
// 清理关系网络中的数据
41-
zhaoCoordinateNet.clear();
25+
System.out.println(extract);
4226
}
4327
}

src_code/update/1.32_1.40-Chinese.md renamed to src_code/update/1.31_1.32or1.40-Chinese.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### 更新日志
1010

11-
* 框架版本:1.31 - 1.32
11+
* 框架版本:1.31 - 1.32/1.40
1212
* 移除了度量计算组件 以及 差异计算组件中的日志打印模块,着将有效的增强框架性能。
1313
* 移除了日志配置文件,着将可以有效的避免日志配置文件被意外覆盖的问题。
1414

src_code/update/1.40_1.41-Chinese.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ![image](https://user-images.githubusercontent.com/113756063/194830221-abe24fcc-484b-4769-b3b7-ec6d8138f436.png) 算法之星-机器大脑
2+
3+
- Switch to [English Document](https://github.com/BeardedManZhao/algorithmStar/blob/Zhao-develop/src_code/README.md)
4+
- knowledge base
5+
<a href="https://github.com/BeardedManZhao/algorithmStar/blob/main/KnowledgeDocument/knowledge%20base-Chinese.md">
6+
<img src = "https://user-images.githubusercontent.com/113756063/194838003-7ad14dac-b38c-4b57-a942-ba58f00baaf7.png"/>
7+
</a>
8+
9+
### 更新日志
10+
11+
* 框架版本:1.40 - 1.41
12+
* 修正了字典特征提取组件有时候会出现越界的问题!
13+
14+
### Version update date : 2024-06-26

0 commit comments

Comments
 (0)