【发布时间】:2020-04-03 14:12:20
【问题描述】:
我从互联网上获得的患者病历文本文件很少,我想识别/查找质量差的文件(拼写错误的单词/单词之间的特殊字符/错误的单词)和质量好的文件(干净text)。我想使用文本挖掘/NLP 构建错误检测模型。
1)有人可以帮助我了解特征提取和模型选择的方法和解决方案。 2)是否有医疗记录的医疗语料库来识别拼写错误/错误的单词。
【问题讨论】:
标签: nlp data-science text-mining medical
我从互联网上获得的患者病历文本文件很少,我想识别/查找质量差的文件(拼写错误的单词/单词之间的特殊字符/错误的单词)和质量好的文件(干净text)。我想使用文本挖掘/NLP 构建错误检测模型。
1)有人可以帮助我了解特征提取和模型选择的方法和解决方案。 2)是否有医疗记录的医疗语料库来识别拼写错误/错误的单词。
【问题讨论】:
标签: nlp data-science text-mining medical
如果您的目标是简单地纠正这些拼写错误的单词以提高您想要执行的任何下游任务的性能,那么我可以建议一种对我来说效果很好的简单方法。
scispacy 用于医学文本)pyspellchecker 来识别拼写错误。pyspellchecker 认为的错误替换错别字。一个基本的例子:
import spacy
import scispacy
from collections import Counter
from spellchecker import SpellChecker
nlp = spacy.load('en_core_sci_md') # sciSpaCy
word_freq = Counter()
for doc in corpus:
tokens = nlp.tokenizer(doc)
tokenised_text = ""
for token in tokens:
tokenised_text = tokenised_text + token.text + " "
word_freq.update(tokenised_text.split())
infreq_words = [word for word in word_freq.keys() if word_freq[word] <= 3 and word[0].isdigit() == False]
freq_words = [word for word in word_freq.keys() if word_freq[word] > 3]
add_to_dictionary = " ".join(freq_words)
f=open("medical_dict.txt", "w+")
f.write(add_to_dictionary)
f.close()
spell = SpellChecker()
spell.distance = 1 # set the distance parameter to just 1 edit away - much quicker
spell.word_frequency.load_text_file('medical_dict.txt')
misspelled = spell.unknown(infreq_words)
misspell_dict = {}
for i, word in enumerate(misspelled):
if (word != spell.correction(word)):
misspell_dict[word] = spell.correction(word)
print(list(misspell_dict.items())[:10])
我还建议使用正则表达式来修复任何其他可以系统纠正的“质量差”的词。
【讨论】:
你可以做 biobert 来做上下文拼写检查,
【讨论】: