繁体   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