有没有更快的方法来获得 BERT 中给定子词嵌入的词嵌入
使用 bert.tokenizer 我可以获取句子中单词的子词 id 和单词跨度,例如,给定句子“这是一个例子”,我得到 [“th”,“##is”的编码文本嵌入, "an",…
keras pad_sequence 和 Tokenizer
i learn on kaggle dataset Here to practice on nlp i have an error when i tokenize the tweets and go to padding them i got an error i search…
如何从我的日志文件中提取并使用@timefield?
我希望设置@timestamp字段以读取我的日志行中的时间戳,而不是使用读取日志时的时间。 示例日志线: 2021.04.21 00:00:00.843 INF getBaseData: UserN…
NLTK word_tokenize 返回空
我正在尝试将文本文档中的单词和句子归为单词和句子,但两者都空了。您能检查并分享我为什么看到这个吗? Please find the code below (not attaching…
没有 pos 的句子 - Python
我已经对文本进行了标记,并希望在没有 pos 的情况下打印句子的错误,但它会为每个句子打印错误。我应该如何改变它? sents = nltk.sent_tokenize(tex…
为什么我无法从NLTK diakenize或导入令牌?
我收到以下侵入式: 1 import nltk ---->2 from nltk.tokenize import tokenize 3 import re ImportError: cannot import name 'tokenize' from 'nltk…
TorchText Vocab TypeError:Vocab.__init__() 得到了意外的关键字参数“min_freq”;
我正在研究 CNN 情感分析机器学习模型,该模型使用 Torchtext 库提供的 IMDb 数据集。 在我的一行代码中 vocab = Vocab(counter, min_freq = 1,specia…
如何使用函数递归遍历 txt 或 html 文件并返回每个单独的字符
我正在尝试为我正在构建的 HTML 解析器的标记化阶段创建一个输入流。这是一些背景: 输入流由解码输入字节流时推入其中的字符组成。 在标记化阶段之前…
获取不带标点符号的句子中的字数NLTK python
我正在尝试使用 python 中的 nltk 获取句子中的字数 这是我编写的代码 import nltk data = "Sample sentence, for checking. Here is an exclamation …
字符串缩写中的转义字符不一致
我有正在尝试处理的文本。这里有 2 个例子: Example 1: An alternative way with *:

puts ["Toronto", "Maple Leafs"] * ', '
#Toronto…
Pandas 中的 LabelEncoding 在具有跨行字符串列表的列上
我想对 pandas 中的一列进行 LabelEncode,其中每行包含一个字符串列表。由于相似的字符串/文本在行中具有相同的含义,因此编码应该尊重这一点,并且…
如何使用 inltk 标记印度语言
我使用这个 NLP 文档做到了这一点,请查看: https://inltk.readthedocs.io/en/latest/index.html from inltk.inltk import tokenize text="जो मु…
在 Javascript 中使用空格分割字符串?
我需要一个分词器,给定单词之间具有任意空格的字符串将创建一个没有空子字符串的单词数组。 例如,给定一个字符串: " I dont know what you mean by…