我正在运行bundle exec jekyll build && bundle exec jekyll serve --watch生成_site文件夹,然后我们通过FTP将其上传到Web服务器._site文件夹中的index.html文件包含指向"localhost"本地URL的链接,而不是正确的站点URL,从而导致链接断开.使用FTP进行部署可能意味着链接的文本将按原样部署到生产服务器,用户将被重定向到"localhost"而不是我们的博客URL.我怎样才能解决这个问题?我之前没有遇到任何问题.
摘自index.html:
<link rel="stylesheet" type="text/css" href="/blog/slick/slick.css"/>
<link rel="stylesheet" type="text/css" href="/blog/slick/slick-theme.css"/>
<link rel="stylesheet" href="/blog/css/main.css">
<link rel="canonical" href="http://localhost:4000/blog/">
<link rel="alternate" type="application/rss+xml" title="The WordBrewery Blog | Language Untapped" href="http://localhost:4000/blog/feed.xml">
Run Code Online (Sandbox Code Playgroud)
摘自_config.yml:
title: "The WordBrewery Blog | Language Untapped"
description: "WordBrewery's home for aspiring polyglots. Study tips, book and app reviews, grammar and vocabulary lessons, interviews, and other language-learning resources."
baseurl: "/blog" # the subpath of your site
url: "https://wordbrewery.com" # the base hostname …Run Code Online (Sandbox Code Playgroud) 我想用NLTK来识别日语中的特定汉字字符和汉语中的汉字字符之间的搭配.与单词搭配一样,一些汉字序列比其他序列更有可能.例如:中文和日文中的许多单词是双字符双字母 - 字符A和字符B(例如日本=日本,日语为ni-hon,中文为ri-ben).给定字符A(日),本身更有可能出现为字符B.所以字符日和本是搭配.
我想使用NLTK找出这些问题的答案:
(1)给定字符A,哪个字符最有可能是字符B?
(2)给定字符B,哪些字符最有可能是字符A?
(3)字符A和字符B在一个句子中出现的可能性有多大,即使它们不是并排显示的?
相关:如果我有一个汉字/汉字的频率列表,我可以强制NLTK搭配模块只查看我列表中的汉字/汉字之间的关系,忽略所有其他字符吗?这将过滤掉在可能的并置集合中考虑单个罗马字母(a,b,c等)或标点符号的结果.
不幸的是,nltk.collocations和NLTK Book的文档,操作方法和源代码只讨论英语NLP,可以理解的是没有解决单字符搭配的问题.nltk.collocations模块中的函数似乎内置了一个单词标记器,所以我认为它们默认忽略单个字符.
更新:以下代码似乎在正确的轨道上:
def main():
scorer = nltk.collocations.BigramAssocMeasures.likelihood_ratio
with open('sample_jp_text.txt', mode='r') as infile:
sample_text = infile.read()
bigram_measures = nltk.collocations.BigramAssocMeasures()
finder = BigramCollocationFinder.from_words(sample_text,window_size = 13)
#corpus = make_corpus()
print('\t', [' '.join(tup) for tup in finder.nbest(scorer, 15)])
Run Code Online (Sandbox Code Playgroud)
结果:
['? ?', '? ?', '? ?', '0 0', '? ?', '? ?', '? ?', '? 0', '2 0', '? ?', '0 ?', '? ?', …Run Code Online (Sandbox Code Playgroud)