本文整理汇总了Python中corpus.Corpus.loadVocabulary方法的典型用法代码示例。如果您正苦于以下问题:Python Corpus.loadVocabulary方法的具体用法?Python Corpus.loadVocabulary怎么用?Python Corpus.loadVocabulary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corpus.Corpus
的用法示例。
在下文中一共展示了Corpus.loadVocabulary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import loadVocabulary [as 别名]
import theano.tensor as t
import numpy as np
from corpus import Corpus
from model import Model
logfile = 'log_' + str(time.time())
logging.basicConfig(filename = logfile, level = logging.INFO)
logger = logging.getLogger('test')
filepath = 'train1K'
vocab = 'vocab_train1K'
c = Corpus(logger)
c.loadVocabulary(vocab)
n_hid = 50
n_steps = 10
n_seq = 5
n_classes = 3
n_out = n_classes
fs = open(filepath, 'r')
tokens = None
softmax_time = 0
#Retrives the inputs and targets
seq, targets, tokens = c.encode(n_seq, n_steps, tokens, fs)
_, __, n_in = seq.shape