Skip to content

Commit 5273272

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 6c8ea48 + 3d07aff commit 5273272

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import java.util.*;
1616

1717
/**
18+
* 抽象的向量模型,将抽象的对象映射为向量
19+
*
1820
* @author hankcs
1921
*/
2022
public abstract class AbstractVectorModel<K>
@@ -32,12 +34,12 @@ public AbstractVectorModel()
3234
}
3335

3436
/**
35-
* 获取一个词的词向量
37+
* 获取一个键的向量(键不会被预处理)
3638
*
37-
* @param key
38-
* @return 词向量
39+
* @param key
40+
* @return 向量
3941
*/
40-
public Vector vector(K key)
42+
final public Vector vector(K key)
4143
{
4244
Vector vector = storage.get(key);
4345
if (vector == null) return null;
@@ -161,13 +163,13 @@ public List<Map.Entry<K, Float>> nearest(K key)
161163
}
162164

163165
/**
164-
* 查询最相似的对象
166+
* 执行查询最相似的对象(子类通过query方法决定如何解析query,然后通过此方法执行查询)
165167
*
166168
* @param query 查询语句(或者说一个对象的内容)
167169
* @param size 需要返回前多少个对象
168170
* @return
169171
*/
170-
public List<Map.Entry<K, Float>> queryNearest(String query, int size)
172+
final List<Map.Entry<K, Float>> queryNearest(String query, int size)
171173
{
172174
if (query == null || query.length() == 0)
173175
{

0 commit comments

Comments
 (0)