本文整理汇总了Python中classifier.Classifier.rm_vector方法的典型用法代码示例。如果您正苦于以下问题:Python Classifier.rm_vector方法的具体用法?Python Classifier.rm_vector怎么用?Python Classifier.rm_vector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类classifier.Classifier
的用法示例。
在下文中一共展示了Classifier.rm_vector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestClassifier
# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import rm_vector [as 别名]
#.........这里部分代码省略.........
self.c.set_idf()
_, word_info = kc_util.gen_db(self.c.dictionary_db.cursor()).next()
self.assertNotEquals(word_info.idf, 0.0) # 3
self.c.set_tfidf_norm()
norm = self.c.vectors_norm_db.get(vector_1)
self.assertNotEquals(norm, '0.0') # 4
def test_add_vector(self):
""" Tests add_vector.
Add a text.
1- Check if there is not a vector.
Add a vector:
2- Check if there is a vector.
"""
text, vector_1 = "foo", "foo_1"
self.c.add_text(text)
vector = self.c.get_vector(vector_1)
self.assertIsNone(vector) # 1
self.c.add_vector(vector_1, text)
vector = self.c.get_vector(vector_1)
self.assertIsInstance(vector, Vector) # 2
def test_rm_vector(self):
""" Tests rm_vector.
Add a text.
Add a vector:
1- Check if the vector exists.
Remove the vector:
2- Check if the vector doesn't exist anymore.
"""
text, vector_1 = "foo", "foo_1"
self.c.add_text(text)
self.c.add_vector(vector_1, text)
vector = self.c.get_vector(vector_1)
self.assertIsNotNone(vector) # 1
self.c.rm_vector(vector_1)
vector = self.c.get_vector(vector_1)
self.assertIsNone(vector) # 2
def test_get_vector(self):
""" Tests get_vector.
Add a text.
Add a vector.
1- Check if the vector exists with "get_vector".
Get an unknown vector.
2- Check if the vector is None.
"""