objc2_foundation/generated/
NSLinguisticTagger.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[cfg(feature = "NSString")]
12pub type NSLinguisticTagScheme = NSString;
13
14extern "C" {
15 #[cfg(feature = "NSString")]
17 pub static NSLinguisticTagSchemeTokenType: &'static NSLinguisticTagScheme;
18}
19
20extern "C" {
21 #[cfg(feature = "NSString")]
23 pub static NSLinguisticTagSchemeLexicalClass: &'static NSLinguisticTagScheme;
24}
25
26extern "C" {
27 #[cfg(feature = "NSString")]
29 pub static NSLinguisticTagSchemeNameType: &'static NSLinguisticTagScheme;
30}
31
32extern "C" {
33 #[cfg(feature = "NSString")]
35 pub static NSLinguisticTagSchemeNameTypeOrLexicalClass: &'static NSLinguisticTagScheme;
36}
37
38extern "C" {
39 #[cfg(feature = "NSString")]
41 pub static NSLinguisticTagSchemeLemma: &'static NSLinguisticTagScheme;
42}
43
44extern "C" {
45 #[cfg(feature = "NSString")]
47 pub static NSLinguisticTagSchemeLanguage: &'static NSLinguisticTagScheme;
48}
49
50extern "C" {
51 #[cfg(feature = "NSString")]
53 pub static NSLinguisticTagSchemeScript: &'static NSLinguisticTagScheme;
54}
55
56#[cfg(feature = "NSString")]
59pub type NSLinguisticTag = NSString;
60
61extern "C" {
62 #[cfg(feature = "NSString")]
64 pub static NSLinguisticTagWord: &'static NSLinguisticTag;
65}
66
67extern "C" {
68 #[cfg(feature = "NSString")]
70 pub static NSLinguisticTagPunctuation: &'static NSLinguisticTag;
71}
72
73extern "C" {
74 #[cfg(feature = "NSString")]
76 pub static NSLinguisticTagWhitespace: &'static NSLinguisticTag;
77}
78
79extern "C" {
80 #[cfg(feature = "NSString")]
82 pub static NSLinguisticTagOther: &'static NSLinguisticTag;
83}
84
85extern "C" {
86 #[cfg(feature = "NSString")]
88 pub static NSLinguisticTagNoun: &'static NSLinguisticTag;
89}
90
91extern "C" {
92 #[cfg(feature = "NSString")]
94 pub static NSLinguisticTagVerb: &'static NSLinguisticTag;
95}
96
97extern "C" {
98 #[cfg(feature = "NSString")]
100 pub static NSLinguisticTagAdjective: &'static NSLinguisticTag;
101}
102
103extern "C" {
104 #[cfg(feature = "NSString")]
106 pub static NSLinguisticTagAdverb: &'static NSLinguisticTag;
107}
108
109extern "C" {
110 #[cfg(feature = "NSString")]
112 pub static NSLinguisticTagPronoun: &'static NSLinguisticTag;
113}
114
115extern "C" {
116 #[cfg(feature = "NSString")]
118 pub static NSLinguisticTagDeterminer: &'static NSLinguisticTag;
119}
120
121extern "C" {
122 #[cfg(feature = "NSString")]
124 pub static NSLinguisticTagParticle: &'static NSLinguisticTag;
125}
126
127extern "C" {
128 #[cfg(feature = "NSString")]
130 pub static NSLinguisticTagPreposition: &'static NSLinguisticTag;
131}
132
133extern "C" {
134 #[cfg(feature = "NSString")]
136 pub static NSLinguisticTagNumber: &'static NSLinguisticTag;
137}
138
139extern "C" {
140 #[cfg(feature = "NSString")]
142 pub static NSLinguisticTagConjunction: &'static NSLinguisticTag;
143}
144
145extern "C" {
146 #[cfg(feature = "NSString")]
148 pub static NSLinguisticTagInterjection: &'static NSLinguisticTag;
149}
150
151extern "C" {
152 #[cfg(feature = "NSString")]
154 pub static NSLinguisticTagClassifier: &'static NSLinguisticTag;
155}
156
157extern "C" {
158 #[cfg(feature = "NSString")]
160 pub static NSLinguisticTagIdiom: &'static NSLinguisticTag;
161}
162
163extern "C" {
164 #[cfg(feature = "NSString")]
166 pub static NSLinguisticTagOtherWord: &'static NSLinguisticTag;
167}
168
169extern "C" {
170 #[cfg(feature = "NSString")]
172 pub static NSLinguisticTagSentenceTerminator: &'static NSLinguisticTag;
173}
174
175extern "C" {
176 #[cfg(feature = "NSString")]
178 pub static NSLinguisticTagOpenQuote: &'static NSLinguisticTag;
179}
180
181extern "C" {
182 #[cfg(feature = "NSString")]
184 pub static NSLinguisticTagCloseQuote: &'static NSLinguisticTag;
185}
186
187extern "C" {
188 #[cfg(feature = "NSString")]
190 pub static NSLinguisticTagOpenParenthesis: &'static NSLinguisticTag;
191}
192
193extern "C" {
194 #[cfg(feature = "NSString")]
196 pub static NSLinguisticTagCloseParenthesis: &'static NSLinguisticTag;
197}
198
199extern "C" {
200 #[cfg(feature = "NSString")]
202 pub static NSLinguisticTagWordJoiner: &'static NSLinguisticTag;
203}
204
205extern "C" {
206 #[cfg(feature = "NSString")]
208 pub static NSLinguisticTagDash: &'static NSLinguisticTag;
209}
210
211extern "C" {
212 #[cfg(feature = "NSString")]
214 pub static NSLinguisticTagOtherPunctuation: &'static NSLinguisticTag;
215}
216
217extern "C" {
218 #[cfg(feature = "NSString")]
220 pub static NSLinguisticTagParagraphBreak: &'static NSLinguisticTag;
221}
222
223extern "C" {
224 #[cfg(feature = "NSString")]
226 pub static NSLinguisticTagOtherWhitespace: &'static NSLinguisticTag;
227}
228
229extern "C" {
230 #[cfg(feature = "NSString")]
232 pub static NSLinguisticTagPersonalName: &'static NSLinguisticTag;
233}
234
235extern "C" {
236 #[cfg(feature = "NSString")]
238 pub static NSLinguisticTagPlaceName: &'static NSLinguisticTag;
239}
240
241extern "C" {
242 #[cfg(feature = "NSString")]
244 pub static NSLinguisticTagOrganizationName: &'static NSLinguisticTag;
245}
246
247#[repr(transparent)]
250#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
251pub struct NSLinguisticTaggerUnit(pub NSInteger);
252impl NSLinguisticTaggerUnit {
253 #[doc(alias = "NSLinguisticTaggerUnitWord")]
254 pub const Word: Self = Self(0);
255 #[doc(alias = "NSLinguisticTaggerUnitSentence")]
256 pub const Sentence: Self = Self(1);
257 #[doc(alias = "NSLinguisticTaggerUnitParagraph")]
258 pub const Paragraph: Self = Self(2);
259 #[doc(alias = "NSLinguisticTaggerUnitDocument")]
260 pub const Document: Self = Self(3);
261}
262
263unsafe impl Encode for NSLinguisticTaggerUnit {
264 const ENCODING: Encoding = NSInteger::ENCODING;
265}
266
267unsafe impl RefEncode for NSLinguisticTaggerUnit {
268 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
269}
270
271#[repr(transparent)]
274#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
275pub struct NSLinguisticTaggerOptions(pub NSUInteger);
276bitflags::bitflags! {
277 impl NSLinguisticTaggerOptions: NSUInteger {
278 #[doc(alias = "NSLinguisticTaggerOmitWords")]
279 const OmitWords = 1<<0;
280 #[doc(alias = "NSLinguisticTaggerOmitPunctuation")]
281 const OmitPunctuation = 1<<1;
282 #[doc(alias = "NSLinguisticTaggerOmitWhitespace")]
283 const OmitWhitespace = 1<<2;
284 #[doc(alias = "NSLinguisticTaggerOmitOther")]
285 const OmitOther = 1<<3;
286 #[doc(alias = "NSLinguisticTaggerJoinNames")]
287 const JoinNames = 1<<4;
288 }
289}
290
291unsafe impl Encode for NSLinguisticTaggerOptions {
292 const ENCODING: Encoding = NSUInteger::ENCODING;
293}
294
295unsafe impl RefEncode for NSLinguisticTaggerOptions {
296 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
297}
298
299extern_class!(
300 #[unsafe(super(NSObject))]
302 #[derive(Debug, PartialEq, Eq, Hash)]
303 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
304 pub struct NSLinguisticTagger;
305);
306
307extern_conformance!(
308 unsafe impl NSObjectProtocol for NSLinguisticTagger {}
309);
310
311impl NSLinguisticTagger {
312 extern_methods!(
313 #[cfg(all(feature = "NSArray", feature = "NSString"))]
314 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
315 #[unsafe(method(initWithTagSchemes:options:))]
316 #[unsafe(method_family = init)]
317 pub unsafe fn initWithTagSchemes_options(
318 this: Allocated<Self>,
319 tag_schemes: &NSArray<NSLinguisticTagScheme>,
320 opts: NSUInteger,
321 ) -> Retained<Self>;
322
323 #[cfg(all(feature = "NSArray", feature = "NSString"))]
324 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
325 #[unsafe(method(tagSchemes))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn tagSchemes(&self) -> Retained<NSArray<NSLinguisticTagScheme>>;
328
329 #[cfg(feature = "NSString")]
330 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
331 #[unsafe(method(string))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn string(&self) -> Option<Retained<NSString>>;
334
335 #[cfg(feature = "NSString")]
336 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
338 #[unsafe(method(setString:))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn setString(&self, string: Option<&NSString>);
341
342 #[cfg(all(feature = "NSArray", feature = "NSString"))]
343 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
344 #[unsafe(method(availableTagSchemesForUnit:language:))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn availableTagSchemesForUnit_language(
347 unit: NSLinguisticTaggerUnit,
348 language: &NSString,
349 ) -> Retained<NSArray<NSLinguisticTagScheme>>;
350
351 #[cfg(all(feature = "NSArray", feature = "NSString"))]
352 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
353 #[unsafe(method(availableTagSchemesForLanguage:))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn availableTagSchemesForLanguage(
356 language: &NSString,
357 ) -> Retained<NSArray<NSLinguisticTagScheme>>;
358
359 #[cfg(all(feature = "NSOrthography", feature = "NSRange"))]
360 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
361 #[unsafe(method(setOrthography:range:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn setOrthography_range(
364 &self,
365 orthography: Option<&NSOrthography>,
366 range: NSRange,
367 );
368
369 #[cfg(all(feature = "NSOrthography", feature = "NSRange"))]
370 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
371 #[unsafe(method(orthographyAtIndex:effectiveRange:))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn orthographyAtIndex_effectiveRange(
374 &self,
375 char_index: NSUInteger,
376 effective_range: NSRangePointer,
377 ) -> Option<Retained<NSOrthography>>;
378
379 #[cfg(feature = "NSRange")]
380 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
381 #[unsafe(method(stringEditedInRange:changeInLength:))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn stringEditedInRange_changeInLength(
384 &self,
385 new_range: NSRange,
386 delta: NSInteger,
387 );
388
389 #[cfg(feature = "NSRange")]
390 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
391 #[unsafe(method(tokenRangeAtIndex:unit:))]
392 #[unsafe(method_family = none)]
393 pub unsafe fn tokenRangeAtIndex_unit(
394 &self,
395 char_index: NSUInteger,
396 unit: NSLinguisticTaggerUnit,
397 ) -> NSRange;
398
399 #[cfg(feature = "NSRange")]
400 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
401 #[unsafe(method(sentenceRangeForRange:))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn sentenceRangeForRange(&self, range: NSRange) -> NSRange;
404
405 #[cfg(all(feature = "NSRange", feature = "NSString", feature = "block2"))]
406 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
407 #[unsafe(method(enumerateTagsInRange:unit:scheme:options:usingBlock:))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn enumerateTagsInRange_unit_scheme_options_usingBlock(
410 &self,
411 range: NSRange,
412 unit: NSLinguisticTaggerUnit,
413 scheme: &NSLinguisticTagScheme,
414 options: NSLinguisticTaggerOptions,
415 block: &block2::DynBlock<dyn Fn(*mut NSLinguisticTag, NSRange, NonNull<Bool>) + '_>,
416 );
417
418 #[cfg(all(feature = "NSRange", feature = "NSString"))]
419 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
420 #[unsafe(method(tagAtIndex:unit:scheme:tokenRange:))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn tagAtIndex_unit_scheme_tokenRange(
423 &self,
424 char_index: NSUInteger,
425 unit: NSLinguisticTaggerUnit,
426 scheme: &NSLinguisticTagScheme,
427 token_range: NSRangePointer,
428 ) -> Option<Retained<NSLinguisticTag>>;
429
430 #[cfg(all(
431 feature = "NSArray",
432 feature = "NSRange",
433 feature = "NSString",
434 feature = "NSValue"
435 ))]
436 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
437 #[unsafe(method(tagsInRange:unit:scheme:options:tokenRanges:))]
438 #[unsafe(method_family = none)]
439 pub unsafe fn tagsInRange_unit_scheme_options_tokenRanges(
440 &self,
441 range: NSRange,
442 unit: NSLinguisticTaggerUnit,
443 scheme: &NSLinguisticTagScheme,
444 options: NSLinguisticTaggerOptions,
445 token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
446 ) -> Retained<NSArray<NSLinguisticTag>>;
447
448 #[cfg(all(feature = "NSRange", feature = "NSString", feature = "block2"))]
449 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
450 #[unsafe(method(enumerateTagsInRange:scheme:options:usingBlock:))]
451 #[unsafe(method_family = none)]
452 pub unsafe fn enumerateTagsInRange_scheme_options_usingBlock(
453 &self,
454 range: NSRange,
455 tag_scheme: &NSLinguisticTagScheme,
456 opts: NSLinguisticTaggerOptions,
457 block: &block2::DynBlock<
458 dyn Fn(*mut NSLinguisticTag, NSRange, NSRange, NonNull<Bool>) + '_,
459 >,
460 );
461
462 #[cfg(all(feature = "NSRange", feature = "NSString"))]
463 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
464 #[unsafe(method(tagAtIndex:scheme:tokenRange:sentenceRange:))]
465 #[unsafe(method_family = none)]
466 pub unsafe fn tagAtIndex_scheme_tokenRange_sentenceRange(
467 &self,
468 char_index: NSUInteger,
469 scheme: &NSLinguisticTagScheme,
470 token_range: NSRangePointer,
471 sentence_range: NSRangePointer,
472 ) -> Option<Retained<NSLinguisticTag>>;
473
474 #[cfg(all(
475 feature = "NSArray",
476 feature = "NSRange",
477 feature = "NSString",
478 feature = "NSValue"
479 ))]
480 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
481 #[unsafe(method(tagsInRange:scheme:options:tokenRanges:))]
482 #[unsafe(method_family = none)]
483 pub unsafe fn tagsInRange_scheme_options_tokenRanges(
484 &self,
485 range: NSRange,
486 tag_scheme: &NSString,
487 opts: NSLinguisticTaggerOptions,
488 token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
489 ) -> Retained<NSArray<NSString>>;
490
491 #[cfg(feature = "NSString")]
492 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
493 #[unsafe(method(dominantLanguage))]
494 #[unsafe(method_family = none)]
495 pub unsafe fn dominantLanguage(&self) -> Option<Retained<NSString>>;
496
497 #[cfg(feature = "NSString")]
498 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
499 #[unsafe(method(dominantLanguageForString:))]
500 #[unsafe(method_family = none)]
501 pub unsafe fn dominantLanguageForString(string: &NSString) -> Option<Retained<NSString>>;
502
503 #[cfg(all(feature = "NSOrthography", feature = "NSRange", feature = "NSString"))]
504 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
505 #[unsafe(method(tagForString:atIndex:unit:scheme:orthography:tokenRange:))]
506 #[unsafe(method_family = none)]
507 pub unsafe fn tagForString_atIndex_unit_scheme_orthography_tokenRange(
508 string: &NSString,
509 char_index: NSUInteger,
510 unit: NSLinguisticTaggerUnit,
511 scheme: &NSLinguisticTagScheme,
512 orthography: Option<&NSOrthography>,
513 token_range: NSRangePointer,
514 ) -> Option<Retained<NSLinguisticTag>>;
515
516 #[cfg(all(
517 feature = "NSArray",
518 feature = "NSOrthography",
519 feature = "NSRange",
520 feature = "NSString",
521 feature = "NSValue"
522 ))]
523 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
524 #[unsafe(method(tagsForString:range:unit:scheme:options:orthography:tokenRanges:))]
525 #[unsafe(method_family = none)]
526 pub unsafe fn tagsForString_range_unit_scheme_options_orthography_tokenRanges(
527 string: &NSString,
528 range: NSRange,
529 unit: NSLinguisticTaggerUnit,
530 scheme: &NSLinguisticTagScheme,
531 options: NSLinguisticTaggerOptions,
532 orthography: Option<&NSOrthography>,
533 token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
534 ) -> Retained<NSArray<NSLinguisticTag>>;
535
536 #[cfg(all(
537 feature = "NSOrthography",
538 feature = "NSRange",
539 feature = "NSString",
540 feature = "block2"
541 ))]
542 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
543 #[unsafe(method(enumerateTagsForString:range:unit:scheme:options:orthography:usingBlock:))]
544 #[unsafe(method_family = none)]
545 pub unsafe fn enumerateTagsForString_range_unit_scheme_options_orthography_usingBlock(
546 string: &NSString,
547 range: NSRange,
548 unit: NSLinguisticTaggerUnit,
549 scheme: &NSLinguisticTagScheme,
550 options: NSLinguisticTaggerOptions,
551 orthography: Option<&NSOrthography>,
552 block: &block2::DynBlock<dyn Fn(*mut NSLinguisticTag, NSRange, NonNull<Bool>) + '_>,
553 );
554
555 #[cfg(all(
556 feature = "NSArray",
557 feature = "NSRange",
558 feature = "NSString",
559 feature = "NSValue"
560 ))]
561 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
562 #[unsafe(method(possibleTagsAtIndex:scheme:tokenRange:sentenceRange:scores:))]
563 #[unsafe(method_family = none)]
564 pub unsafe fn possibleTagsAtIndex_scheme_tokenRange_sentenceRange_scores(
565 &self,
566 char_index: NSUInteger,
567 tag_scheme: &NSString,
568 token_range: NSRangePointer,
569 sentence_range: NSRangePointer,
570 scores: Option<&mut Option<Retained<NSArray<NSValue>>>>,
571 ) -> Option<Retained<NSArray<NSString>>>;
572 );
573}
574
575impl NSLinguisticTagger {
577 extern_methods!(
578 #[unsafe(method(init))]
579 #[unsafe(method_family = init)]
580 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
581
582 #[unsafe(method(new))]
583 #[unsafe(method_family = new)]
584 pub unsafe fn new() -> Retained<Self>;
585 );
586}
587
588#[cfg(feature = "NSString")]
590impl NSString {
591 extern_methods!(
592 #[cfg(all(
593 feature = "NSArray",
594 feature = "NSOrthography",
595 feature = "NSRange",
596 feature = "NSValue"
597 ))]
598 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
599 #[unsafe(method(linguisticTagsInRange:scheme:options:orthography:tokenRanges:))]
600 #[unsafe(method_family = none)]
601 pub unsafe fn linguisticTagsInRange_scheme_options_orthography_tokenRanges(
602 &self,
603 range: NSRange,
604 scheme: &NSLinguisticTagScheme,
605 options: NSLinguisticTaggerOptions,
606 orthography: Option<&NSOrthography>,
607 token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
608 ) -> Retained<NSArray<NSLinguisticTag>>;
609
610 #[cfg(all(feature = "NSOrthography", feature = "NSRange", feature = "block2"))]
611 #[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
612 #[unsafe(method(enumerateLinguisticTagsInRange:scheme:options:orthography:usingBlock:))]
613 #[unsafe(method_family = none)]
614 pub unsafe fn enumerateLinguisticTagsInRange_scheme_options_orthography_usingBlock(
615 &self,
616 range: NSRange,
617 scheme: &NSLinguisticTagScheme,
618 options: NSLinguisticTaggerOptions,
619 orthography: Option<&NSOrthography>,
620 block: &block2::DynBlock<
621 dyn Fn(*mut NSLinguisticTag, NSRange, NSRange, NonNull<Bool>) + '_,
622 >,
623 );
624 );
625}