nslinguistictagger

How to detect the dominant language of a text word?

百般思念 提交于 2021-02-11 12:17:38
问题 It's looks good for string but it's not working for me for a word . I am working with search as per as my requirement when user typing any 3 character in the meantime looking to check which language user typing. if I think it should not work with detec0t word but i expect it should be working with Islam word. let tagger = NSLinguisticTagger(tagSchemes:[.tokenType, .language, .lexicalClass, .nameType, .lemma], options: 0) func determineLanguage(for text: String) { tagger.string = text let

NSLinguisticTagger enumerateTagsInRange doesn't work on device with NSLinguisticTagSchemeNameTypeOrLexicalClass

纵饮孤独 提交于 2020-01-11 03:15:27
问题 Here's the code I'm using, it prints nothing no matter what sentence I use on the device. On simulator it works fine! - (NSMutableArray *)getTagEntries:(NSString *)sentence { NSArray<NSLinguisticTagScheme> *tagSchemes = [NSLinguisticTagger availableTagSchemesForLanguage:@"en"]; NSLinguisticTaggerOptions options = NSLinguisticTaggerJoinNames | NSLinguisticTaggerOmitWhitespace; NSLinguisticTagger *linguisticTagger = [[NSLinguisticTagger alloc] initWithTagSchemes:tagSchemes options:options];

Device vs. Simulator Linguistic Schemes

时光总嘲笑我的痴心妄想 提交于 2019-12-18 06:20:51
问题 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

Device vs. Simulator Linguistic Schemes

狂风中的少年 提交于 2019-12-18 06:20:02
问题 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

How to detect text (string) language in iOS?

ぐ巨炮叔叔 提交于 2019-12-18 01:15:11
问题 For instance, given the following strings: let textEN = "The quick brown fox jumps over the lazy dog" let textES = "El zorro marrón rápido salta sobre el perro perezoso" let textAR = "الثعلب البني السريع يقفز فوق الكلب الكسول" let textDE = "Der schnelle braune Fuchs springt über den faulen Hund" I want to detect the used language in each of them. Let's assume the signature for the implemented function is: func detectedLangauge<T: StringProtocol>(_ forString: T) -> String? returns an Optional

iOS NSLinguisticTagger always return null when getting the lemma stem

情到浓时终转凉″ 提交于 2019-12-08 06:17:12
问题 I need to match a keyword (which is in its lexical form) with a text and return whether the keyword matches (just like a search engine) for example text: I want some apples keyword: apple result: matched keyword: banana result: not matched This is my method, I always get null for the tag - (BOOL)matchKeywordWithText:(NSString *)text keyword:(NSString *)keyword { __block NSMutableArray *words = [NSMutableArray array]; NSLinguisticTaggerOptions options = NSLinguisticTaggerOmitWhitespace |

Converting a Vision VNTextObservation to a String

橙三吉。 提交于 2019-11-29 18:47:28
I'm looking through the Apple's Vision API documentation and I see a couple of classes that relate to text detection in UIImages : 1) class VNDetectTextRectanglesRequest 2) class VNTextObservation It looks like they can detect characters, but I don't see a means to do anything with the characters. Once you've got characters detected, how would you go about turning them into something that can be interpreted by NSLinguisticTagger ? Here's a post that is a brief overview of Vision . Thank you for reading. SwiftOCR I just got SwiftOCR to work with small sets of text. https://github.com/garnele007

Device vs. Simulator Linguistic Schemes

谁说胖子不能爱 提交于 2019-11-29 10:55:58
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

Converting a Vision VNTextObservation to a String

大城市里の小女人 提交于 2019-11-28 13:40:00
问题 I'm looking through the Apple's Vision API documentation and I see a couple of classes that relate to text detection in UIImages : 1) class VNDetectTextRectanglesRequest 2) class VNTextObservation It looks like they can detect characters, but I don't see a means to do anything with the characters. Once you've got characters detected, how would you go about turning them into something that can be interpreted by NSLinguisticTagger? Here's a post that is a brief overview of Vision. Thank you for