當前位置: 首頁>>代碼示例>>Python>>正文


Python Grocery.get_load_status方法代碼示例

本文整理匯總了Python中tgrocery.Grocery.get_load_status方法的典型用法代碼示例。如果您正苦於以下問題:Python Grocery.get_load_status方法的具體用法?Python Grocery.get_load_status怎麽用?Python Grocery.get_load_status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tgrocery.Grocery的用法示例。


在下文中一共展示了Grocery.get_load_status方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_main

# 需要導入模塊: from tgrocery import Grocery [as 別名]
# 或者: from tgrocery.Grocery import get_load_status [as 別名]
 def test_main(self):
     grocery = Grocery(self.grocery_name)
     grocery.train(self.train_src)
     grocery.save()
     new_grocery = Grocery('test')
     new_grocery.load()
     assert grocery.get_load_status()
     assert grocery.predict('考生必讀:新托福寫作考試評分標準') == 'education'
     # cleanup
     if self.grocery_name and os.path.exists(self.grocery_name):
         shutil.rmtree(self.grocery_name)
開發者ID:SHENbeyond,項目名稱:TextGrocery,代碼行數:13,代碼來源:runtests.py

示例2: sentiment_train

# 需要導入模塊: from tgrocery import Grocery [as 別名]
# 或者: from tgrocery.Grocery import get_load_status [as 別名]
def sentiment_train(gro_name, train_set):
    """

    :param gro_name:
    :param train_set:
    :return:
    """
    gro_ins = Grocery(gro_name)
    # gro_ins.load()
    gro_ins.train(train_set)
    print("Is trained? ", gro_ins.get_load_status())
    gro_ins.save()
開發者ID:wac81,項目名稱:LSI-for-ChineseDocument,代碼行數:14,代碼來源:SentimentOne.py

示例3: DataFrame

# 需要導入模塊: from tgrocery import Grocery [as 別名]
# 或者: from tgrocery.Grocery import get_load_status [as 別名]
		tdic['id'].append(_id)
		tdic['type'].append(_type)
		tdic['contents'].append(contents)
	i +=1
	
#train = pd.read_csv( train_file, header = 0, delimiter = "\t", quoting = 3 )
#test = pd.read_csv( test_file, header = 1, delimiter = "\t", quoting = 3 )
train = DataFrame(dic)
test = DataFrame(tdic)
#
#classfynews_instance 是模型保存路徑
grocery = Grocery('classfynews_instance')

train_in = [train['contents'],train['type']]
grocery.train(train_in)
print grocery.get_load_status()
#grocery.save()

copy_grocery = Grocery('classfynews_instance')
copy_grocery.load()
#copy_grocery = grocery
test_in = [test['contents'],test['type']]
#輸入類似 ['我是中國人','台北*****']
#輸出 [11,12]
test_result = copy_grocery.predict(test['contents'])
print test_result.predicted_y
#test_result = copy_grocery.test(test_in)
#print test_result.show_result()


開發者ID:lovetimil,項目名稱:TextGrocery,代碼行數:30,代碼來源:test_mssql.py

示例4: __init__

# 需要導入模塊: from tgrocery import Grocery [as 別名]
# 或者: from tgrocery.Grocery import get_load_status [as 別名]
class Cat:
    def __init__(self):
        self.grocery = Grocery('autohome')

    def test(self):
        print self.grocery.get_load_status()
開發者ID:FREEWING-JP,項目名稱:autohome,代碼行數:8,代碼來源:cat.py

示例5: Grocery

# 需要導入模塊: from tgrocery import Grocery [as 別名]
# 或者: from tgrocery.Grocery import get_load_status [as 別名]
# coding: utf-8

from tgrocery import Grocery


grocery = Grocery('test')
train_src = [
    ('education', '名師指導托福語法技巧:名詞的複數形式'),
    ('education', '中國高考成績海外認可 是“狼來了”嗎?'),
    ('sports', '圖文:法網孟菲爾斯苦戰進16強 孟菲爾斯怒吼'),
    ('sports', '四川丹棱舉行全國長距登山挑戰賽 近萬人參與')
]
grocery.train(train_src)
print(grocery.get_load_status())
predict_result = grocery.predict('考生必讀:新托福寫作考試評分標準')
print(predict_result)
print(predict_result.dec_values)

grocery = Grocery('read_text')
train_src = '../text_src/train_ch.txt'
grocery.train(train_src)
print(grocery.get_load_status())
predict_result = grocery.predict('考生必讀:新托福寫作考試評分標準')
print(predict_result)
print(predict_result.dec_values)
開發者ID:prashnts,項目名稱:TextGrocery,代碼行數:27,代碼來源:classify.py

示例6: Grocery

# 需要導入模塊: from tgrocery import Grocery [as 別名]
# 或者: from tgrocery.Grocery import get_load_status [as 別名]
# coding: utf-8

from tgrocery import Grocery

# pass a tokenizer, must be a python func
custom_grocery = Grocery('custom', custom_tokenize=list)
train_src = [
    ('education', '名師指導托福語法技巧:名詞的複數形式'),
    ('education', '中國高考成績海外認可 是“狼來了”嗎?'),
    ('sports', '圖文:法網孟菲爾斯苦戰進16強 孟菲爾斯怒吼'),
    ('sports', '四川丹棱舉行全國長距登山挑戰賽 近萬人參與')
]
custom_grocery.train(train_src)
print custom_grocery.get_load_status()
print custom_grocery.predict('考生必讀:新托福寫作考試評分標準')
開發者ID:SHENbeyond,項目名稱:TextGrocery,代碼行數:17,代碼來源:custom_tokenize.py


注:本文中的tgrocery.Grocery.get_load_status方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。