Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
425 views
in Technique[技术] by (71.8m points)

ios - Device vs. Simulator Linguistic Schemes

Does anyone understand why this is happening?

On any simulator all of the schemes are found with the following code:

NSArray<NSLinguisticTagScheme> *availSchemes = [NSLinguisticTagger availableTagSchemesForLanguage:@"en"];
for (NSLinguisticTagScheme scheme in availSchemes) {
    NSLog(@"Tag scheme %@", scheme);
}

yielding the following:

2018-02-13 09:12:54.066970-0500 MY_APP[79671:5737063] Tag scheme Language
2018-02-13 09:12:54.067160-0500 MY_APP[79671:5737063] Tag scheme Script
2018-02-13 09:12:54.067300-0500 MY_APP[79671:5737063] Tag scheme TokenType
2018-02-13 09:12:54.067425-0500 MY_APP[79671:5737063] Tag scheme LexicalClass
2018-02-13 09:12:54.067541-0500 MY_APP[79671:5737063] Tag scheme NameType
2018-02-13 09:12:54.067655-0500 MY_APP[79671:5737063] Tag scheme NameTypeOrLexicalClass
2018-02-13 09:12:54.067768-0500 MY_APP[79671:5737063] Tag scheme Lemma

However, on my device (iPhone 6s iOS 11.2) I receive the following..

2018-02-13 09:13:09.834879-0500 MY_APP[4327:313598] Tag scheme Language
2018-02-13 09:13:09.835256-0500 MY_APP[4327:313598] Tag scheme Script
2018-02-13 09:13:09.835556-0500 MY_APP[4327:313598] Tag scheme TokenType

Can anyone help explain to me why I cannot access the other schemes? In particular I am looking to be able to use the NSLinguisticTagSchemeLexicalClass with NSLinguisticTagger. Currently this issue is causing the tagger to tag any word as (OtherWord), instead of it's true part of speech.

Any help would be appreciated..

UPDATE

ALL physical devices give me the same results - only three available schemes... I am at a loss here.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After tireless research, sleepless nights, and three trips to the ward, I found out the problem. While the fix was by all means the poor man's solution, it worked nonetheless.


For whatever reason my iPhone 6s iOS 11.2.5 didn't feel like installing all of the available linguistic schemes when I originally set up my phone? Either that or it decided to remove them one day when it was bored.

Regardless, the solution was... drum roll...

Uninstall the target language...then reinstall it.


I guess this "reset" the language package to re-include these schemes. Happy codinggg


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...