簡體   English   中英

使用未聲明的類型NSLinguisticTagScheme

[英]use of undeclared type NSLinguisticTagScheme

我的代碼在操場上工作,並且Xcode沒有顯示錯誤,但是當我在命令行上編譯文件時,它會返回錯誤

use of undeclared type NSLinguisticTagScheme
and String has no member 'tokenType'

這是問題代碼。

let tagSchemes : [NSLinguisticTagScheme] = [ .tokenType]
let tagger : NSLinguisticTagger = NSLinguisticTagger(tagSchemes: tagSchemes, options: 0)
let options : NSLinguisticTagger.Options = [ .omitPunctuation, .omitWhitespace]

tagger.string = text
let range = NSRange(location: 0, length: text.utf16.count)

tagger.enumerateTags( in: range, unit: .sentence, scheme: .tokenType, options: options, using: 
{ tag, tokenRange, stop in
    let token = (text as NSString).substring(with: tokenRange)
    sentences.append(token)
})

有任何想法嗎?

更新Xcode解決了該問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM