FlaskAppでNLPのspaCy機能を使いたいです。 https://spacy.io/docs/usage/tutorialsspaCy NLPのトークンをPythonで定義する方法は?
(スペイシー用)と私はparse_news_from
からNLP分析の結果を掲示するためのコードを持っているMyWebappで https://realpython.com/blog/python/flask-by-example-part-3-text-processing-with-requests-beautifulsoup-nltk/
(フラスコ用):
@app.route('/submit', methods=['POST'])
def submit_textarea():
if(parse_news_from(format(request.form["text"]))):
print("The news is parsed sucessfully!");
return talk_title;
私は公式サイト上の別の例を検索していました
現在parse_news_from
はNLTKライブラリで動作しますが、spaCyを使用します。ここ は、公式のソースからスペイシーのための私のコードです:
from spacy.en import English
import _regex
parser = English()
# Test Data
multiSentence = "There is an art, it says, or rather, a knack to flying." \
"The knack lies in learning how to throw yourself at the ground and miss." \
"In the beginning the Universe was created. This has made a lot of people "\
"very angry and been widely regarded as a bad move."
# all you have to do to parse text is this:
#note: the first time you run spaCy in a file it takes a little while to load up its modules
parsedData = parser(multiSentence)
# Let's look at the tokens
# All you have to do is iterate through the parsedData
# Each token is an object with lots of different properties
# A property with an underscore at the end returns the string representation
# while a property without the underscore returns an index (int) into spaCy's vocabulary
# The probability estimate is based on counts from a 3 billion word
# corpus, smoothed using the Simple Good-Turing method.
for i, token in enumerate(parsedData):
print("original:", token.orth, token.orth_)
print("lowercased:", token.lower, token.lower_)
print("lemma:", token.lemma, token.lemma_)
print("shape:", token.shape, token.shape_)
print("prefix:", token.prefix, token.prefix_)
print("suffix:", token.suffix, token.suffix_)
print("log probability:", token.prob)
print("Brown cluster id:", token.cluster)
print("----------------------------------------")
if i > 1:
break
実行した後、私はミスを持っている:
File "/home/xxx/anaconda3/lib/python3.6/site-packages/_regex_core.py", line 21, in <module>
import _regex
ImportError: /home/xxx/anaconda3/lib/python3.6/site-packages/_regex.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PySlice_AdjustIndices
は、任意の作業実施例は、起動のためにそれを行う方法はありますか?どこで私の間違い?ありがとう