0
의도는 POS 태그를 기반으로합니다. 아래 링크를 통해이 태그를 얻을 수 있습니다.Truecasing - SpaCy
How can I best determine the correct capitalization for a word?
유사한 결과를 이용하여 적응 달성하려고?
def truecase(doc):
truecased_sents = [] # list of truecased sentences
tagged_sent = token.tag_([word.lower() for token in doc])
normalized_sent = [w.capitalize() if t in ["NN","NNS"] else w for (w,t) in tagged_sent]
normalized_sent[0] = normalized_sent[0].capitalize()
string = re.sub(" (?=[\.,'!?:;])", "", ' '.join(normalized_sent))
return string
는 토큰 글로벌 선언하고이 문제를 해결하는 방법이 오류
tagged_sent = token.tag_([word.lower() for token in doc])
NameError: global name 'token' is not defined
을 던졌습니다. 내 접근 방식이 맞습니까?