我正在寻找一种从文本文档中提取“重要短语”的方法。希望使用 Spacy 做到这一点,但有一个警告:我的数据主要包含产品信息,因此重要的短语与自然口语中的短语不同。出于这个原因,我想在我自己的语料库上训练 spacy,但我能找到的唯一信息是使用标记数据训练 spacy。
有谁知道我想做的事情是否可行?
我想将文本中的换行符识别为句子的结尾。我尝试将其输入到 nlp 对象中,如下所示:
text = 'Guest Blogging\nGuest Blogging allows the user to collect backlinks'
nlp = spacy.load("en_core_web_lg")
config = {"punct_chars": ['\n']}
nlp.add_pipe("sentencizer", config=config)
for sent in nlp(text).sents:
print('next sentence:')
print(sent)
Run Code Online (Sandbox Code Playgroud)
其输出是:
next sentence:
Guest Blogging
Guest Blogging allows the user to collect backlinks
Run Code Online (Sandbox Code Playgroud)
我不明白为什么 Spacy 不将换行符识别为句子结尾。我想要的输出是:
next sentence:
Guest Blogging:
next sentence:
Guest Blogging allows the user to collect backlinks
Run Code Online (Sandbox Code Playgroud)
有谁知道如何实现这一目标?
我想找到一种有效的方法来过滤RANK() OVERSQL 中的函数。
我有以下查询:
SELECT
base.ITEM_SKU_NBR,
RANK() OVER (ORDER BY SUM(base.NET_SLS_AMT) DESC) AS SLS_rank,
RANK() OVER (ORDER BY COUNT(DISTINCT base.txn_id) DESC) AS txn_rank
FROM
`my_table` base
GROUP BY
1
Run Code Online (Sandbox Code Playgroud)
返回此结果集:
现在我想过滤 is SLS_rank< 10 或txn_rankis < 10 的项目。理想情况下,我想在HAVING子句中执行此操作,如下所示:
SELECT
base.ITEM_SKU_NBR,
RANK() OVER (ORDER BY SUM(base.NET_SLS_AMT) DESC) AS SLS_rank,
RANK() OVER (ORDER BY COUNT(DISTINCT base.txn_id) DESC) AS txn_rank
FROM
`my_table` base
GROUP BY
1
HAVING
SLS_rank < 10 OR txn_rank < 10
Run Code Online (Sandbox Code Playgroud)
但 bigquery …