我试图想出一个隐式拼写检查器,它将使用输入单词的映射到某种更一般的语音表示来解释可能发生的拼写错误,基本上对于一个会自动纠正你的拼写到一定程度的搜索栏.我一直在研究的两件事是metaphone,nysiis和soundex,但我真的不知道哪个更适合这个应用程序.
我希望优先选择更多的匹配而不是更少的匹配,我希望匹配更加通用,因此我想与soundex一起使用,这似乎是比原始的metaphone更接近的映射,但我真的不知道模糊性的差异有多大.我知道nysiis与soundex非常相似,但我不太清楚它们有多相似,或者nysiis与metaphone相比如何.
我也在寻找最快的解决方案.我知道这些语音映射器通常很快,但我不确定哪个是最快的,考虑到我希望能够在不增加搜索时间的情况下检查拼写,速度是一个考虑因素.思考?
我处于一个不幸的位置,我已经交付了一个传统的系统,火线相机连接到旧的Windows XP机器.基本上我正试图将这一切都变成opencv所以我至少可以在这台旧机器上有一个很好的界面.
问题是,我似乎无法找到有关如何连接到python端的firewire端口的任何文档.是否有一些扩展pyserial可能让我连接到这台古老的机器?
对不起,我不能更明确,但我真的没有找到太多关于此.如果有任何方式我可以提供更多帮助,请告诉我,我会尽快提供任何信息.
我正在尝试为句子中的单词创建一个通用的同义词标识符(即"a"或"the"),我在python中使用自然语言工具包(nltk).我遇到的问题是nltk中的同义词查找器需要一个词性参数才能链接到它的同义词.我试图解决的问题是使用nltk中存在的简化词性标记,然后减少第一个字母以便将此参数传递给同义词查找器,但这不起作用.
def synonyms(Sentence):
Keywords = []
Equivalence = WordNetLemmatizer()
Stemmer = stem.SnowballStemmer('english')
for word in Sentence:
word = Equivalence.lemmatize(word)
words = nltk.word_tokenize(Sentence.lower())
text = nltk.Text(words)
tags = nltk.pos_tag(text)
simplified_tags = [(word, simplify_wsj_tag(tag)) for word, tag in tags]
for tag in simplified_tags:
print tag
grammar_letter = tag[1][0].lower()
if grammar_letter != 'd':
Call = tag[0].strip() + "." + grammar_letter.strip() + ".01"
print Call
Word_Set = wordnet.synset(Call)
paths = Word_Set.lemma_names
for path in paths:
Keywords.append(Stemmer.stem(path))
return Keywords
Run Code Online (Sandbox Code Playgroud)
这是我目前正在处理的代码,正如你所看到的那样,我首先将输入变为lematizing以减少我将长期运行的匹配数量(我计划在成千上万的句子上运行),并且理论我会在此之后产生这个词,以进一步发挥这种作用并减少我产生的冗余单词的数量,但是这种方法几乎总是以下面的形式返回错误:
Traceback (most recent call last): …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行以下查询以插入一些节点,这些节点的id会随着节点加载到表中而自动递增.
但是ORA-02287: sequence number not allowed here每当我运行它时,我都会收到错误.
INSERT INTO V1144Engine.T_NODES VALUES
(
(SELECT V1144ENGINE.S_PK_NODES.NEXTVAL FROM dual),
1,
'Chemistry of Life',
0,1,
SYSDATE,
NULL,
'CON.3.1',
NULL
);
Run Code Online (Sandbox Code Playgroud)
我试过跑步
SELECT V1144ENGINE.S_PK_NODES.NEXTVAL from dual
Run Code Online (Sandbox Code Playgroud)
这很好,并返回我想要的数字.
我该如何解决这个问题?我正在运行Oracle 11g.
如果查询仍然可以在一行上运行,我将非常感激,因为我在电子表格中制作这些查询并且仍然希望能够这样做.
我对web dev和http服务器等世界相当新,但我有一个基本的shell脚本,如下所示:
PORT=2600
if [[ $1 =~ ^[0-9]+$ ]]
then PORT=$1
fi
echo "Starting local http server (ctrl-c to exit)"
echo ""
echo " Demo: http://127.0.0.1:$PORT/demo"
echo ""
python -m SimpleHTTPServer $PORT
Run Code Online (Sandbox Code Playgroud)
它似乎可以正常工作,但是当我在我的演示中更新css文件时,很少和不一致会更新页面上显示的css.对任何html的更改都很好,并且它偶尔会显示css的变化,但我觉得我在这里做了一些根本错误的事情.思考?
我正在尝试做一些我认为在朱莉娅应该相对简单的事情,但我似乎无法找到任何提及这个问题.
基本上我得到的是一个mxn矩阵和一个nx1向量.我想要做的是将矢量与矩阵相乘,即元素,但沿着轴,使矩阵的每个元素相乘.
在numpy比如,这将是:
np.multiply(array, vector)
Run Code Online (Sandbox Code Playgroud)
朱莉娅有什么办法吗?
我试着扩展矢量来填充数组:
projection = 1:size(matrix)[1]
weight_change = hcat(map(x -> vector, projection))
Run Code Online (Sandbox Code Playgroud)
但是Array{Array{Float64, 2}, 2},当我真正需要的只是Array{Float64, 2},这就产生了一种类型的东西,这意味着元素乘法不会真正起作用.
有没有办法修复我的方法或补救我的错误解决方案?
尝试使用portaudio记录一些数据,然后使用算法过滤器更改录制的语音,然后播放.我已经验证了很多(来自示例),但我对C很新,我认为在我的过滤器实现中我做了一些愚蠢的事情.
#if LOW_PASS
{
float RC = 1.0/(CUTOFF*2*3.14);
float dt = 1.0/SAMPLE_RATE;
float alpha = dt/(RC+dt);
float filteredArray[numSamples];
filteredArray[0] = data.recordedSamples[0];
for(i=1; i<numSamples; i++){
filteredArray[i] = filteredArray[i-1] + (alpha*(data.recordedSamples[i] - filteredArray[i-1]));
}
data.recordedSamples = filteredArray;
}
#endif
#if HIGH_PASS
{
float RC = 1.0/(CUTOFF*2*3.14);
float dt = 1.0/SAMPLE_RATE;
float alpha = RC/(RC + dt);
float filteredArray[numSamples];
filteredArray[0] = data.recordedSamples[0];
for (i = 1; i<numSamples; i++){
filteredArray[i] = alpha * (filteredArray[i-1] + data.recordedSamples[i] - data.recordedSamples[i-1]);
}
data.recordedSamples = filteredArray;
}
#endif …Run Code Online (Sandbox Code Playgroud) 尝试使用scipy的优化模块使用slsqp查找函数的最小值,我遇到了一些问题.调用该函数的实际代码如下所示:
def minimizeWebEnergyLost(x, parameters):
"""values = [theta, velocity]"""
firstTerm = lambda values: (x * values[1]**2 / 2.0)
sqrtTerm = lambda values: np.sqrt((parameters.gravity**2 * x**2) / (4 * values[1]**4 * np.cos(values[0])**4) + 1)
secondTerm = lambda values: (values[1]**4 * np.cos(values[0])**2) / parameters.gravity
arcsinhTerm = lambda values: np.arcsinh((parameters.gravity * x) / (2 * values[1]**2 * np.cos(values[0])**2))
costFunction = lambda values: firstTerm(values)*sqrtTerm(values)+secondTerm(values)*arcsinhTerm(values)
bounds = ((-math.pi/2,math.pi/2),(0,parameters.maxSlingSpeed))
minimum = minimize(costFunction, (pi/4, 20), method="SLSQP", bounds=bounds)
return minimum
Run Code Online (Sandbox Code Playgroud)
出于某种原因,我得到的错误如下:
_slsqp.error: failed in converting 8th argument `g' of …Run Code Online (Sandbox Code Playgroud) 我正在开发一个构建几何(而不是算术)神经网络的项目.为了构造传递函数,我想使用几何求和而不是算术求和.
为了使事情更清楚,我将在代码中描述:
def arithmetic_matrix_multiplication(matrix1, matrix2):
new_matrix = np.zeros(len(matrix1),len(matrix2[0]))
for i in range(len(matrix1)):
for j in range(len(matrix2[0])):
for k in range(len(matrix2)):
new_matrix[i][j] += matrix1[i][k]*matrix2[k][j]
return new_matrix
def geometric_matrix_multiplication(matrix1, matrix2):
new_matrix = np.ones(len(matrix1),len(matrix2[0]))
for i in range(len(matrix1)):
for j in range(len(matrix2[0])):
for k in range(len(matrix2)):
new_matrix[i][j] *= matrix1[i][k]*matrix2[k][j]
return new_matrix
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,这是一个非常小的变化.唯一的问题是,以同样的方式,我永远不会真正编写和使用上面的算术代码(我会使用numpy.dot),我真的不想实际使用上面的几何代码.有没有办法利用numpy的矩阵乘法来实现几何结果?我无法想到一个,而且我没有找到任何明显的解决方案,这远远不是最优的.
整合新的sublime安装并尝试安装控制面板.已经通过所有的标准论坛,但只是在无论安装方法如何获得神秘回溯的位置.
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 74, in reload_plugin
m = importlib.import_module(modulename)
File "./importlib/__init__.py", line 90, in import_module
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "/opt/sublime_text/sublime_plugin.py", line 678, in load_module
exec(compile(source, source_path, 'exec'), mod.__dict__)
File "Package Control in /home/slater/.config/sublime-text-3/Installed Packages/Package Control.sublime-package", line 14, in <module>
File "./posixpath.py", line 83, in join
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
plugins loaded …Run Code Online (Sandbox Code Playgroud)